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
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_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,
34 const void *net_dest, const void *net_source );
35};
36
37/** A neighbour cache entry */
38struct neighbour {
39 /** Reference count */
40 struct refcnt refcnt;
41 /** List of neighbour cache entries */
43
44 /** Network device */
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
70extern struct list_head neighbours;
71
72extern int neighbour_tx ( struct io_buffer *iobuf, struct net_device *netdev,
74 const void *net_dest,
75 struct neighbour_discovery *discovery,
76 const void *net_source );
77extern int neighbour_update ( struct net_device *netdev,
79 const void *net_dest, const void *ll_dest );
80extern int neighbour_define ( struct net_device *netdev,
82 const void *net_dest, const void *ll_dest );
83
84#endif /* _IPXE_NEIGHBOUR_H */
unsigned char uint8_t
Definition stdint.h:10
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
Linked lists.
struct list_head neighbours
The neighbour cache.
Definition neighbour.c:67
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
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
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
Network device management.
#define MAX_NET_ADDR_LEN
Maximum length of a network-layer address.
Definition netdevice.h:49
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
Definition netdevice.h:37
Reference counting.
Retry timers.
A persistent I/O buffer.
Definition iobuf.h:38
A doubly-linked list entry (or list head)
Definition list.h:19
A neighbour transmission delay pseudo-header.
Definition neighbour.h:65
unsigned long start
Original transmission time (in ticks)
Definition neighbour.h:67
A neighbour discovery protocol.
Definition neighbour.h:20
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
const char * name
Name.
Definition neighbour.h:22
A neighbour cache entry.
Definition neighbour.h:38
struct neighbour_discovery * discovery
Neighbour discovery protocol (if discovery is ongoing)
Definition neighbour.h:54
uint8_t net_source[MAX_NET_ADDR_LEN]
Network-layer source address (for discovery requests)
Definition neighbour.h:56
struct retry_timer timer
Retransmission timer.
Definition neighbour.h:58
struct list_head tx_queue
Pending I/O buffers.
Definition neighbour.h:61
struct refcnt refcnt
Reference count.
Definition neighbour.h:40
struct net_protocol * net_protocol
Network-layer protocol.
Definition neighbour.h:47
struct net_device * netdev
Network device.
Definition neighbour.h:45
uint8_t ll_dest[MAX_LL_ADDR_LEN]
Link-layer destination address.
Definition neighbour.h:51
uint8_t net_dest[MAX_NET_ADDR_LEN]
Network-layer destination address.
Definition neighbour.h:49
struct list_head list
List of neighbour cache entries.
Definition neighbour.h:42
A network device.
Definition netdevice.h:353
A network-layer protocol.
Definition netdevice.h:65
A retry timer.
Definition retry.h:22