30 #include <csp/csp_autoconfig.h> 33 #ifdef CSP_HAVE_STDBOOL_H 64 #define CSP_PRIORITIES (1 << CSP_ID_PRIO_SIZE) 67 #define CSP_RX_QUEUE_LENGTH (CSP_CONN_QUEUE_LENGTH / CSP_PRIORITIES) 68 #define CSP_ROUTE_FIFOS CSP_PRIORITIES 69 #define CSP_RX_QUEUES CSP_PRIORITIES 71 #define CSP_RX_QUEUE_LENGTH CSP_CONN_QUEUE_LENGTH 72 #define CSP_ROUTE_FIFOS 1 73 #define CSP_RX_QUEUES 1 77 #define CSP_ID_PRIO_SIZE 2 78 #define CSP_ID_HOST_SIZE 5 79 #define CSP_ID_PORT_SIZE 6 80 #define CSP_ID_FLAGS_SIZE 8 82 #define CSP_HEADER_BITS (CSP_ID_PRIO_SIZE + 2 * CSP_ID_HOST_SIZE + 2 * CSP_ID_PORT_SIZE + CSP_ID_FLAGS_SIZE) 83 #define CSP_HEADER_LENGTH (CSP_HEADER_BITS/8) 85 #if CSP_HEADER_BITS != 32 && __GNUC__ 86 #error "Header length must be 32 bits" 90 #define CSP_ID_PRIO_MAX ((1 << (CSP_ID_PRIO_SIZE)) - 1) 91 #define CSP_ID_HOST_MAX ((1 << (CSP_ID_HOST_SIZE)) - 1) 92 #define CSP_ID_PORT_MAX ((1 << (CSP_ID_PORT_SIZE)) - 1) 93 #define CSP_ID_FLAGS_MAX ((1 << (CSP_ID_FLAGS_SIZE)) - 1) 96 #define CSP_ID_PRIO_MASK ((uint32_t) CSP_ID_PRIO_MAX << (CSP_ID_FLAGS_SIZE + 2 * CSP_ID_PORT_SIZE + 2 * CSP_ID_HOST_SIZE)) 97 #define CSP_ID_SRC_MASK ((uint32_t) CSP_ID_HOST_MAX << (CSP_ID_FLAGS_SIZE + 2 * CSP_ID_PORT_SIZE + 1 * CSP_ID_HOST_SIZE)) 98 #define CSP_ID_DST_MASK ((uint32_t) CSP_ID_HOST_MAX << (CSP_ID_FLAGS_SIZE + 2 * CSP_ID_PORT_SIZE)) 99 #define CSP_ID_DPORT_MASK ((uint32_t) CSP_ID_PORT_MAX << (CSP_ID_FLAGS_SIZE + 1 * CSP_ID_PORT_SIZE)) 100 #define CSP_ID_SPORT_MASK ((uint32_t) CSP_ID_PORT_MAX << (CSP_ID_FLAGS_SIZE)) 101 #define CSP_ID_FLAGS_MASK ((uint32_t) CSP_ID_FLAGS_MAX << (0)) 103 #define CSP_ID_CONN_MASK (CSP_ID_SRC_MASK | CSP_ID_DST_MASK | CSP_ID_DPORT_MASK | CSP_ID_SPORT_MASK) 108 struct __attribute__((__packed__)) {
109 #if defined(CSP_BIG_ENDIAN) && !defined(CSP_LITTLE_ENDIAN) 116 #elif defined(CSP_LITTLE_ENDIAN) && !defined(CSP_BIG_ENDIAN) 124 #error "Must define one of CSP_BIG_ENDIAN or CSP_LITTLE_ENDIAN in csp_platform.h" 130 #define CSP_BROADCAST_ADDR CSP_ID_HOST_MAX 133 #define CSP_DEFAULT_ROUTE (CSP_ID_HOST_MAX + 1) 136 #define CSP_FRES1 0x80 // Reserved for future use 137 #define CSP_FRES2 0x40 // Reserved for future use 138 #define CSP_FRES3 0x20 // Reserved for future use 139 #define CSP_FFRAG 0x10 // Use fragmentation 140 #define CSP_FHMAC 0x08 // Use HMAC verification 141 #define CSP_FXTEA 0x04 // Use XTEA encryption 142 #define CSP_FRDP 0x02 // Use RDP protocol 143 #define CSP_FCRC32 0x01 // Use CRC32 checksum 146 #define CSP_SO_NONE 0x0000 // No socket options 147 #define CSP_SO_RDPREQ 0x0001 // Require RDP 148 #define CSP_SO_RDPPROHIB 0x0002 // Prohibit RDP 149 #define CSP_SO_HMACREQ 0x0004 // Require HMAC 150 #define CSP_SO_HMACPROHIB 0x0008 // Prohibit HMAC 151 #define CSP_SO_XTEAREQ 0x0010 // Require XTEA 152 #define CSP_SO_XTEAPROHIB 0x0020 // Prohibit HMAC 153 #define CSP_SO_CRC32REQ 0x0040 // Require CRC32 154 #define CSP_SO_CRC32PROHIB 0x0080 // Prohibit CRC32 155 #define CSP_SO_CONN_LESS 0x0100 // Enable Connection Less mode 158 #define CSP_O_NONE CSP_SO_NONE // No connection options 159 #define CSP_O_RDP CSP_SO_RDPREQ // Enable RDP 160 #define CSP_O_NORDP CSP_SO_RDPPROHIB // Disable RDP 161 #define CSP_O_HMAC CSP_SO_HMACREQ // Enable HMAC 162 #define CSP_O_NOHMAC CSP_SO_HMACPROHIB // Disable HMAC 163 #define CSP_O_XTEA CSP_SO_XTEAREQ // Enable XTEA 164 #define CSP_O_NOXTEA CSP_SO_XTEAPROHIB // Disable XTEA 165 #define CSP_O_CRC32 CSP_SO_CRC32REQ // Enable CRC32 166 #define CSP_O_NOCRC32 CSP_SO_CRC32PROHIB // Disable CRC32 174 typedef struct __attribute__((__packed__)) {
175 uint8_t padding[CSP_PADDING_BYTES];
214 #define CSP_BUFFER_PACKET_OVERHEAD (sizeof(csp_packet_t) - sizeof(((csp_packet_t *)0)->data)) 220 #define CSP_HOSTNAME_LEN 20 221 #define CSP_MODEL_LEN 30 224 #define CSP_REBOOT_MAGIC 0x80078007 225 #define CSP_REBOOT_SHUTDOWN_MAGIC 0xD1E5529A #define CSP_ID_HOST_SIZE
Definition: csp_types.h:78
uint32_t rx
Successfully received packets.
Definition: csp_types.h:197
uint32_t txbytes
Transmitted bytes.
Definition: csp_types.h:203
Definition: csp_types.h:47
uint32_t ext
Definition: csp_types.h:107
Interface struct.
Definition: csp_types.h:190
Definition: csp_types.h:53
Definition: csp_types.h:46
#define CSP_ID_FLAGS_SIZE
Definition: csp_types.h:80
uint32_t tx_error
Transmit errors.
Definition: csp_types.h:198
uint32_t frame
Frame format errors.
Definition: csp_types.h:202
struct csp_iface_s * next
Next interface.
Definition: csp_types.h:206
Definition: csp_types.h:48
csp_id_t id
CSP id must be just before data.
Definition: csp_types.h:177
uint32_t irq
Interrupts.
Definition: csp_types.h:205
uint16_t mtu
Maximum Transmission Unit of interface.
Definition: csp_types.h:194
uint32_t drop
Dropped packets.
Definition: csp_types.h:200
Definition: csp_types.h:61
void * driver
Pointer to interface handler structure.
Definition: csp_types.h:192
struct csp_conn_s csp_socket_t
Forward declaration of socket and connection structures.
Definition: csp_types.h:217
csp_reserved_ports_e
RESERVED PORTS (SERVICES)
Definition: csp_types.h:45
uint32_t tx
Successfully transmitted packets.
Definition: csp_types.h:196
const char * name
Interface name (keep below 10 bytes)
Definition: csp_types.h:191
struct csp_conn_s csp_conn_t
Definition: csp_types.h:218
Definition: csp_types.h:59
uint32_t autherr
Authentication errors.
Definition: csp_types.h:201
csp_prio_t
Definition: csp_types.h:57
Definition: csp_types.h:58
#define CSP_ID_PRIO_SIZE
Size of bit-fields in CSP header.
Definition: csp_types.h:77
uint16_t length
Length field must be just before CSP ID.
Definition: csp_types.h:176
uint32_t rx_error
Receive errors.
Definition: csp_types.h:199
Definition: csp_types.h:52
Definition: csp_types.h:50
Definition: csp_types.h:49
Definition: csp_types.h:51
nexthop_t nexthop
Next hop function.
Definition: csp_types.h:193
int(* nexthop_t)(struct csp_iface_s *interface, csp_packet_t *packet, uint32_t timeout)
Definition: csp_types.h:187
This union defines a CSP identifier and allows access to the individual fields or the entire identifi...
Definition: csp_types.h:106
struct csp_iface_s csp_iface_t
Interface struct.
CSP PACKET STRUCTURE Note: This structure is constructed to fit with all interface frame types in ord...
Definition: csp_types.h:174
uint8_t split_horizon_off
Disable the route-loop prevention on if.
Definition: csp_types.h:195
uint32_t rxbytes
Received bytes.
Definition: csp_types.h:204
Definition: csp_types.h:54
#define CSP_ID_PORT_SIZE
Definition: csp_types.h:79
Definition: csp_types.h:60