]> The Tcpdump Group git mirrors - tcpdump/blob - print-calm-fast.c
Use quoted include netdissect-stdinc.h instead of angle-bracketed one
[tcpdump] / print-calm-fast.c
1 /*
2 * Copyright (c) 2013 The TCPDUMP project
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
15 * Original code by Ola Martin Lykkja (ola.lykkja@q-free.com)
16 */
17
18 /* \summary: Communication access for land mobiles (CALM) printer */
19
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23
24 #include "netdissect-stdinc.h"
25
26 #include "netdissect.h"
27 #include "extract.h"
28 #include "addrtoname.h"
29
30 /*
31 ISO 29281:2009
32 Intelligent Transport Systems . Communications access for land mobiles (CALM)
33 CALM non-IP networking
34 */
35
36 /*
37 * This is the top level routine of the printer. 'bp' points
38 * to the calm header of the packet.
39 */
40 void
41 calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
42 {
43 u_int srcNwref;
44 u_int dstNwref;
45
46 ND_TCHECK_2(bp);
47 if (length < 2)
48 goto trunc;
49 srcNwref = EXTRACT_U_1(bp);
50 dstNwref = EXTRACT_U_1(bp + 1);
51 length -= 2;
52 bp += 2;
53
54 ND_PRINT("CALM FAST");
55 if (src != NULL)
56 ND_PRINT(" src:%s", (src->addr_string)(ndo, src->addr));
57 ND_PRINT("; ");
58 ND_PRINT("SrcNwref:%u; ", srcNwref);
59 ND_PRINT("DstNwref:%u; ", dstNwref);
60
61 if (ndo->ndo_vflag)
62 ND_DEFAULTPRINT(bp, length);
63 return;
64
65 trunc:
66 ND_PRINT("[|calm fast]");
67 return;
68 }
69
70
71 /*
72 * Local Variables:
73 * c-style: whitesmith
74 * c-basic-offset: 8
75 * End:
76 */