print-ah.c revision 190207
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 2456893Sfenner#ifndef lint 25127668Sbmsstatic const char rcsid[] _U_ = 26190207Srpaulo "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.22 2003-11-19 00:36:06 guy Exp $ (LBL)"; 2756893Sfenner#endif 2856893Sfenner 2956893Sfenner#ifdef HAVE_CONFIG_H 3056893Sfenner#include "config.h" 3156893Sfenner#endif 3256893Sfenner 33127668Sbms#include <tcpdump-stdinc.h> 3456893Sfenner 3556893Sfenner#include <stdio.h> 3656893Sfenner 3775115Sfenner#include "ah.h" 3856893Sfenner 3956893Sfenner#include "interface.h" 4056893Sfenner#include "addrtoname.h" 41127668Sbms#include "extract.h" 4256893Sfenner 4356893Sfennerint 44127668Sbmsah_print(register const u_char *bp) 4556893Sfenner{ 4656893Sfenner register const struct ah *ah; 4756893Sfenner register const u_char *ep; 4856893Sfenner int sumlen; 4956893Sfenner u_int32_t spi; 5056893Sfenner 5198524Sfenner ah = (const struct ah *)bp; 5275115Sfenner ep = snapend; /* 'ep' points to the end of available data. */ 5356893Sfenner 5498524Sfenner TCHECK(*ah); 5556893Sfenner 5656893Sfenner sumlen = ah->ah_len << 2; 57127668Sbms spi = EXTRACT_32BITS(&ah->ah_spi); 5856893Sfenner 5975115Sfenner printf("AH(spi=0x%08x", spi); 6056893Sfenner if (vflag) 6156893Sfenner printf(",sumlen=%d", sumlen); 62127668Sbms printf(",seq=0x%x", EXTRACT_32BITS(ah + 1)); 6356893Sfenner if (bp + sizeof(struct ah) + sumlen > ep) 6456893Sfenner fputs("[truncated]", stdout); 6556893Sfenner fputs("): ", stdout); 66127668Sbms 6756893Sfenner return sizeof(struct ah) + sumlen; 6856893Sfenner trunc: 6956893Sfenner fputs("[|AH]", stdout); 70127668Sbms return -1; 7156893Sfenner} 72