print-calm-fast.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  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. /* \summary: Communication access for land mobiles (CALM) printer */
  18. #ifdef HAVE_CONFIG_H
  19. #include "config.h"
  20. #endif
  21. #include <netdissect-stdinc.h>
  22. #include "netdissect.h"
  23. #include "addrtoname.h"
  24. /*
  25. ISO 29281:2009
  26. Intelligent Transport Systems . Communications access for land mobiles (CALM)
  27. CALM non-IP networking
  28. */
  29. /*
  30. * This is the top level routine of the printer. 'bp' points
  31. * to the calm header of the packet.
  32. */
  33. void
  34. calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct lladdr_info *src)
  35. {
  36. int srcNwref;
  37. int dstNwref;
  38. ND_TCHECK2(*bp, 2);
  39. if (length < 2)
  40. goto trunc;
  41. srcNwref = bp[0];
  42. dstNwref = bp[1];
  43. length -= 2;
  44. bp += 2;
  45. ND_PRINT((ndo, "CALM FAST"));
  46. if (src != NULL)
  47. ND_PRINT((ndo, " src:%s", (src->addr_string)(ndo, src->addr)));
  48. ND_PRINT((ndo, "; "));
  49. ND_PRINT((ndo, "SrcNwref:%d; ", srcNwref));
  50. ND_PRINT((ndo, "DstNwref:%d; ", dstNwref));
  51. if (ndo->ndo_vflag)
  52. ND_DEFAULTPRINT(bp, length);
  53. return;
  54. trunc:
  55. ND_PRINT((ndo, "[|calm fast]"));
  56. return;
  57. }
  58. /*
  59. * Local Variables:
  60. * c-style: whitesmith
  61. * c-basic-offset: 8
  62. * End:
  63. */