1 2 /*-------------------------------------------------------------*/ 3 /* Name : netwib_device_init_kbd 4 Description : 5 Initialize a device by the keyboard 6 Input parameter(s) : 7 message : message to print before 8 defaultdevice : default device to use if user enters nothing 9 Input/output parameter(s) : 10 Output parameter(s) : 11 *pdevice : device set with user's string 12 Normal return values : 13 NETWIB_ERR_OK : ok 14 */ 15 netwib_err netwib_device_init_kbd(netwib_constbuf *pmessage, 16 netwib_constbuf *pdefaultdevice, 17 netwib_buf *pdevice); 18 #define NETWIB_DEVICE_INIT_KBD_NODEF NULL 19 20 /*-------------------------------------------------------------*/ 21 /* Hardware types */ 22 typedef enum { 23 NETWIB_DEVICE_HWTYPE_UNKNOWN = 1, 24 NETWIB_DEVICE_HWTYPE_ETHER, 25 NETWIB_DEVICE_HWTYPE_LOOPBACK, 26 NETWIB_DEVICE_HWTYPE_PPP, 27 NETWIB_DEVICE_HWTYPE_PLIP, 28 NETWIB_DEVICE_HWTYPE_SLIP 29 } netwib_device_hwtype; 30 31 /*-------------------------------------------------------------*/ 32 /* Name : netwib_buf_append_device_hwtype 33 Description : 34 Obtains the buf string corresponding to a hwtype. 35 Input parameter(s) : 36 type : type 37 Input/output parameter(s) : 38 Output parameter(s) : 39 *pbuf : netwib_buf set with the buf string 40 Normal return values : 41 NETWIB_ERR_OK : ok 42 */ 43 netwib_err netwib_buf_append_device_hwtype(netwib_device_hwtype type, 44 netwib_buf *pbuf); 45 46 /*-------------------------------------------------------------*/ 47 /* Name : netwib_device_hwtype_init_kbd 48 Description : 49 Initialize a netwib_device_hwtype with data entered 50 through keyboard. 51 Input parameter(s) : 52 *pmessage : message to print before 53 defaulthwtype : default hwtype to use if user enters 54 nothing (if NETWIB_DEVICE_HWTYPE_UNKNOWN, 55 means no default) 56 Input/output parameter(s) : 57 Output parameter(s) : 58 *phwtype : netwib_hwtype initialized 59 Normal return values : 60 NETWIB_ERR_OK : ok 61 */ 62 netwib_err netwib_device_hwtype_init_kbd(netwib_constbuf *pmessage, 63 netwib_device_hwtype defaulthwtype, 64 netwib_device_hwtype *phwtype); 65 #define NETWIB_DEVICE_HWTYPE_INIT_KBD_NODEF NETWIB_DEVICE_HWTYPE_UNKNOWN 66 67 /*-------------------------------------------------------------*/ 68 /*************************************************************** 69 * Sniffed data is represented as specified by the DLT * 70 * associated to packets. * 71 * Spoofed data (at link level) also has to be represented as * 72 * DLT expects. * 73 ***************************************************************/ 74 /* Data-link level type codes (names from net/bpf.h). */ 75 typedef enum { 76 NETWIB_DEVICE_DLTTYPE_UNKNOWN = 1, /* not listed below */ 77 NETWIB_DEVICE_DLTTYPE_NULL, /* no link-layer encapsulation */ 78 NETWIB_DEVICE_DLTTYPE_EN10MB, /* Ethernet (10Mb) */ 79 NETWIB_DEVICE_DLTTYPE_ETHER = NETWIB_DEVICE_DLTTYPE_EN10MB, 80 NETWIB_DEVICE_DLTTYPE_EN3MB, /* Experimental Ethernet (3Mb) */ 81 NETWIB_DEVICE_DLTTYPE_AX25, /* Amateur Radio AX.25 */ 82 NETWIB_DEVICE_DLTTYPE_PRONET, /* Proteon ProNET Token Ring */ 83 NETWIB_DEVICE_DLTTYPE_CHAOS, /* Chaos */ 84 NETWIB_DEVICE_DLTTYPE_IEEE802, /* IEEE 802 Networks */ 85 NETWIB_DEVICE_DLTTYPE_ARCNET, /* ARCNET */ 86 NETWIB_DEVICE_DLTTYPE_SLIP, /* Serial Line IP */ 87 NETWIB_DEVICE_DLTTYPE_PPP, /* Point-to-point Protocol */ 88 NETWIB_DEVICE_DLTTYPE_FDDI, /* FDDI */ 89 NETWIB_DEVICE_DLTTYPE_ATM_RFC1483, /* LLC/SNAP encapsulated atm */ 90 NETWIB_DEVICE_DLTTYPE_RAW, /* raw IPv4 or IPv6 */ 91 NETWIB_DEVICE_DLTTYPE_RAW4, /* raw IPv4 */ 92 NETWIB_DEVICE_DLTTYPE_RAW6, /* raw IPv6 */ 93 NETWIB_DEVICE_DLTTYPE_SLIP_BSDOS, /* BSD/OS Serial Line IP */ 94 NETWIB_DEVICE_DLTTYPE_PPP_BSDOS, /* BSD/OS Point-to-point Protocol */ 95 NETWIB_DEVICE_DLTTYPE_ATM_CLIP, /* Linux Classical-IP over ATM */ 96 NETWIB_DEVICE_DLTTYPE_PPP_SERIAL, /* PPP over serial with HDLC enc. */ 97 NETWIB_DEVICE_DLTTYPE_PPP_ETHER, /* PPP over Ethernet */ 98 NETWIB_DEVICE_DLTTYPE_C_HDLC, /* Cisco HDLC */ 99 NETWIB_DEVICE_DLTTYPE_IEEE802_11, /* IEEE 802.11 wireless */ 100 NETWIB_DEVICE_DLTTYPE_LOOP, 101 NETWIB_DEVICE_DLTTYPE_LINUX_SLL, 102 NETWIB_DEVICE_DLTTYPE_LTALK, 103 NETWIB_DEVICE_DLTTYPE_ECONET, 104 NETWIB_DEVICE_DLTTYPE_PRISM_HEADER, 105 NETWIB_DEVICE_DLTTYPE_AIRONET_HEADER, 106 NETWIB_DEVICE_DLTTYPE_USER_BEGIN = NETWIB_ENUM_USER_BEGIN 107 } netwib_device_dlttype; 108 109 /*-------------------------------------------------------------*/ 110 /* Name : netwib_buf_append_device_dlttype 111 Description : 112 Obtains the buf string corresponding to a hwtype. 113 Input parameter(s) : 114 type : type 115 Input/output parameter(s) : 116 Output parameter(s) : 117 *pbuf : netwib_buf set with the buf string 118 Normal return values : 119 NETWIB_ERR_OK : ok 120 */ 121 netwib_err netwib_buf_append_device_dlttype(netwib_device_dlttype type, 122 netwib_buf *pbuf); 123 124 /*-------------------------------------------------------------*/ 125 /* Name : netwib_device_dlttype_init_kbd 126 Description : 127 Initialize a netwib_device_dlttype with data entered 128 through keyboard. 129 Input parameter(s) : 130 *pmessage : message to print before 131 defaultdlttype : default dlttype to use if user enters 132 nothing (if NETWIB_DEVICE_DLTTYPE_UNKNOWN, 133 means no default) 134 Input/output parameter(s) : 135 Output parameter(s) : 136 *pdlttype : netwib_dlttype initialized 137 Normal return values : 138 NETWIB_ERR_OK : ok 139 */ 140 netwib_err netwib_device_dlttype_init_kbd(netwib_constbuf *pmessage, 141 netwib_device_dlttype defaultdlttype, 142 netwib_device_dlttype *pdlttype); 143 #define NETWIB_DEVICE_DLTTYPE_INIT_KBD_NODEF NETWIB_DEVICE_DLTTYPE_UNKNOWN 144