clean up imported ipx dump parser warnings
This commit is contained in:
@@ -55,29 +55,31 @@
|
||||
#include <signal.h>
|
||||
#include "ipxutil.h"
|
||||
|
||||
#include "nls.h"
|
||||
|
||||
struct ipx_address
|
||||
{
|
||||
IPXNet net __attribute__((packed));
|
||||
IPXNode node __attribute__((packed));
|
||||
IPXPort sock __attribute__((packed));
|
||||
};
|
||||
IPXNet net;
|
||||
IPXNode node;
|
||||
IPXPort sock;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct ipx_packet
|
||||
{
|
||||
unsigned short ipx_checksum __attribute__((packed));
|
||||
unsigned short ipx_checksum;
|
||||
#define IPX_NO_CHECKSUM 0xFFFF
|
||||
unsigned short ipx_pktsize __attribute__((packed));
|
||||
unsigned char ipx_tctrl __attribute__((packed));
|
||||
unsigned char ipx_type __attribute__((packed));
|
||||
unsigned short ipx_pktsize;
|
||||
unsigned char ipx_tctrl;
|
||||
unsigned char ipx_type;
|
||||
#define IPX_TYPE_UNKNOWN 0x00
|
||||
#define IPX_TYPE_RIP 0x01 /* may also be 0 */
|
||||
#define IPX_TYPE_SAP 0x04 /* may also be 0 */
|
||||
#define IPX_TYPE_SPX 0x05 /* Not yet implemented */
|
||||
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
|
||||
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast [Not supported] */
|
||||
struct ipx_address ipx_dest __attribute__((packed));
|
||||
struct ipx_address ipx_source __attribute__((packed));
|
||||
};
|
||||
struct ipx_address ipx_dest;
|
||||
struct ipx_address ipx_source;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
void handle_frame(unsigned char *buf, int length, struct sockaddr *saddr);
|
||||
@@ -108,7 +110,7 @@ main(int argc, char *argv[])
|
||||
struct ifreq ifr, oldifr;
|
||||
const char *device = "eth0";
|
||||
struct sockaddr saddr;
|
||||
int sizeaddr;
|
||||
socklen_t sizeaddr;
|
||||
unsigned char buf[4096];
|
||||
int length;
|
||||
int opt;
|
||||
@@ -257,6 +259,9 @@ handle_ipx(const char *frame, unsigned char *buf)
|
||||
void
|
||||
handle_other(unsigned char *buf, int length, struct sockaddr *saddr)
|
||||
{
|
||||
(void)length;
|
||||
(void)saddr;
|
||||
|
||||
struct ethhdr *eth = (struct ethhdr *) buf;
|
||||
unsigned char *p = &(buf[sizeof(struct ethhdr)]);
|
||||
|
||||
|
||||
153
tools/ipxparse.c
153
tools/ipxparse.c
@@ -53,30 +53,32 @@
|
||||
#include <ctype.h>
|
||||
#include "ipxutil.h"
|
||||
|
||||
#include "nls.h"
|
||||
|
||||
#define DUMPALLSAPS /* #define if you want to dump all SAP's */
|
||||
|
||||
struct ipx_address
|
||||
{
|
||||
IPXNet net __attribute__((packed));
|
||||
IPXNode node __attribute__((packed));
|
||||
IPXPort sock __attribute__((packed));
|
||||
IPXNet net;
|
||||
IPXNode node;
|
||||
IPXPort sock;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct ipx_packet
|
||||
{
|
||||
unsigned short ipx_checksum __attribute__((packed));
|
||||
unsigned short ipx_checksum;
|
||||
#define IPX_NO_CHECKSUM 0xFFFF
|
||||
unsigned short ipx_pktsize __attribute__((packed));
|
||||
unsigned char ipx_tctrl __attribute__((packed));
|
||||
unsigned char ipx_type __attribute__((packed));
|
||||
unsigned short ipx_pktsize;
|
||||
unsigned char ipx_tctrl ;
|
||||
unsigned char ipx_type ;
|
||||
#define IPX_TYPE_UNKNOWN 0x00
|
||||
#define IPX_TYPE_RIP 0x01 /* may also be 0 */
|
||||
#define IPX_TYPE_SAP 0x04 /* may also be 0 */
|
||||
#define IPX_TYPE_SPX 0x05 /* Not yet implemented */
|
||||
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
|
||||
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast [Not supported] */
|
||||
struct ipx_address ipx_dest __attribute__((packed));
|
||||
struct ipx_address ipx_source __attribute__((packed));
|
||||
struct ipx_address ipx_dest;
|
||||
struct ipx_address ipx_source;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define NCP_ALLOC_SLOT_REQUEST (0x1111)
|
||||
@@ -85,13 +87,13 @@ struct ipx_packet
|
||||
|
||||
struct ncp_request_header
|
||||
{
|
||||
u_int16_t type __attribute__((packed));
|
||||
u_int8_t sequence __attribute__((packed));
|
||||
u_int8_t conn_low __attribute__((packed));
|
||||
u_int8_t task __attribute__((packed));
|
||||
u_int8_t conn_high __attribute__((packed));
|
||||
u_int8_t function __attribute__((packed));
|
||||
u_int8_t data[0] __attribute__((packed));
|
||||
u_int16_t type;
|
||||
u_int8_t sequence;
|
||||
u_int8_t conn_low;
|
||||
u_int8_t task;
|
||||
u_int8_t conn_high;
|
||||
u_int8_t function;
|
||||
u_int8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define NCP_REPLY (0x3333)
|
||||
@@ -99,33 +101,33 @@ struct ncp_request_header
|
||||
|
||||
struct ncp_reply_header
|
||||
{
|
||||
u_int16_t type __attribute__((packed));
|
||||
u_int8_t sequence __attribute__((packed));
|
||||
u_int8_t conn_low __attribute__((packed));
|
||||
u_int8_t task __attribute__((packed));
|
||||
u_int8_t conn_high __attribute__((packed));
|
||||
u_int8_t completion_code __attribute__((packed));
|
||||
u_int8_t connection_state __attribute__((packed));
|
||||
u_int8_t data[0] __attribute__((packed));
|
||||
u_int16_t type;
|
||||
u_int8_t sequence;
|
||||
u_int8_t conn_low;
|
||||
u_int8_t task;
|
||||
u_int8_t conn_high;
|
||||
u_int8_t completion_code;
|
||||
u_int8_t connection_state;
|
||||
u_int8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define NCP_BURST_PACKET (0x7777)
|
||||
|
||||
struct ncp_burst_header
|
||||
{
|
||||
u_int16_t type __attribute__((packed));
|
||||
u_int8_t system_flags __attribute__((packed));
|
||||
u_int8_t stream_type __attribute__((packed));
|
||||
u_int32_t source_conn __attribute__((packed));
|
||||
u_int32_t dest_conn __attribute__((packed));
|
||||
u_int32_t packet_sequence __attribute__((packed));
|
||||
u_int32_t send_delay __attribute__((packed));
|
||||
u_int16_t burst_sequence __attribute__((packed));
|
||||
u_int16_t ack_sequence __attribute__((packed));
|
||||
u_int32_t burst_length __attribute__((packed));
|
||||
u_int32_t data_offset __attribute__((packed));
|
||||
u_int16_t data_bytes __attribute__((packed));
|
||||
u_int16_t missing_frags __attribute__((packed));
|
||||
u_int16_t type;
|
||||
u_int8_t system_flags;
|
||||
u_int8_t stream_type;
|
||||
u_int32_t source_conn;
|
||||
u_int32_t dest_conn;
|
||||
u_int32_t packet_sequence;
|
||||
u_int32_t send_delay;
|
||||
u_int16_t burst_sequence;
|
||||
u_int16_t ack_sequence;
|
||||
u_int32_t burst_length;
|
||||
u_int32_t data_offset;
|
||||
u_int16_t data_bytes;
|
||||
u_int16_t missing_frags;
|
||||
} __attribute__((packed));
|
||||
|
||||
void handle_ipx(unsigned char *buf, int length, char *frame, int no);
|
||||
@@ -145,10 +147,10 @@ int handle_burst(struct sockaddr_ipx *source,
|
||||
*/
|
||||
typedef struct saps
|
||||
{
|
||||
u_int16_t serverType __attribute__((packed)); /* NBO */
|
||||
u_int8_t serverName[SAP_MAX_SERVER_NAME_LENGTH] __attribute__((packed));
|
||||
struct ipx_address serverAddress __attribute__((packed));
|
||||
u_int16_t serverHops __attribute__((packed)); /* NBO */
|
||||
u_int16_t serverType; /* NBO */
|
||||
u_int8_t serverName[SAP_MAX_SERVER_NAME_LENGTH];
|
||||
struct ipx_address serverAddress;
|
||||
u_int16_t serverHops; /* NBO */
|
||||
} __attribute__((packed))
|
||||
SAPS;
|
||||
|
||||
@@ -158,15 +160,15 @@ union sap_packet
|
||||
unsigned short sapOperation;
|
||||
struct sap_query
|
||||
{
|
||||
u_int16_t sapOperation __attribute__((packed));
|
||||
u_int16_t serverType __attribute__((packed));
|
||||
u_int16_t sapOperation;
|
||||
u_int16_t serverType;
|
||||
} __attribute__((packed))
|
||||
query;
|
||||
struct sap_response
|
||||
{
|
||||
u_int16_t sapOperation __attribute__((packed));
|
||||
u_int16_t sapOperation;
|
||||
/* each SAP can has a max of SAP_MAX_SAPS_PER_PACKET packets */
|
||||
SAPS sap[SAP_MAX_SAPS_PER_PACKET] __attribute__((packed));
|
||||
SAPS sap[SAP_MAX_SAPS_PER_PACKET];
|
||||
} __attribute__((packed))
|
||||
response;
|
||||
};
|
||||
@@ -350,12 +352,12 @@ handle_burst(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct ncp_burst_request
|
||||
{
|
||||
struct ncp_burst_header h __attribute__((packed));
|
||||
u_int32_t function __attribute__((packed));
|
||||
u_int32_t file_handle __attribute__((packed));
|
||||
u_int8_t reserved[8] __attribute__((packed));
|
||||
u_int32_t file_offset __attribute__((packed));
|
||||
u_int32_t number_of_bytes __attribute__((packed));
|
||||
struct ncp_burst_header h;
|
||||
u_int32_t function;
|
||||
u_int32_t file_handle;
|
||||
u_int8_t reserved[8];
|
||||
u_int32_t file_offset;
|
||||
u_int32_t number_of_bytes;
|
||||
} __attribute__((packed))
|
||||
*brq = (struct ncp_burst_request *) rq;
|
||||
|
||||
@@ -636,8 +638,8 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct INPUT
|
||||
{
|
||||
u_int16_t proposed_max_size __attribute__((packed));
|
||||
u_int8_t security_flag __attribute__((packed));
|
||||
u_int16_t proposed_max_size;
|
||||
u_int8_t security_flag;
|
||||
} __attribute__((packed))
|
||||
*d = (struct INPUT *) data;
|
||||
|
||||
@@ -653,11 +655,11 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct INPUT
|
||||
{
|
||||
u_int32_t local_conn_id __attribute__((packed));
|
||||
u_int32_t local_max_packet_size __attribute__((packed));
|
||||
u_int16_t local_target_socket __attribute__((packed));
|
||||
u_int32_t local_max_send_size __attribute__((packed));
|
||||
u_int32_t local_max_recv_size __attribute__((packed));
|
||||
u_int32_t local_conn_id;
|
||||
u_int32_t local_max_packet_size;
|
||||
u_int16_t local_target_socket;
|
||||
u_int32_t local_max_send_size;
|
||||
u_int32_t local_max_recv_size;
|
||||
} __attribute__((packed))
|
||||
*d = (struct INPUT *) data;
|
||||
|
||||
@@ -700,12 +702,12 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct INPUT
|
||||
{
|
||||
u_int8_t subfunction_code __attribute__((packed));
|
||||
u_int32_t fragger_handle __attribute__((packed));
|
||||
u_int32_t max_fragment_size __attribute__((packed));
|
||||
u_int32_t message_size __attribute__((packed));
|
||||
u_int32_t fragment_flag __attribute__((packed));
|
||||
u_int32_t verb __attribute__((packed));
|
||||
u_int8_t subfunction_code;
|
||||
u_int32_t fragger_handle;
|
||||
u_int32_t max_fragment_size;
|
||||
u_int32_t message_size;
|
||||
u_int32_t fragment_flag;
|
||||
u_int32_t verb;
|
||||
} __attribute__((packed))
|
||||
*d = (struct INPUT *) data;
|
||||
printf("Send NDS Fragment Request/Reply\n");
|
||||
@@ -1001,8 +1003,8 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct XDATA
|
||||
{
|
||||
u_int8_t new_directory_handle __attribute__((packed));
|
||||
u_int8_t access_rights_mask __attribute__((packed));
|
||||
u_int8_t new_directory_handle;
|
||||
u_int8_t access_rights_mask;
|
||||
} __attribute__((packed))
|
||||
*x = (struct XDATA *) data;
|
||||
printf("new_directory_handle: %x\n",
|
||||
@@ -1021,9 +1023,9 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct XDATA
|
||||
{
|
||||
u_int16_t accepted_max_size __attribute__((packed));
|
||||
u_int16_t echo_socket __attribute__((packed));
|
||||
u_int8_t security_flag __attribute__((packed));
|
||||
u_int16_t accepted_max_size;
|
||||
u_int16_t echo_socket;
|
||||
u_int8_t security_flag;
|
||||
} __attribute__((packed))
|
||||
*x = (struct XDATA *) data;
|
||||
printf("accepted_max_size: %x\n",
|
||||
@@ -1038,9 +1040,9 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
{
|
||||
struct XDATA
|
||||
{
|
||||
u_int8_t completion_code __attribute__((packed));
|
||||
u_int32_t remote_target_id __attribute__((packed));
|
||||
u_int32_t remote_max_packet_size __attribute__((packed));
|
||||
u_int8_t completion_code;
|
||||
u_int32_t remote_target_id;
|
||||
u_int32_t remote_max_packet_size;
|
||||
}
|
||||
*x = (struct XDATA *) data;
|
||||
printf("completion_code: %x\n",
|
||||
@@ -1098,12 +1100,15 @@ handle_ncp(struct sockaddr_ipx *source,
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
unsigned char buf[16384];
|
||||
char buf[16384];
|
||||
unsigned char packet[8192];
|
||||
unsigned char *b;
|
||||
char *b;
|
||||
int len;
|
||||
int i = 1;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
while (fgets(buf, sizeof(buf), stdin) != NULL)
|
||||
{
|
||||
if (strlen(buf) == sizeof(buf) - 1)
|
||||
|
||||
Reference in New Issue
Block a user