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