2013-06-26 05:43:19 +08:00
|
|
|
/*
|
2013-06-27 19:28:10 +08:00
|
|
|
* Copyright (c) 2013 The TCPDUMP project
|
2013-06-26 05:43:19 +08:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
2013-06-27 19:28:10 +08:00
|
|
|
* modification, are permitted provided that: (1) source code
|
|
|
|
* distributions retain the above copyright notice and this paragraph
|
|
|
|
* in its entirety, and (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.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Original code by Ola Martin Lykkja (ola.lykkja@q-free.com)
|
2013-06-26 05:43:19 +08:00
|
|
|
*/
|
|
|
|
|
2016-08-15 21:27:28 +08:00
|
|
|
/* \summary: Communication access for land mobiles (CALM) printer */
|
|
|
|
|
2018-01-22 04:27:08 +08:00
|
|
|
#include <config.h>
|
2013-06-26 05:43:19 +08:00
|
|
|
|
2018-01-20 22:59:49 +08:00
|
|
|
#include "netdissect-stdinc.h"
|
2013-06-26 05:43:19 +08:00
|
|
|
|
2020-10-12 23:41:01 +08:00
|
|
|
#define ND_LONGJMP_FROM_TCHECK
|
2015-09-06 05:35:58 +08:00
|
|
|
#include "netdissect.h"
|
2017-11-25 05:48:55 +08:00
|
|
|
#include "extract.h"
|
2013-06-26 05:43:19 +08:00
|
|
|
#include "addrtoname.h"
|
|
|
|
|
2013-06-27 19:28:10 +08:00
|
|
|
/*
|
|
|
|
ISO 29281:2009
|
|
|
|
Intelligent Transport Systems . Communications access for land mobiles (CALM)
|
|
|
|
CALM non-IP networking
|
|
|
|
*/
|
2013-06-26 05:43:19 +08:00
|
|
|
|
|
|
|
/*
|
2013-06-27 19:28:10 +08:00
|
|
|
* This is the top level routine of the printer. 'bp' points
|
2013-06-26 05:43:19 +08:00
|
|
|
* to the calm header of the packet.
|
|
|
|
*/
|
|
|
|
void
|
2015-07-04 06:54:14 +08:00
|
|
|
calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
|
2013-06-26 05:43:19 +08:00
|
|
|
{
|
2018-03-14 23:54:17 +08:00
|
|
|
ndo->ndo_protocol = "calm_fast";
|
2013-06-26 05:43:19 +08:00
|
|
|
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT("CALM FAST");
|
2015-07-04 06:54:14 +08:00
|
|
|
if (src != NULL)
|
2018-01-07 18:47:30 +08:00
|
|
|
ND_PRINT(" src:%s", (src->addr_string)(ndo, src->addr));
|
|
|
|
ND_PRINT("; ");
|
2020-10-12 23:41:01 +08:00
|
|
|
|
|
|
|
if (length < 2) {
|
|
|
|
ND_PRINT(" (length %u < 2)", length);
|
|
|
|
goto invalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
ND_PRINT("SrcNwref:%u; ", GET_U_1(bp));
|
|
|
|
length -= 1;
|
|
|
|
bp += 1;
|
|
|
|
|
|
|
|
ND_PRINT("DstNwref:%u; ", GET_U_1(bp));
|
|
|
|
length -= 1;
|
|
|
|
bp += 1;
|
2013-06-26 05:43:19 +08:00
|
|
|
|
|
|
|
if (ndo->ndo_vflag)
|
2014-03-26 22:52:40 +08:00
|
|
|
ND_DEFAULTPRINT(bp, length);
|
2015-07-04 06:54:14 +08:00
|
|
|
return;
|
|
|
|
|
2020-10-12 23:41:01 +08:00
|
|
|
invalid:
|
|
|
|
nd_print_invalid(ndo);
|
|
|
|
ND_TCHECK_LEN(bp, length);
|
2013-06-26 05:43:19 +08:00
|
|
|
}
|