source: libpacketdump/ospf2_1002.c @ 756b8f9

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@…>, 9 years ago
  • Added libpacketdump decoders for a large portion of OSPF v2
  • Property mode set to 100644
File size: 732 bytes
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
8DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len) {
9        libtrace_ospf_network_lsa_v2_t *net;
10        struct in_addr *router = NULL;
11
12        net = (libtrace_ospf_network_lsa_v2_t *)packet;
13
14        if (len < 4)
15                return;
16        printf(" OSPF Network LSA: Netmask %s\n", inet_ntoa(net->netmask));
17
18        router = (struct in_addr *)(packet + sizeof(libtrace_ospf_network_lsa_v2_t));
19        len -= sizeof(libtrace_ospf_network_lsa_v2_t);
20
21        while (len >= sizeof(struct in_addr)) {
22
23                printf("OSPF Network LSA: Attached Router %s\n", 
24                                inet_ntoa(*router));
25                router ++;
26                len -= sizeof(struct in_addr);
27        }
28}
Note: See TracBrowser for help on using the repository browser.