1 /* $NetBSD: ipkdb.h,v 1.6 2009/03/14 14:46:09 dsl Exp $ */ 2 3 /* 4 * Copyright (C) 1993-2000 Wolfgang Solfrank. 5 * Copyright (C) 1993-2000 TooLs GmbH. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by TooLs GmbH. 19 * 4. The name of TooLs GmbH may not be used to endorse or promote products 20 * derived from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 #ifndef _IPKDB_H 34 #define _IPKDB_H 35 36 extern int ipkdbpanic; 37 38 #define IPKDBPORT 1138 /* debugging port */ 39 40 struct ipkdb_if { 41 /* These fields are used by IPKDB itself: */ 42 u_int8_t myenetaddr[6]; /* to be filled by the driver */ 43 u_int8_t myinetaddr[4]; 44 u_int8_t hisenetaddr[6]; 45 u_int8_t hisinetaddr[4]; 46 u_int16_t hisport; 47 u_char pkt[1500]; 48 int pktlen; 49 u_int32_t seq; 50 u_int32_t id; 51 int mtu; 52 u_char ass[1500]; 53 u_int8_t assbit[1500/8/8 + 1]; 54 u_int16_t asslen; 55 u_int8_t flags; /* driver marks IPKDB_MYHW here */ 56 /* Data from here on is to be filled by the driver */ 57 const char *name; 58 void *port; 59 void (*start)(struct ipkdb_if *); 60 void (*leave)(struct ipkdb_if *); 61 int (*receive)(struct ipkdb_if *, u_char *, int); 62 void (*send)(struct ipkdb_if *, u_char *, int); 63 }; 64 65 /* flags: */ 66 #define IPKDB_MYHW 0x01 67 #define IPKDB_MYIP 0x02 68 #define IPKDB_HISHW 0x04 69 #define IPKDB_HISIP 0x08 70 #define IPKDB_CONNECTED 0x10 71 72 /* 73 * Interface routines, to be called by machine dependent code. 74 */ 75 extern void ipkdb_init(void); 76 extern void ipkdb_connect(int); 77 extern void ipkdb_panic(void); 78 extern int ipkdbcmds(void); 79 /* Return values from ipkdbcmds: */ 80 #define IPKDB_CMD_RUN 0 81 #define IPKDB_CMD_STEP 1 82 #define IPKDB_CMD_EXIT 2 83 84 /* To be called by udp_input on receipt of a possible debugging packet */ 85 struct in_addr; 86 struct mbuf; 87 extern int checkipkdb(struct in_addr *, u_short, u_short, 88 struct mbuf *, int, int); 89 90 /* 91 * Interface routines, to be called by ipkdb itself. 92 */ 93 extern int ipkdbifinit(struct ipkdb_if *); 94 95 /* 96 * Utilities (used to avoid calling system routines during debugging). 97 */ 98 extern void ipkdbcopy(const void *, void *, int); 99 extern void ipkdbzero(void *, int); 100 extern int ipkdbcmp(void *, void *, int); 101 102 /* 103 * Machine dependent routines for IPKDB. 104 */ 105 extern void ipkdbinit(void); 106 extern void ipkdb_trap(void); 107 extern int ipkdb_poll(void); 108 109 extern int ipkdbif_init(struct ipkdb_if *); 110 111 extern int ipkdbfbyte(u_char *); 112 extern int ipkdbsbyte(u_char *, int); 113 114 #endif /* _IPKDB_H */ 115