SPXstack/ipx.h

106 lines
2.0 KiB
C
Raw Permalink Normal View History

2022-01-14 20:42:16 +01:00
#ifndef IPX_H
#define IPX_H
typedef struct spx_frame spx_frame_t;
struct spx_frame {
uint16_t checksum;
uint16_t length;
uint8_t hops;
uint8_t type;
uint32_t dest_net;
uint16_t dest_node[3];
uint16_t dest_socket;
uint32_t src_net;
uint16_t src_node[3];
uint16_t src_socket;
uint8_t conn_control;
uint8_t datastream_type;
uint16_t src_conn_id;
uint16_t dest_conn_id;
uint16_t seq_no;
uint16_t ack_no;
uint16_t alloc_no;
unsigned char data[0];
}__attribute__((__packed__, aligned(1)));
typedef struct spx_header spx_header_t;
struct spx_header {
uint8_t conn_control;
uint8_t datastream_type;
uint16_t src_conn_id;
uint16_t dest_conn_id;
uint16_t seq_no;
uint16_t ack_no;
uint16_t alloc_no;
}__attribute__((__packed__, aligned(1)));
typedef struct ipx_frame ipx_frame_t;
struct ipx_frame {
uint16_t checksum;
uint16_t length;
uint8_t hops;
uint8_t type;
uint32_t dest_net;
uint16_t dest_node[3];
uint16_t dest_socket;
uint32_t src_net;
uint16_t src_node[3];
uint16_t src_socket;
unsigned char data[0];
} __attribute__((__packed__, aligned(1)));
typedef struct ethernet_frame ethernet_frame_t;
struct ethernet_frame
{
uint16_t dest_mac[3];
uint16_t src_mac[3];
uint16_t ethertype;
ipx_frame_t ipxpacket;
} __attribute__((__packed__, aligned(1)));
typedef struct ethernet_spx_frame ethernet_spx_frame_t;
struct ethernet_spx_frame
{
uint16_t dest_mac[3];
uint16_t src_mac[3];
uint16_t ethertype;
spx_frame_t spxpacket;
} __attribute__((__packed__, aligned(1)));
typedef struct IEEE8023_frame IEEE8023_frame_t;
struct IEEE8023_frame
{
uint16_t dest_mac[3];
uint16_t src_mac[3];
uint16_t length;
uint8_t DSAP;
uint8_t SSAP;
uint8_t ctrl;
ipx_frame_t ipxpacket;
} __attribute__((__packed__, aligned(1)));
/* Packet types */
#define PACKET_UNKNOWN 0
#define PACKET_RIP 1
#define PACKET_ECHO 2
#define PACKET_ERROR 3
#define PACKET_IPX 4 // also SAP Packet
#define PACKET_SPX 5
#define PACKET_NCP 17
#define PACKET_NETBIOS 20
#endif /* IPX_H */