13c602fabSXin LI /* 23c602fabSXin LI * Copyright (c) 2013 The TCPDUMP project 33c602fabSXin LI * 43c602fabSXin LI * Redistribution and use in source and binary forms, with or without 53c602fabSXin LI * modification, are permitted provided that: (1) source code 63c602fabSXin LI * distributions retain the above copyright notice and this paragraph 73c602fabSXin LI * in its entirety, and (2) distributions including binary code include 83c602fabSXin LI * the above copyright notice and this paragraph in its entirety in 93c602fabSXin LI * the documentation or other materials provided with the distribution. 103c602fabSXin LI * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 113c602fabSXin LI * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 123c602fabSXin LI * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 133c602fabSXin LI * FOR A PARTICULAR PURPOSE. 143c602fabSXin LI * 153c602fabSXin LI * Original code by Ola Martin Lykkja (ola.lykkja@q-free.com) 163c602fabSXin LI */ 173c602fabSXin LI 183340d773SGleb Smirnoff /* \summary: Communication access for land mobiles (CALM) printer */ 193340d773SGleb Smirnoff 20*ee67461eSJoseph Mingrone #include <config.h> 213c602fabSXin LI 22*ee67461eSJoseph Mingrone #include "netdissect-stdinc.h" 233c602fabSXin LI 24*ee67461eSJoseph Mingrone #define ND_LONGJMP_FROM_TCHECK 253340d773SGleb Smirnoff #include "netdissect.h" 26*ee67461eSJoseph Mingrone #include "extract.h" 273c602fabSXin LI #include "addrtoname.h" 283c602fabSXin LI 293c602fabSXin LI /* 303c602fabSXin LI ISO 29281:2009 313c602fabSXin LI Intelligent Transport Systems . Communications access for land mobiles (CALM) 323c602fabSXin LI CALM non-IP networking 333c602fabSXin LI */ 343c602fabSXin LI 353c602fabSXin LI /* 363c602fabSXin LI * This is the top level routine of the printer. 'bp' points 373c602fabSXin LI * to the calm header of the packet. 383c602fabSXin LI */ 393c602fabSXin LI void 403340d773SGleb Smirnoff calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src) 413c602fabSXin LI { 42*ee67461eSJoseph Mingrone ndo->ndo_protocol = "calm_fast"; 433340d773SGleb Smirnoff 44*ee67461eSJoseph Mingrone ND_PRINT("CALM FAST"); 453340d773SGleb Smirnoff if (src != NULL) 46*ee67461eSJoseph Mingrone ND_PRINT(" src:%s", (src->addr_string)(ndo, src->addr)); 47*ee67461eSJoseph Mingrone ND_PRINT("; "); 48*ee67461eSJoseph Mingrone 49*ee67461eSJoseph Mingrone if (length < 2) { 50*ee67461eSJoseph Mingrone ND_PRINT(" (length %u < 2)", length); 51*ee67461eSJoseph Mingrone goto invalid; 52*ee67461eSJoseph Mingrone } 53*ee67461eSJoseph Mingrone 54*ee67461eSJoseph Mingrone ND_PRINT("SrcNwref:%u; ", GET_U_1(bp)); 55*ee67461eSJoseph Mingrone length -= 1; 56*ee67461eSJoseph Mingrone bp += 1; 57*ee67461eSJoseph Mingrone 58*ee67461eSJoseph Mingrone ND_PRINT("DstNwref:%u; ", GET_U_1(bp)); 59*ee67461eSJoseph Mingrone length -= 1; 60*ee67461eSJoseph Mingrone bp += 1; 613c602fabSXin LI 623c602fabSXin LI if (ndo->ndo_vflag) 633c602fabSXin LI ND_DEFAULTPRINT(bp, length); 643340d773SGleb Smirnoff return; 653340d773SGleb Smirnoff 66*ee67461eSJoseph Mingrone invalid: 67*ee67461eSJoseph Mingrone nd_print_invalid(ndo); 68*ee67461eSJoseph Mingrone ND_TCHECK_LEN(bp, length); 693c602fabSXin LI } 70