4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 756b8f9 was
e224862,
checked in by Shane Alcock <salcock@…>, 10 years ago
|
- Added libpacketdump decoders for a large portion of OSPF v2
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[e224862] | 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 | DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len) { |
---|
| 9 | unsigned char *link_ptr = NULL; |
---|
| 10 | libtrace_ospf_link_v2_t *link; |
---|
| 11 | uint32_t link_len; |
---|
| 12 | libtrace_ospf_router_lsa_v2_t *hdr; |
---|
| 13 | |
---|
| 14 | int i = 0; |
---|
| 15 | |
---|
| 16 | hdr = (libtrace_ospf_router_lsa_v2_t *)packet; |
---|
| 17 | |
---|
| 18 | if (len < 4) |
---|
| 19 | return; |
---|
| 20 | |
---|
| 21 | printf(" OSPF Router LSA: Links %u ", ntohs(hdr->num_links)); |
---|
| 22 | if (hdr->v) |
---|
| 23 | printf("V "); |
---|
| 24 | if (hdr->e) |
---|
| 25 | printf("E "); |
---|
| 26 | if (hdr->b) |
---|
| 27 | printf("B "); |
---|
| 28 | printf("\n"); |
---|
| 29 | |
---|
| 30 | link_ptr = trace_get_first_ospf_link_from_router_lsa_v2(hdr, &len); |
---|
| 31 | |
---|
| 32 | if (!link_ptr || len == 0) |
---|
| 33 | return; |
---|
| 34 | while (trace_get_next_ospf_link_v2(&link_ptr, &link, &len, &link_len) > 0) { |
---|
| 35 | printf(" OSPF Router Link: Id %s ", inet_ntoa(link->link_id)); |
---|
| 36 | printf("Data %s\n", inet_ntoa(link->link_data)); |
---|
| 37 | printf(" OSPF Router Link: Type %u TOS %u Metric %u\n", |
---|
| 38 | link->type, link->num_tos, |
---|
| 39 | ntohs(link->tos_metric)); |
---|
| 40 | i++; |
---|
| 41 | if (i == ntohs(hdr->num_links)) |
---|
| 42 | break; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
Note: See
TracBrowser
for help on using the repository browser.