156893Sfenner/* $NetBSD: print-ah.c,v 1.4 1996/05/20 00:41:16 fvdl Exp $ */ 256893Sfenner 356893Sfenner/* 456893Sfenner * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 556893Sfenner * The Regents of the University of California. All rights reserved. 656893Sfenner * 756893Sfenner * Redistribution and use in source and binary forms, with or without 856893Sfenner * modification, are permitted provided that: (1) source code distributions 956893Sfenner * retain the above copyright notice and this paragraph in its entirety, (2) 1056893Sfenner * distributions including binary code include the above copyright notice and 1156893Sfenner * this paragraph in its entirety in the documentation or other materials 1256893Sfenner * provided with the distribution, and (3) all advertising materials mentioning 1356893Sfenner * features or use of this software display the following acknowledgement: 1456893Sfenner * ``This product includes software developed by the University of California, 1556893Sfenner * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 1656893Sfenner * the University nor the names of its contributors may be used to endorse 1756893Sfenner * or promote products derived from this software without specific prior 1856893Sfenner * written permission. 1956893Sfenner * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 2056893Sfenner * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 2156893Sfenner * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 2256893Sfenner */ 2356893Sfenner 24313537Sglebius/* \summary: IPSEC Authentication Header printer */ 25313537Sglebius 2656893Sfenner#ifdef HAVE_CONFIG_H 2756893Sfenner#include "config.h" 2856893Sfenner#endif 2956893Sfenner 30313537Sglebius#include <netdissect-stdinc.h> 3156893Sfenner 3275115Sfenner#include "ah.h" 3356893Sfenner 34313537Sglebius#include "netdissect.h" 35127668Sbms#include "extract.h" 3656893Sfenner 3756893Sfennerint 38276788Sdelphijah_print(netdissect_options *ndo, register const u_char *bp) 3956893Sfenner{ 4056893Sfenner register const struct ah *ah; 4156893Sfenner int sumlen; 4256893Sfenner 4398524Sfenner ah = (const struct ah *)bp; 4456893Sfenner 45276788Sdelphij ND_TCHECK(*ah); 4656893Sfenner 4756893Sfenner sumlen = ah->ah_len << 2; 4856893Sfenner 49313537Sglebius ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_32BITS(&ah->ah_spi))); 50276788Sdelphij if (ndo->ndo_vflag) 51276788Sdelphij ND_PRINT((ndo, ",sumlen=%d", sumlen)); 52313537Sglebius ND_TCHECK_32BITS(ah + 1); 53276788Sdelphij ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1))); 54313537Sglebius if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) { 55313537Sglebius ND_PRINT((ndo, "[truncated]):")); 56313537Sglebius return -1; 57313537Sglebius } 58276788Sdelphij ND_PRINT((ndo, "): ")); 59127668Sbms 6056893Sfenner return sizeof(struct ah) + sumlen; 6156893Sfenner trunc: 62276788Sdelphij ND_PRINT((ndo, "[|AH]")); 63127668Sbms return -1; 6456893Sfenner} 65