4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since e224862 was
e224862,
checked in by Shane Alcock <salcock@…>, 11 years ago
|
- Added libpacketdump decoders for a large portion of OSPF v2
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include <sys/types.h> |
---|
2 | #include <sys/socket.h> |
---|
3 | #include <netinet/in.h> |
---|
4 | #include <stdio.h> |
---|
5 | #include <arpa/inet.h> |
---|
6 | #include "libpacketdump.h" |
---|
7 | |
---|
8 | |
---|
9 | DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len) { |
---|
10 | libtrace_ospf_ls_update_t *update = (libtrace_ospf_ls_update_t *)packet; |
---|
11 | unsigned char *lsa_ptr; |
---|
12 | uint8_t lsa_type; |
---|
13 | libtrace_ospf_lsa_v2_t *lsa_hdr; |
---|
14 | unsigned char *lsa_body; |
---|
15 | int i = 0; |
---|
16 | int max_lsas = 0; |
---|
17 | uint32_t rem = len; |
---|
18 | uint16_t lsa_length; |
---|
19 | |
---|
20 | |
---|
21 | if (len < 4) |
---|
22 | return; |
---|
23 | max_lsas = ntohl(update->ls_num_adv); |
---|
24 | printf(" OSPF LS Update: LSAs %u\n", max_lsas); |
---|
25 | |
---|
26 | |
---|
27 | lsa_ptr = trace_get_first_ospf_lsa_from_update_v2(update, &rem); |
---|
28 | |
---|
29 | if (lsa_ptr == NULL || rem == 0) |
---|
30 | return; |
---|
31 | |
---|
32 | while (trace_get_next_ospf_lsa_v2(&lsa_ptr, &lsa_hdr, &lsa_body, |
---|
33 | &rem, &lsa_type, &lsa_length) > 0) { |
---|
34 | |
---|
35 | i ++; |
---|
36 | if (lsa_hdr) { |
---|
37 | |
---|
38 | decode_next((char *)lsa_hdr, lsa_length, "ospf2", 1000); |
---|
39 | } |
---|
40 | |
---|
41 | if (lsa_body) { |
---|
42 | decode_next((char *)lsa_body, lsa_length - |
---|
43 | sizeof(libtrace_ospf_lsa_v2_t), |
---|
44 | "ospf2", |
---|
45 | 1000 + lsa_type); |
---|
46 | } |
---|
47 | |
---|
48 | if (i == max_lsas) |
---|
49 | break; |
---|
50 | |
---|
51 | |
---|
52 | } |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.