diff options
author | Ola Martin Lykkja <ola.lykkja@q-free.com> | 2013-06-25 23:43:19 +0200 |
---|---|---|
committer | Ola Martin Lykkja <ola.lykkja@q-free.com> | 2013-06-25 23:43:19 +0200 |
commit | 80d038a7b1c20d0dea3abf58b2aabf33df4bf5ac (patch) | |
tree | 7fd36fd79560a870a1d6f77695c2b2e4e89e5910 /print-calm-fast.c | |
parent | 49a0a0d6da051df8a3cd4dfadad5dad82f3c65a5 (diff) | |
download | tcpdump-80d038a7b1c20d0dea3abf58b2aabf33df4bf5ac.tar.gz |
Adding support for ISO CALM FAST and ETSI GeoNetworking
Diffstat (limited to 'print-calm-fast.c')
-rw-r--r-- | print-calm-fast.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/print-calm-fast.c b/print-calm-fast.c new file mode 100644 index 00000000..bd88bd81 --- /dev/null +++ b/print-calm-fast.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2013 + * lykkja@hotmail.com All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by Paolo Abeni.'' + * The name of author may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tcpdump-stdinc.h> + +#include <pcap.h> +#include <stdio.h> +#include <string.h> + +#include "interface.h" +#include "extract.h" +#include "addrtoname.h" + + +static const char * +hex48_to_string(const u_char *bp) +{ + int i; + static char sz[6*3+2]; + memset(sz, 0, sizeof(sz)); + for (i=0; i<6; i++) { + if (i) strcat(sz,":"); + sprintf(sz+strlen(sz), "%02x", bp[i]); + } + return sz; +} + +/* + * This is the top level routine of the printer. 'p' points + * to the calm header of the packet. + */ +void +calm_fast_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int length) +{ + printf("CALM FAST src:%s; ", hex48_to_string(eth+6)); + + length -= 0; + bp += 0; + + if (ndo->ndo_vflag) + default_print(bp, length); +} + + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */ |