aboutsummaryrefslogtreecommitdiffstats
path: root/tests/osmo-pcap-test/proto.h
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-04-20 12:44:04 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-08 20:39:16 +0200
commit6032a35be84c87607e295e46f1e37d3dd4e5f1b1 (patch)
tree1f6adc9e2508132727c9ff839fd7c4ce4f08b69e /tests/osmo-pcap-test/proto.h
parent76c0acb149a03e6d7945e0ee4f4c6355381b7391 (diff)
tests: osmo-pcap: Allow different l2 pkts
Before this patch, ETH was assumed and other types were not supported. This patch also adds Linux cooked packet support for L2. Change-Id: Ie62fa0a8e45e1e141edb64b116dad185ad9c7a5f
Diffstat (limited to 'tests/osmo-pcap-test/proto.h')
-rw-r--r--tests/osmo-pcap-test/proto.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/tests/osmo-pcap-test/proto.h b/tests/osmo-pcap-test/proto.h
index 8cb41ed..2580058 100644
--- a/tests/osmo-pcap-test/proto.h
+++ b/tests/osmo-pcap-test/proto.h
@@ -10,30 +10,42 @@ struct osmo_pcap_proto_l4 {
unsigned int l4protonum;
- int (*l4pkt_hdr_len)(const uint8_t *pkt);
- int (*l4pkt_no_data)(const uint8_t *pkt);
+ unsigned int (*l4pkt_hdr_len)(const uint8_t *pkt);
+ unsigned int (*l4pkt_no_data)(const uint8_t *pkt);
};
-struct osmo_pcap_proto_l2l3 {
+struct osmo_pcap_proto_l3 {
struct llist_head head;
- unsigned int l2protonum;
- unsigned int l2hdr_len;
-
unsigned int l3protonum;
- int (*l3pkt_hdr_len)(const uint8_t *pkt);
- int (*l4pkt_proto)(const uint8_t *pkt);
+ unsigned int (*l3pkt_hdr_len)(const uint8_t *pkt);
+ unsigned int (*l4pkt_proto)(const uint8_t *pkt);
+};
+
+struct osmo_pcap_proto_l2 {
+ struct llist_head head;
+
+ unsigned int l2protonum;
+
+ unsigned int (*l2pkt_hdr_len)(const uint8_t *pkt);
+ unsigned int (*l3pkt_proto)(const uint8_t *pkt);
};
-struct osmo_pcap_proto_l2l3 *osmo_pcap_proto_l2l3_find(const uint8_t *pkt);
-void osmo_pcap_proto_l2l3_register(struct osmo_pcap_proto_l2l3 *h);
-struct osmo_pcap_proto_l4 *osmo_pcap_proto_l4_find(const uint8_t *pkt, unsigned int l4protonum);
+struct osmo_pcap_proto_l2 *osmo_pcap_proto_l2_find(unsigned int pcap_linktype);
+void osmo_pcap_proto_l2_register(struct osmo_pcap_proto_l2 *h);
+
+struct osmo_pcap_proto_l3 *osmo_pcap_proto_l3_find(unsigned int l3protonum);
+void osmo_pcap_proto_l3_register(struct osmo_pcap_proto_l3 *h);
+
+struct osmo_pcap_proto_l4 *osmo_pcap_proto_l4_find(unsigned int l4protonum);
void osmo_pcap_proto_l4_register(struct osmo_pcap_proto_l4 *h);
/* Initialization of supported protocols here. */
-void l2l3_ipv4_init(void);
+void l2_sll_init(void);
+void l2_eth_init(void);
+void l3_ipv4_init(void);
void l4_tcp_init(void);
void l4_udp_init(void);