
This commit adds a new TCP/IP service to MINIX 3. As its core, the service uses the lwIP TCP/IP stack for maintenance reasons. The service aims to be compatible with NetBSD userland, including its low-level network management utilities. It also aims to support modern features such as IPv6. In summary, the new LWIP service has support for the following main features: - TCP, UDP, RAW sockets with mostly standard BSD API semantics; - IPv6 support: host mode (complete) and router mode (partial); - most of the standard BSD API socket options (SO_); - all of the standard BSD API message flags (MSG_); - the most used protocol-specific socket and control options; - a default loopback interface and the ability to create one more; - configuration-free ethernet interfaces and driver tracking; - queuing and multiple concurrent requests to each ethernet driver; - standard ioctl(2)-based BSD interface management; - radix tree backed, destination-based routing; - routing sockets for standard BSD route reporting and management; - multicast traffic and multicast group membership tracking; - Berkeley Packet Filter (BPF) devices; - standard and custom sysctl(7) nodes for many internals; - a slab allocation based, hybrid static/dynamic memory pool model. Many of its modules come with fairly elaborate comments that cover many aspects of what is going on. The service is primarily a socket driver built on top of the libsockdriver library, but for BPF devices it is at the same time also a character driver. Change-Id: Ib0c02736234b21143915e5fcc0fda8fe408f046f
51 lines
1.8 KiB
C
51 lines
1.8 KiB
C
#ifndef MINIX_NET_LWIP_RTTREE_H
|
|
#define MINIX_NET_LWIP_RTTREE_H
|
|
|
|
/* Routing table node structure. */
|
|
struct rttree_node {
|
|
struct rttree_node *rtn_child[2]; /* left child node */
|
|
struct rttree_node *rtn_parent; /* parent node */
|
|
uint8_t rtn_type; /* node type (RNT_) */
|
|
uint8_t rtn_bits; /* prefix bit count */
|
|
uint8_t rtn_byte; /* bits-derived byte index */
|
|
uint8_t rtn_shift; /* bits-derived shift count */
|
|
};
|
|
|
|
#define RTNT_DATA 0 /* data node (entry) */
|
|
#define RTNT_LINK 1 /* link node, in use */
|
|
#define RTNT_FREE 2 /* link node, free */
|
|
|
|
/* Routing table entry structure. */
|
|
struct rttree_entry {
|
|
struct rttree_node rte_data; /* data node - MUST be first */
|
|
struct rttree_node rte_link; /* link node */
|
|
const void *rte_addr; /* pointer to address */
|
|
const void *rte_mask; /* pointer to mask */
|
|
};
|
|
|
|
/* Routing table structure. */
|
|
struct rttree {
|
|
struct rttree_node *rtt_root; /* root of the route tree */
|
|
struct rttree_node *rtt_free; /* free internal nodes list */
|
|
uint8_t rtt_bits; /* number of bits in address */
|
|
};
|
|
|
|
#define rttree_get_addr(entry) ((entry)->rte_addr)
|
|
#define rttree_get_mask(entry) ((entry)->rte_mask)
|
|
#define rttree_get_prefix(entry) ((entry)->rte_data.rtn_bits)
|
|
|
|
void rttree_init(struct rttree * tree, unsigned int bits);
|
|
struct rttree_entry *rttree_lookup_match(struct rttree * tree,
|
|
const void * addr);
|
|
struct rttree_entry *rttree_lookup_host(struct rttree * tree,
|
|
const void * addr);
|
|
struct rttree_entry *rttree_lookup_exact(struct rttree * tree,
|
|
const void * addr, unsigned int prefix);
|
|
struct rttree_entry *rttree_enum(struct rttree * tree,
|
|
struct rttree_entry * entry);
|
|
int rttree_add(struct rttree * tree, struct rttree_entry * entry,
|
|
const void * addr, const void * mask, unsigned int prefix);
|
|
void rttree_delete(struct rttree * tree, struct rttree_entry * entry);
|
|
|
|
#endif /* !MINIX_NET_LWIP_RTTREE_H */
|