csp_types.h File Reference
#include <csp/csp_autoconfig.h>

Go to the source code of this file.

Data Structures

union  csp_id_t
 This union defines a CSP identifier and allows access to the individual fields or the entire identifier. More...
 
struct  csp_packet_t
 CSP PACKET STRUCTURE Note: This structure is constructed to fit with all interface frame types in order to have buffer reuse. More...
 
struct  csp_iface_s
 Interface struct. More...
 

Macros

#define bool   int
 
#define false   0
 
#define true   !false
 
#define CSP_PRIORITIES   (1 << CSP_ID_PRIO_SIZE)
 
#define CSP_RX_QUEUE_LENGTH   CSP_CONN_QUEUE_LENGTH
 
#define CSP_ROUTE_FIFOS   1
 
#define CSP_RX_QUEUES   1
 
#define CSP_ID_PRIO_SIZE   2
 Size of bit-fields in CSP header. More...
 
#define CSP_ID_HOST_SIZE   5
 
#define CSP_ID_PORT_SIZE   6
 
#define CSP_ID_FLAGS_SIZE   8
 
#define CSP_HEADER_BITS   (CSP_ID_PRIO_SIZE + 2 * CSP_ID_HOST_SIZE + 2 * CSP_ID_PORT_SIZE + CSP_ID_FLAGS_SIZE)
 
#define CSP_HEADER_LENGTH   (CSP_HEADER_BITS/8)
 
#define CSP_ID_PRIO_MAX   ((1 << (CSP_ID_PRIO_SIZE)) - 1)
 Highest number to be entered in field. More...
 
#define CSP_ID_HOST_MAX   ((1 << (CSP_ID_HOST_SIZE)) - 1)
 
#define CSP_ID_PORT_MAX   ((1 << (CSP_ID_PORT_SIZE)) - 1)
 
#define CSP_ID_FLAGS_MAX   ((1 << (CSP_ID_FLAGS_SIZE)) - 1)
 
#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))
 Identifier field masks. More...
 
#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))
 
#define CSP_ID_DST_MASK   ((uint32_t) CSP_ID_HOST_MAX << (CSP_ID_FLAGS_SIZE + 2 * CSP_ID_PORT_SIZE))
 
#define CSP_ID_DPORT_MASK   ((uint32_t) CSP_ID_PORT_MAX << (CSP_ID_FLAGS_SIZE + 1 * CSP_ID_PORT_SIZE))
 
#define CSP_ID_SPORT_MASK   ((uint32_t) CSP_ID_PORT_MAX << (CSP_ID_FLAGS_SIZE))
 
#define CSP_ID_FLAGS_MASK   ((uint32_t) CSP_ID_FLAGS_MAX << (0))
 
#define CSP_ID_CONN_MASK   (CSP_ID_SRC_MASK | CSP_ID_DST_MASK | CSP_ID_DPORT_MASK | CSP_ID_SPORT_MASK)
 
#define CSP_BROADCAST_ADDR   CSP_ID_HOST_MAX
 Broadcast address. More...
 
#define CSP_DEFAULT_ROUTE   (CSP_ID_HOST_MAX + 1)
 Default routing address. More...
 
#define CSP_FRES1   0x80
 CSP Flags. More...
 
#define CSP_FRES2   0x40
 
#define CSP_FRES3   0x20
 
#define CSP_FFRAG   0x10
 
#define CSP_FHMAC   0x08
 
#define CSP_FXTEA   0x04
 
#define CSP_FRDP   0x02
 
#define CSP_FCRC32   0x01
 
#define CSP_SO_NONE   0x0000
 CSP Socket options. More...
 
#define CSP_SO_RDPREQ   0x0001
 
#define CSP_SO_RDPPROHIB   0x0002
 
#define CSP_SO_HMACREQ   0x0004
 
#define CSP_SO_HMACPROHIB   0x0008
 
#define CSP_SO_XTEAREQ   0x0010
 
#define CSP_SO_XTEAPROHIB   0x0020
 
#define CSP_SO_CRC32REQ   0x0040
 
#define CSP_SO_CRC32PROHIB   0x0080
 
#define CSP_SO_CONN_LESS   0x0100
 
#define CSP_O_NONE   CSP_SO_NONE
 CSP Connect options. More...
 
#define CSP_O_RDP   CSP_SO_RDPREQ
 
#define CSP_O_NORDP   CSP_SO_RDPPROHIB
 
#define CSP_O_HMAC   CSP_SO_HMACREQ
 
#define CSP_O_NOHMAC   CSP_SO_HMACPROHIB
 
#define CSP_O_XTEA   CSP_SO_XTEAREQ
 
#define CSP_O_NOXTEA   CSP_SO_XTEAPROHIB
 
#define CSP_O_CRC32   CSP_SO_CRC32REQ
 
#define CSP_O_NOCRC32   CSP_SO_CRC32PROHIB
 
#define CSP_BUFFER_PACKET_OVERHEAD   (sizeof(csp_packet_t) - sizeof(((csp_packet_t *)0)->data))
 This define must be equal to the size of the packet overhead in csp_packet_t. More...
 
#define CSP_HOSTNAME_LEN   20
 
#define CSP_MODEL_LEN   30
 
#define CSP_REBOOT_MAGIC   0x80078007
 
#define CSP_REBOOT_SHUTDOWN_MAGIC   0xD1E5529A
 

Typedefs

typedef int(* nexthop_t) (struct csp_iface_s *interface, csp_packet_t *packet, uint32_t timeout)
 
typedef struct csp_iface_s csp_iface_t
 Interface struct. More...
 
typedef struct csp_conn_s csp_socket_t
 Forward declaration of socket and connection structures. More...
 
typedef struct csp_conn_s csp_conn_t
 

Enumerations

enum  csp_reserved_ports_e {
  CSP_CMP = 0, CSP_PING = 1, CSP_PS = 2, CSP_MEMFREE = 3,
  CSP_REBOOT = 4, CSP_BUF_FREE = 5, CSP_UPTIME = 6, CSP_ANY = (CSP_MAX_BIND_PORT + 1),
  CSP_PROMISC = (CSP_MAX_BIND_PORT + 2)
}
 RESERVED PORTS (SERVICES) More...
 
enum  csp_prio_t { CSP_PRIO_CRITICAL = 0, CSP_PRIO_HIGH = 1, CSP_PRIO_NORM = 2, CSP_PRIO_LOW = 3 }