1026d7285Schristos /* 2026d7285Schristos * Copyright (c) 2013 The TCPDUMP project 3026d7285Schristos * 4026d7285Schristos * Redistribution and use in source and binary forms, with or without 5026d7285Schristos * modification, are permitted provided that: (1) source code 6026d7285Schristos * distributions retain the above copyright notice and this paragraph 7026d7285Schristos * in its entirety, and (2) distributions including binary code include 8026d7285Schristos * the above copyright notice and this paragraph in its entirety in 9026d7285Schristos * the documentation or other materials provided with the distribution. 10026d7285Schristos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 11026d7285Schristos * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 12026d7285Schristos * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13026d7285Schristos * FOR A PARTICULAR PURPOSE. 14026d7285Schristos * 15026d7285Schristos * Original code by Ola Martin Lykkja (ola.lykkja@q-free.com) 16026d7285Schristos */ 17026d7285Schristos 18fdccd7e4Schristos #include <sys/cdefs.h> 19fdccd7e4Schristos #ifndef lint 20*26ba0b50Schristos __RCSID("$NetBSD: print-calm-fast.c,v 1.5 2024/09/02 16:15:30 christos Exp $"); 21fdccd7e4Schristos #endif 22fdccd7e4Schristos 23dc860a36Sspz /* \summary: Communication access for land mobiles (CALM) printer */ 24dc860a36Sspz 25c74ad251Schristos #include <config.h> 26026d7285Schristos 27c74ad251Schristos #include "netdissect-stdinc.h" 28026d7285Schristos 29c74ad251Schristos #define ND_LONGJMP_FROM_TCHECK 30784088dfSchristos #include "netdissect.h" 31c74ad251Schristos #include "extract.h" 32026d7285Schristos #include "addrtoname.h" 33026d7285Schristos 34026d7285Schristos /* 35026d7285Schristos ISO 29281:2009 36026d7285Schristos Intelligent Transport Systems . Communications access for land mobiles (CALM) 37026d7285Schristos CALM non-IP networking 38026d7285Schristos */ 39026d7285Schristos 40026d7285Schristos /* 41026d7285Schristos * This is the top level routine of the printer. 'bp' points 42026d7285Schristos * to the calm header of the packet. 43026d7285Schristos */ 44026d7285Schristos void 45dc860a36Sspz calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src) 46026d7285Schristos { 47c74ad251Schristos ndo->ndo_protocol = "calm_fast"; 48dc860a36Sspz 49c74ad251Schristos ND_PRINT("CALM FAST"); 50dc860a36Sspz if (src != NULL) 51c74ad251Schristos ND_PRINT(" src:%s", (src->addr_string)(ndo, src->addr)); 52c74ad251Schristos ND_PRINT("; "); 53c74ad251Schristos 54c74ad251Schristos if (length < 2) { 55c74ad251Schristos ND_PRINT(" (length %u < 2)", length); 56c74ad251Schristos goto invalid; 57c74ad251Schristos } 58c74ad251Schristos 59c74ad251Schristos ND_PRINT("SrcNwref:%u; ", GET_U_1(bp)); 60c74ad251Schristos length -= 1; 61c74ad251Schristos bp += 1; 62c74ad251Schristos 63c74ad251Schristos ND_PRINT("DstNwref:%u; ", GET_U_1(bp)); 64c74ad251Schristos length -= 1; 65c74ad251Schristos bp += 1; 66026d7285Schristos 67026d7285Schristos if (ndo->ndo_vflag) 68c47fd378Schristos ND_DEFAULTPRINT(bp, length); 69dc860a36Sspz return; 70dc860a36Sspz 71c74ad251Schristos invalid: 72c74ad251Schristos nd_print_invalid(ndo); 73c74ad251Schristos ND_TCHECK_LEN(bp, length); 74026d7285Schristos } 75