1 #ifndef __ADDR_POOL_H_
2 #define __ADDR_POOL_H_
3 
4 #include <netinet/in.h>
5 #include <sys/queue.h>
6 
7 /*----------------------------------------------------------------------------*/
8 typedef struct addr_pool *addr_pool_t;
9 /*----------------------------------------------------------------------------*/
10 /* CreateAddressPool()                                                        */
11 /* Create address pool for given address range.                               */
12 /* addr_base: the base address in network order.                              */
13 /* num_addr: number of addresses to use as source IP                          */
14 /*----------------------------------------------------------------------------*/
15 addr_pool_t
16 CreateAddressPool(in_addr_t addr_base, int num_addr);
17 /*----------------------------------------------------------------------------*/
18 /* CreateAddressPoolPerCore()                                                 */
19 /* Create address pool only for the given core number.                        */
20 /* All addresses and port numbers should be in network order.                 */
21 /*----------------------------------------------------------------------------*/
22 addr_pool_t
23 CreateAddressPoolPerCore(int core, int num_queues,
24 		in_addr_t saddr_base, int num_addr, in_addr_t daddr, in_port_t dport);
25 /*----------------------------------------------------------------------------*/
26 void
27 DestroyAddressPool(addr_pool_t ap);
28 /*----------------------------------------------------------------------------*/
29 int
30 FetchAddress(addr_pool_t ap, int core, int num_queues,
31 		const struct sockaddr_in *daddr, struct sockaddr_in *saddr);
32 /*----------------------------------------------------------------------------*/
33 int
34 FetchAddressPerCore(addr_pool_t ap, int core, int num_queues,
35 		    const struct sockaddr_in *daddr, struct sockaddr_in *saddr);
36 /*----------------------------------------------------------------------------*/
37 int
38 FreeAddress(addr_pool_t ap, const struct sockaddr_in *addr);
39 /*----------------------------------------------------------------------------*/
40 
41 #endif /* __ADDR_POOL_H_ */
42