49 DBG (
"TCP/IP received %s packet\n", tcpip->
name );
51 return tcpip->
rx ( iobuf,
netdev, st_src, st_dest,
76 DBG (
"Unrecognised TCP/IP address family %d\n",
sa_family );
99 DBG (
"TCP/IP sending %s packet\n", tcpip_net->
name );
120 return tcpip_net->
netdev ( st_dest );
171 const void *
data,
size_t len ) {
172 unsigned int cksum = ( ( ~partial ) & 0xffff );
176 for ( i = 0 ; i <
len ; i++ ) {
186 if ( cksum > 0xffff )
215 int ( * available ) (
int port ) ) {
231 return available ( try_port );
239 for ( i = 0 ; i <= max_port ; i++ ) {
240 try_port = ( ( i +
offset ) & max_port );
241 if ( try_port < min_port )
243 if ( available ( try_port ) < 0 )
uint16_t generic_tcpip_continue_chksum(uint16_t partial, const void *data, size_t len)
Calculate continued TCP/IP checkum.
struct net_device * tcpip_netdev(struct sockaddr_tcpip *st_dest)
Determine transmitting network device.
size_t tcpip_mtu(struct sockaddr_tcpip *st_dest)
Determine maximum transmission unit.
#define TCPIP_EMPTY_CSUM
Empty checksum value.
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.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
uint8_t tcpip_proto
Transport-layer protocol number.
size_t mtu
Maximum transmission unit length.
sa_family_t st_family
Socket address family (part of struct sockaddr)
#define EADDRINUSE
Address already in use.
unsigned long in_unknown_protos
ipSystemStatsInUnknownProtos
Bind to a privileged port (less than 1024)
int tcpip_bind(struct sockaddr_tcpip *st_local, int(*available)(int port))
Bind to local TCP/IP port.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define EAFNOSUPPORT
Address family not supported.
pseudo_bit_t value[0x00020]
struct net_device *(* netdev)(struct sockaddr_tcpip *dest)
Determine transmitting network device.
struct tcpip_net_protocol * tcpip_net_protocol(sa_family_t sa_family)
Find TCP/IP network-layer protocol.
#define TCPIP_PROTOCOLS
TCP/IP transport-layer protocol table.
static struct net_device * netdev
uint16_t sa_family_t
A socket address family.
#define be16_to_cpu(value)
Transport-network layer interface.
uint16_t st_port
TCP/IP port.
const char * name
Protocol name.
sa_family_t sa_family
Network address family.
unsigned long in_delivers
ipSystemStatsInDelivers
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
size_t header_len
Fixed header length.
#define le16_to_cpu(value)
A transport-layer protocol of the TCP/IP stack (eg.
Network device management.
#define EPROTONOSUPPORT
Protocol not supported.
uint8_t data[48]
Additional event data.
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.
uint16_t offset
Offset to command line.
A network-layer protocol of the TCP/IP stack (eg.
#define DBG(...)
Print a debugging message.
int tcpip_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 a TCP/IP packet.
uint16_t tcpip_chksum(const void *data, size_t len)
Calculate TCP/IP checkum.
const char * name
Protocol name.
#define NULL
NULL pointer (VOID *)
uint16_t tcpip_continue_chksum(uint16_t partial, const void *data, size_t len)
Calculate continued TCP/IP checkum.
#define TCPIP_NET_PROTOCOLS
TCP/IP network-layer protocol table.