File: ospf2_5.c

package info (click to toggle)
libtrace3 3.0.14-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,492 kB
  • sloc: ansic: 21,584; sh: 10,236; cpp: 1,765; makefile: 454; yacc: 96; lex: 50
file content (28 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <arpa/inet.h>
#include "libpacketdump.h"

#include <assert.h>

DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len) {

	unsigned char *lsa_ptr = (unsigned char *)packet;
	uint32_t rem = len;
	uint16_t lsa_length = 0;
	uint8_t lsa_type;
	libtrace_ospf_lsa_v2_t *lsa_hdr;

	while (trace_get_next_ospf_lsa_header_v2(&lsa_ptr, &lsa_hdr, 
                       	&rem, &lsa_type, &lsa_length) > 0) {

		if (lsa_hdr) {
			decode_next((char *)lsa_hdr, lsa_length, "ospf2", 1000);
		}

		/* These packets contain LSA headers only so don't try to
		 * decode the body */
	}
}