blob: c9be008cc29fc497ac41db6e5959a538d230c967 [file] [log] [blame]
JP Abgrall53f17a92014-02-12 14:02:41 -08001/*
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
Elliott Hughese2e3bd12017-05-15 10:59:29 -070018/* \summary: Communication access for land mobiles (CALM) printer */
19
JP Abgrall53f17a92014-02-12 14:02:41 -080020#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
Elliott Hughese2e3bd12017-05-15 10:59:29 -070024#include <netdissect-stdinc.h>
JP Abgrall53f17a92014-02-12 14:02:41 -080025
Elliott Hughese2e3bd12017-05-15 10:59:29 -070026#include "netdissect.h"
JP Abgrall53f17a92014-02-12 14:02:41 -080027#include "addrtoname.h"
28
29/*
30 ISO 29281:2009
31 Intelligent Transport Systems . Communications access for land mobiles (CALM)
32 CALM non-IP networking
33*/
34
35/*
36 * This is the top level routine of the printer. 'bp' points
37 * to the calm header of the packet.
38 */
39void
Elliott Hughese2e3bd12017-05-15 10:59:29 -070040calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
JP Abgrall53f17a92014-02-12 14:02:41 -080041{
Elliott Hughese2e3bd12017-05-15 10:59:29 -070042 int srcNwref;
43 int dstNwref;
44
45 ND_TCHECK2(*bp, 2);
46 if (length < 2)
47 goto trunc;
48 srcNwref = bp[0];
49 dstNwref = bp[1];
JP Abgrall53f17a92014-02-12 14:02:41 -080050 length -= 2;
51 bp += 2;
52
Elliott Hughese2e3bd12017-05-15 10:59:29 -070053 ND_PRINT((ndo, "CALM FAST"));
54 if (src != NULL)
55 ND_PRINT((ndo, " src:%s", (src->addr_string)(ndo, src->addr)));
56 ND_PRINT((ndo, "; "));
Elliott Hughes892a68b2015-10-19 14:43:53 -070057 ND_PRINT((ndo, "SrcNwref:%d; ", srcNwref));
58 ND_PRINT((ndo, "DstNwref:%d; ", dstNwref));
JP Abgrall53f17a92014-02-12 14:02:41 -080059
60 if (ndo->ndo_vflag)
Elliott Hughes892a68b2015-10-19 14:43:53 -070061 ND_DEFAULTPRINT(bp, length);
Elliott Hughese2e3bd12017-05-15 10:59:29 -070062 return;
63
64trunc:
65 ND_PRINT((ndo, "[|calm fast]"));
66 return;
JP Abgrall53f17a92014-02-12 14:02:41 -080067}
68
69
70/*
71 * Local Variables:
72 * c-style: whitesmith
73 * c-basic-offset: 8
74 * End:
75 */