1b0453382SBill Fenner /* $NetBSD: print-ah.c,v 1.4 1996/05/20 00:41:16 fvdl Exp $ */ 2b0453382SBill Fenner 3b0453382SBill Fenner /* 4b0453382SBill Fenner * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 5b0453382SBill Fenner * The Regents of the University of California. All rights reserved. 6b0453382SBill Fenner * 7b0453382SBill Fenner * Redistribution and use in source and binary forms, with or without 8b0453382SBill Fenner * modification, are permitted provided that: (1) source code distributions 9b0453382SBill Fenner * retain the above copyright notice and this paragraph in its entirety, (2) 10b0453382SBill Fenner * distributions including binary code include the above copyright notice and 11b0453382SBill Fenner * this paragraph in its entirety in the documentation or other materials 12b0453382SBill Fenner * provided with the distribution, and (3) all advertising materials mentioning 13b0453382SBill Fenner * features or use of this software display the following acknowledgement: 14b0453382SBill Fenner * ``This product includes software developed by the University of California, 15b0453382SBill Fenner * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 16b0453382SBill Fenner * the University nor the names of its contributors may be used to endorse 17b0453382SBill Fenner * or promote products derived from this software without specific prior 18b0453382SBill Fenner * written permission. 19b0453382SBill Fenner * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 20b0453382SBill Fenner * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 21b0453382SBill Fenner * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22b0453382SBill Fenner */ 23b0453382SBill Fenner 24*3c602fabSXin LI #define NETDISSECT_REWORKED 25b0453382SBill Fenner #ifdef HAVE_CONFIG_H 26b0453382SBill Fenner #include "config.h" 27b0453382SBill Fenner #endif 28b0453382SBill Fenner 295b0fe478SBruce M Simpson #include <tcpdump-stdinc.h> 30b0453382SBill Fenner 31685295f4SBill Fenner #include "ah.h" 32b0453382SBill Fenner 33b0453382SBill Fenner #include "interface.h" 345b0fe478SBruce M Simpson #include "extract.h" 35b0453382SBill Fenner 36b0453382SBill Fenner int 37*3c602fabSXin LI ah_print(netdissect_options *ndo, register const u_char *bp) 38b0453382SBill Fenner { 39b0453382SBill Fenner register const struct ah *ah; 40b0453382SBill Fenner register const u_char *ep; 41b0453382SBill Fenner int sumlen; 42*3c602fabSXin LI uint32_t spi; 43b0453382SBill Fenner 44a90e161bSBill Fenner ah = (const struct ah *)bp; 45*3c602fabSXin LI ep = ndo->ndo_snapend; /* 'ep' points to the end of available data. */ 46b0453382SBill Fenner 47*3c602fabSXin LI ND_TCHECK(*ah); 48b0453382SBill Fenner 49b0453382SBill Fenner sumlen = ah->ah_len << 2; 505b0fe478SBruce M Simpson spi = EXTRACT_32BITS(&ah->ah_spi); 51b0453382SBill Fenner 52*3c602fabSXin LI ND_PRINT((ndo, "AH(spi=0x%08x", spi)); 53*3c602fabSXin LI if (ndo->ndo_vflag) 54*3c602fabSXin LI ND_PRINT((ndo, ",sumlen=%d", sumlen)); 55*3c602fabSXin LI ND_PRINT((ndo, ",seq=0x%x", EXTRACT_32BITS(ah + 1))); 56b0453382SBill Fenner if (bp + sizeof(struct ah) + sumlen > ep) 57*3c602fabSXin LI ND_PRINT((ndo, "[truncated]")); 58*3c602fabSXin LI ND_PRINT((ndo, "): ")); 59b0453382SBill Fenner 60b0453382SBill Fenner return sizeof(struct ah) + sumlen; 61b0453382SBill Fenner trunc: 62*3c602fabSXin LI ND_PRINT((ndo, "[|AH]")); 635b0fe478SBruce M Simpson return -1; 64b0453382SBill Fenner } 65