20 #include <bits/tcpip.h> 27 #define TCPIP_POSITIVE_ZERO_CSUM 0x0000 30 #define TCPIP_NEGATIVE_ZERO_CSUM 0xffff 57 #define TCPIP_EMPTY_CSUM TCPIP_POSITIVE_ZERO_CSUM 178 #define TCPIP_PROTOCOLS __table ( struct tcpip_protocol, "tcpip_protocols" ) 181 #define __tcpip_protocol __table_entry ( TCPIP_PROTOCOLS, 01 ) 184 #define TCPIP_NET_PROTOCOLS \ 185 __table ( struct tcpip_net_protocol, "tcpip_net_protocols" ) 188 #define __tcpip_net_protocol __table_entry ( TCPIP_NET_PROTOCOLS, 01 ) 204 int ( * available ) (
int port ) );
int tcpip_tx(struct io_buffer *iobuf, struct tcpip_protocol *tcpip, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, struct net_device *netdev, uint16_t *trans_csum)
Transmit a TCP/IP packet.
static const void size_t len
tcpip_st_flags
TCP/IP address flags.
char pad[sizeof(struct sockaddr) -(sizeof(sa_family_t)+sizeof(uint16_t)+sizeof(uint16_t)+sizeof(uint16_t))]
Padding.
struct tcpip_net_protocol * tcpip_net_protocol(sa_family_t sa_family)
Find TCP/IP network-layer protocol.
int tcpip_bind(struct sockaddr_tcpip *st_local, int(*available)(int port))
Bind to local TCP/IP port.
uint8_t tcpip_proto
Transport-layer protocol number.
sa_family_t st_family
Socket address family (part of struct sockaddr)
uint16_t generic_tcpip_continue_chksum(uint16_t partial, const void *data, size_t len)
Calculate continued TCP/IP checkum.
Bind to a privileged port (less than 1024)
static __attribute__((always_inline)) uint16_t tcpip_continue_chksum(uint16_t partial
Calculate continued TCP/IP checkum.
size_t tcpip_mtu(struct sockaddr_tcpip *st_dest)
Determine maximum transmission unit.
uint16_t st_scope_id
Scope ID.
struct net_device *(* netdev)(struct sockaddr_tcpip *dest)
Determine transmitting network device.
static struct net_device * netdev
uint16_t sa_family_t
A socket address family.
struct net_protocol * net_protocol
Network-layer protocol.
uint16_t st_port
TCP/IP port.
const char * name
Protocol name.
Generalized socket address structure.
sa_family_t sa_family
Network address family.
size_t header_len
Fixed header length.
int tcpip_rx(struct io_buffer *iobuf, struct net_device *netdev, uint8_t tcpip_proto, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum, struct ip_statistics *stats)
Process a received TCP/IP packet.
struct net_device * tcpip_netdev(struct sockaddr_tcpip *st_dest)
Determine transmitting network device.
A network-layer protocol.
A transport-layer protocol of the TCP/IP stack (eg.
uint16_t zero_csum
Preferred zero checksum value.
uint16_t tcpip_chksum(const void *data, size_t len)
Calculate TCP/IP checkum.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
int(* tx)(struct io_buffer *iobuf, struct tcpip_protocol *tcpip_protocol, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, struct net_device *netdev, uint16_t *trans_csum)
Transmit packet.
int(* rx)(struct io_buffer *iobuf, struct net_device *netdev, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum)
Process received packet.
A network-layer protocol of the TCP/IP stack (eg.
const char * name
Protocol name.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)