diff options
| author | Nikhil Chandru Rao | 2006-06-28 17:43:08 +0200 |
|---|---|---|
| committer | Nikhil Chandru Rao | 2006-06-28 17:43:08 +0200 |
| commit | c9ea71093067ccf1d8473df257d55da39f8f74da (patch) | |
| tree | 0465488b78ff0c365a1effc45444435a4228482a /src/include/gpxe | |
| parent | Add priority mechanism (diff) | |
| download | ipxe-c9ea71093067ccf1d8473df257d55da39f8f74da.tar.gz ipxe-c9ea71093067ccf1d8473df257d55da39f8f74da.tar.xz ipxe-c9ea71093067ccf1d8473df257d55da39f8f74da.zip | |
Renamed net/interface.c and include/gpxe/interface.h to net/tcpip_if.c and include/gpxe/tcpip_if.h respectively. Made changes in the other files.
Diffstat (limited to 'src/include/gpxe')
| -rw-r--r-- | src/include/gpxe/ip.h | 4 | ||||
| -rw-r--r-- | src/include/gpxe/tcpip_if.h | 91 | ||||
| -rw-r--r-- | src/include/gpxe/udp.h | 5 |
3 files changed, 99 insertions, 1 deletions
diff --git a/src/include/gpxe/ip.h b/src/include/gpxe/ip.h index e497dd79f..a6c590643 100644 --- a/src/include/gpxe/ip.h +++ b/src/include/gpxe/ip.h @@ -32,6 +32,7 @@ struct ipv4_pseudo_header { struct pk_buff; struct net_device; struct net_protocol; +struct tcpip_protocol; extern struct net_protocol ipv4_protocol; @@ -41,6 +42,7 @@ extern int add_ipv4_address ( struct net_device *netdev, extern void del_ipv4_address ( struct net_device *netdev ); extern int ipv4_uip_tx ( struct pk_buff *pkb ); -extern int ipv4_tx ( struct pk_buff *pkb, uint16_t trans_proto, struct in_addr *dest ); +extern int ipv4_tx ( struct pk_buff *pkb, struct tcpip_protocol *tcpip, + struct in_addr *dest ); #endif /* _GPXE_IP_H */ diff --git a/src/include/gpxe/tcpip_if.h b/src/include/gpxe/tcpip_if.h new file mode 100644 index 000000000..bac39699b --- /dev/null +++ b/src/include/gpxe/tcpip_if.h @@ -0,0 +1,91 @@ +#ifndef _GPXE_INTERFACE_H +#define _GPXE_INTERFACE_H + +/** @file + * + * Transport-network layer interface + * + */ + +#include <stdint.h> +#include <gpxe/in.h> +#include <gpxe/tables.h> + +struct pk_buff; +struct net_protocol; +struct tcpip_protocol; +struct tcpip_net_protocol; + +/** + * A transport-layer protocol of the TCPIP stack (eg. UDP, TCP, etc) + */ +struct tcpip_protocol { + /** Protocol name */ + const char *name; + /** + * Process received packet + * + * @v pkb Packet buffer + * @v netdev Network device + * @v ll_source Link-layer source address + * + * This method takes ownership of the packet buffer. + */ + void ( * rx ) ( struct pk_buff *pkb, struct in_addr *src_net_addr, struct in_addr *dest_net_addr ); + /** + * Transport-layer protocol number + * + * This is a constant of the type IP_XXX + */ + uint8_t trans_proto; + /** + * Checksum offset + * + * A negative number indicates that the protocol does not require + * checksumming to be performed by the network layer. A positive number is + * the offset of the checksum field in the transport-layer header. + */ + int csum_offset; +}; + +/** + * A TCPIP supporting network-layer protocol + */ +struct tcpip_net_protocol { + /** Network protocol */ + struct net_protocol *net_protocol; + /** Network address family */ + sa_family_t sa_family; + /** Complete transport-layer checksum calculation + * + * @v pkb Packet buffer + * @v tcpip Transport-layer protocol + * + */ + void ( * tx_csum ) ( struct pk_buff *pkb, + struct tcpip_protocol *tcpip ); +}; + +/** + * Register a transport-layer protocol + * + * @v protocol Transport-layer protocol + */ +#define TCPIP_PROTOCOL( protocol ) \ + struct tcpip_protocol protocol __table ( tcpip_protocols, 01 ) + +#define TCPIP_NET_PROTOCOL( protocol ) \ + struct tcpip_net_protocol protocol __table ( tcpip_net_protocols, 01 ) + +extern void trans_rx ( struct pk_buff *pkb, uint8_t trans_proto, + struct in_addr *src, struct in_addr *dest ); + +extern int trans_tx ( struct pk_buff *pkb, struct tcpip_protocol *tcpip, + struct sockaddr *dest ); + +extern uint16_t calc_chksum ( void *data, size_t len ); + +extern struct tcpip_protocol * find_tcpip_protocol ( uint8_t trans_proto ); +extern struct tcpip_net_protocol * find_tcpip_net_protocol ( sa_family_t sa_family ); + +#endif /* _GPXE_INTERFACE_H */ diff --git a/src/include/gpxe/udp.h b/src/include/gpxe/udp.h index faad6c2d3..e6511160c 100644 --- a/src/include/gpxe/udp.h +++ b/src/include/gpxe/udp.h @@ -75,6 +75,11 @@ struct udp_connection { static LIST_HEAD ( udp_conns ); /** + * UDP protocol + */ +extern struct tcpip_protocol udp_protocol; + +/** * Functions provided to the application layer */ |
