iPXE
neighbour.h
Go to the documentation of this file.
1 #ifndef _IPXE_NEIGHBOUR_H
2 #define _IPXE_NEIGHBOUR_H
3 
4 /** @file
5  *
6  * Neighbour discovery
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/refcnt.h>
14 #include <ipxe/list.h>
15 #include <ipxe/netdevice.h>
16 #include <ipxe/retry.h>
17 
18 /** A neighbour discovery protocol */
20  /** Name */
21  const char *name;
22  /**
23  * Transmit neighbour discovery request
24  *
25  * @v netdev Network device
26  * @v net_protocol Network-layer protocol
27  * @v net_dest Destination network-layer address
28  * @v net_source Source network-layer address
29  * @ret rc Return status code
30  */
31  int ( * tx_request ) ( struct net_device *netdev,
32  struct net_protocol *net_protocol,
33  const void *net_dest, const void *net_source );
34 };
35 
36 /** A neighbour cache entry */
37 struct neighbour {
38  /** Reference count */
39  struct refcnt refcnt;
40  /** List of neighbour cache entries */
41  struct list_head list;
42 
43  /** Network device */
44  struct net_device *netdev;
45  /** Network-layer protocol */
47  /** Network-layer destination address */
49  /** Link-layer destination address */
51 
52  /** Neighbour discovery protocol (if discovery is ongoing) */
54  /** Network-layer source address (for discovery requests) */
56  /** Retransmission timer */
58 
59  /** Pending I/O buffers */
61 };
62 
63 /** A neighbour transmission delay pseudo-header */
65  /** Original transmission time (in ticks) */
66  unsigned long start;
67 };
68 
69 extern struct list_head neighbours;
70 
71 extern int neighbour_tx ( struct io_buffer *iobuf, struct net_device *netdev,
72  struct net_protocol *net_protocol,
73  const void *net_dest,
74  struct neighbour_discovery *discovery,
75  const void *net_source );
76 extern int neighbour_update ( struct net_device *netdev,
77  struct net_protocol *net_protocol,
78  const void *net_dest, const void *ll_dest );
79 extern int neighbour_define ( struct net_device *netdev,
80  struct net_protocol *net_protocol,
81  const void *net_dest, const void *ll_dest );
82 
83 #endif /* _IPXE_NEIGHBOUR_H */
const char * name
Name.
Definition: neighbour.h:21
uint8_t net_dest[MAX_NET_ADDR_LEN]
Network-layer destination address.
Definition: neighbour.h:48
struct net_protocol * net_protocol
Network-layer protocol.
Definition: neighbour.h:46
Retry timers.
A retry timer.
Definition: retry.h:21
A neighbour discovery protocol.
Definition: neighbour.h:19
A doubly-linked list entry (or list head)
Definition: list.h:18
A reference counter.
Definition: refcnt.h:26
A timer.
Definition: timer.h:28
int neighbour_update(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *ll_dest)
Update existing neighbour cache entry.
Definition: neighbour.c:428
struct list_head neighbours
The neighbour cache.
Definition: neighbour.c:65
struct list_head list
List of neighbour cache entries.
Definition: neighbour.h:41
int(* tx_request)(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *net_source)
Transmit neighbour discovery request.
Definition: neighbour.h:31
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
Definition: netdevice.h:36
struct neighbour_discovery * discovery
Neighbour discovery protocol (if discovery is ongoing)
Definition: neighbour.h:53
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static struct net_device * netdev
Definition: gdbudp.c:52
struct list_head tx_queue
Pending I/O buffers.
Definition: neighbour.h:60
uint8_t ll_dest[MAX_LL_ADDR_LEN]
Link-layer destination address.
Definition: neighbour.h:50
unsigned long start
Original transmission time (in ticks)
Definition: neighbour.h:66
Linked lists.
int neighbour_define(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *ll_dest)
Define neighbour cache entry.
Definition: neighbour.c:453
A network device.
Definition: netdevice.h:352
unsigned char uint8_t
Definition: stdint.h:10
A neighbour cache entry.
Definition: neighbour.h:37
A network-layer protocol.
Definition: netdevice.h:64
Network device management.
Reference counting.
struct net_device * netdev
Network device.
Definition: neighbour.h:44
A neighbour transmission delay pseudo-header.
Definition: neighbour.h:64
#define MAX_NET_ADDR_LEN
Maximum length of a network-layer address.
Definition: netdevice.h:48
int neighbour_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, struct neighbour_discovery *discovery, const void *net_source)
Transmit packet, determining link-layer address via neighbour discovery.
Definition: neighbour.c:367
uint8_t net_source[MAX_NET_ADDR_LEN]
Network-layer source address (for discovery requests)
Definition: neighbour.h:55
A persistent I/O buffer.
Definition: iobuf.h:37