1411677aeSAaron LI /*
2411677aeSAaron LI * Copyright (c) 2013 The TCPDUMP project
3411677aeSAaron LI *
4411677aeSAaron LI * Redistribution and use in source and binary forms, with or without
5411677aeSAaron LI * modification, are permitted provided that: (1) source code
6411677aeSAaron LI * distributions retain the above copyright notice and this paragraph
7411677aeSAaron LI * in its entirety, and (2) distributions including binary code include
8411677aeSAaron LI * the above copyright notice and this paragraph in its entirety in
9411677aeSAaron LI * the documentation or other materials provided with the distribution.
10411677aeSAaron LI * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11411677aeSAaron LI * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12411677aeSAaron LI * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13411677aeSAaron LI * FOR A PARTICULAR PURPOSE.
14411677aeSAaron LI *
15411677aeSAaron LI * Original code by Ola Martin Lykkja (ola.lykkja@q-free.com)
16411677aeSAaron LI */
17411677aeSAaron LI
18411677aeSAaron LI /* \summary: Communication access for land mobiles (CALM) printer */
19411677aeSAaron LI
20411677aeSAaron LI #ifdef HAVE_CONFIG_H
21*ed775ee7SAntonio Huete Jimenez #include <config.h>
22411677aeSAaron LI #endif
23411677aeSAaron LI
24*ed775ee7SAntonio Huete Jimenez #include "netdissect-stdinc.h"
25411677aeSAaron LI
26*ed775ee7SAntonio Huete Jimenez #define ND_LONGJMP_FROM_TCHECK
27411677aeSAaron LI #include "netdissect.h"
28*ed775ee7SAntonio Huete Jimenez #include "extract.h"
29411677aeSAaron LI #include "addrtoname.h"
30411677aeSAaron LI
31411677aeSAaron LI /*
32411677aeSAaron LI ISO 29281:2009
33411677aeSAaron LI Intelligent Transport Systems . Communications access for land mobiles (CALM)
34411677aeSAaron LI CALM non-IP networking
35411677aeSAaron LI */
36411677aeSAaron LI
37411677aeSAaron LI /*
38411677aeSAaron LI * This is the top level routine of the printer. 'bp' points
39411677aeSAaron LI * to the calm header of the packet.
40411677aeSAaron LI */
41411677aeSAaron LI void
calm_fast_print(netdissect_options * ndo,const u_char * bp,u_int length,const struct lladdr_info * src)42411677aeSAaron LI calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
43411677aeSAaron LI {
44*ed775ee7SAntonio Huete Jimenez ndo->ndo_protocol = "calm_fast";
45411677aeSAaron LI
46*ed775ee7SAntonio Huete Jimenez ND_PRINT("CALM FAST");
47411677aeSAaron LI if (src != NULL)
48*ed775ee7SAntonio Huete Jimenez ND_PRINT(" src:%s", (src->addr_string)(ndo, src->addr));
49*ed775ee7SAntonio Huete Jimenez ND_PRINT("; ");
50*ed775ee7SAntonio Huete Jimenez
51*ed775ee7SAntonio Huete Jimenez if (length < 2) {
52*ed775ee7SAntonio Huete Jimenez ND_PRINT(" (length %u < 2)", length);
53*ed775ee7SAntonio Huete Jimenez goto invalid;
54*ed775ee7SAntonio Huete Jimenez }
55*ed775ee7SAntonio Huete Jimenez
56*ed775ee7SAntonio Huete Jimenez ND_PRINT("SrcNwref:%u; ", GET_U_1(bp));
57*ed775ee7SAntonio Huete Jimenez length -= 1;
58*ed775ee7SAntonio Huete Jimenez bp += 1;
59*ed775ee7SAntonio Huete Jimenez
60*ed775ee7SAntonio Huete Jimenez ND_PRINT("DstNwref:%u; ", GET_U_1(bp));
61*ed775ee7SAntonio Huete Jimenez length -= 1;
62*ed775ee7SAntonio Huete Jimenez bp += 1;
63411677aeSAaron LI
64411677aeSAaron LI if (ndo->ndo_vflag)
65411677aeSAaron LI ND_DEFAULTPRINT(bp, length);
66411677aeSAaron LI return;
67411677aeSAaron LI
68*ed775ee7SAntonio Huete Jimenez invalid:
69*ed775ee7SAntonio Huete Jimenez nd_print_invalid(ndo);
70*ed775ee7SAntonio Huete Jimenez ND_TCHECK_LEN(bp, length);
71411677aeSAaron LI }
72