diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-11-08 10:33:03 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-11-09 00:20:29 +0100 |
commit | 13f397c68c33cb7296f26a713d629b2d1b8fef08 (patch) | |
tree | dc0c0ef60d11f7fc27f4cf4ea1c2212e551c4fd6 /include | |
parent | 0381276993737708b061905959ab3e57523631fd (diff) |
client: Prepare to have multiple server connections
Take out various fields into a new connection class. We will have the
option to connect to multiple servers.
Change-Id: I820176d133fbdb0240a16eb4e1a6d505e5c080c6
Diffstat (limited to 'include')
-rw-r--r-- | include/osmo-pcap/osmo_pcap_client.h | 47 | ||||
-rw-r--r-- | include/osmo-pcap/osmo_tls.h | 4 |
2 files changed, 29 insertions, 22 deletions
diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index b8ceb38..af94086 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -45,22 +45,7 @@ enum { CLIENT_CTR_P_IFDROP, }; -struct osmo_pcap_client { - char *device; - pcap_t *handle; - char errbuf[PCAP_ERRBUF_SIZE]; - - u_int last_ps_recv; - u_int last_ps_drop; - u_int last_ps_ifdrop; - struct osmo_timer_list pcap_stat_timer; - - struct bpf_program bpf; - char *filter_string; - int filter_itself; - int gprs_filtering; - struct osmo_fd fd; - +struct osmo_pcap_client_conn { char *srv_ip; int srv_port; struct osmo_wqueue wqueue; @@ -80,6 +65,28 @@ struct osmo_pcap_client { struct osmo_tls_session tls_session; + /* back pointer */ + struct osmo_pcap_client *client; +}; + +struct osmo_pcap_client { + char *device; + pcap_t *handle; + char errbuf[PCAP_ERRBUF_SIZE]; + + u_int last_ps_recv; + u_int last_ps_drop; + u_int last_ps_ifdrop; + struct osmo_timer_list pcap_stat_timer; + + struct bpf_program bpf; + char *filter_string; + int filter_itself; + int gprs_filtering; + struct osmo_fd fd; + + struct osmo_pcap_client_conn conn; + /* statistics */ struct rate_ctr_group *ctrg; }; @@ -91,9 +98,9 @@ int vty_client_init(struct osmo_pcap_client *); int osmo_client_capture(struct osmo_pcap_client *client, const char *device); int osmo_client_filter(struct osmo_pcap_client *client, const char *filter); -void osmo_client_send_data(struct osmo_pcap_client *client, +void osmo_client_send_data(struct osmo_pcap_client_conn *client, struct pcap_pkthdr *hdr, const uint8_t *data); -void osmo_client_send_link(struct osmo_pcap_client *client); -void osmo_client_connect(struct osmo_pcap_client *); +void osmo_client_send_link(struct osmo_pcap_client_conn *client); +void osmo_client_connect(struct osmo_pcap_client_conn *); -void osmo_client_reconnect(struct osmo_pcap_client *); +void osmo_client_reconnect(struct osmo_pcap_client_conn *); diff --git a/include/osmo-pcap/osmo_tls.h b/include/osmo-pcap/osmo_tls.h index 0637739..1b15168 100644 --- a/include/osmo-pcap/osmo_tls.h +++ b/include/osmo-pcap/osmo_tls.h @@ -28,7 +28,7 @@ struct osmo_fd; struct osmo_wqueue; -struct osmo_pcap_client; +struct osmo_pcap_client_conn; struct osmo_pcap_conn; struct osmo_pcap_server; @@ -65,7 +65,7 @@ struct osmo_tls_session { void osmo_tls_init(void); -bool osmo_tls_init_client_session(struct osmo_pcap_client *client); +bool osmo_tls_init_client_session(struct osmo_pcap_client_conn *conn); bool osmo_tls_init_server_session(struct osmo_pcap_conn *conn, struct osmo_pcap_server *server); |