mikroSDK Reference Manual
dhcpv6_relay.h
Go to the documentation of this file.
1
31#ifndef _DHCPV6_RELAY_H
32#define _DHCPV6_RELAY_H
33
34//Dependencies
36#include "core/socket.h"
37
38//DHCPv6 relay agent support
39#ifndef DHCPV6_RELAY_SUPPORT
40 #define DHCPV6_RELAY_SUPPORT ENABLED
41#elif (DHCPV6_RELAY_SUPPORT != ENABLED && DHCPV6_RELAY_SUPPORT != DISABLED)
42 #error DHCPV6_RELAY_SUPPORT parameter is not valid
43#endif
44
45//Stack size required to run the DHCPv6 relay agent
46#ifndef DHCPV6_RELAY_STACK_SIZE
47 #define DHCPV6_RELAY_STACK_SIZE 500
48#elif (DHCPV6_RELAY_STACK_SIZE < 1)
49 #error DHCPV6_RELAY_STACK_SIZE parameter is not valid
50#endif
51
52//Priority at which the DHCPv6 relay agent should run
53#ifndef DHCPV6_RELAY_PRIORITY
54 #define DHCPV6_RELAY_PRIORITY OS_TASK_PRIORITY_NORMAL
55#endif
56
57//Maximum number of client-facing interfaces
58#ifndef DHCPV6_RELAY_MAX_CLIENT_IF
59 #define DHCPV6_RELAY_MAX_CLIENT_IF 4
60#elif (DHCPV6_RELAY_MAX_CLIENT_IF < 1)
61 #error DHCPV6_RELAY_MAX_CLIENT_IF parameter is not valid
62#endif
63
64//The amount of overhead added by relay forwarding
65#define DHCPV6_RELAY_FORW_OVERHEAD (sizeof(Dhcpv6RelayMessage) + 2 * sizeof(Dhcpv6Option) + sizeof(uint32_t))
66
67//C++ guard
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72
77typedef struct
78{
79 NetInterface *serverInterface;
80 NetInterface *clientInterface[DHCPV6_RELAY_MAX_CLIENT_IF];
82 Ipv6Addr serverAddress;
84
85
90typedef struct
91{
92 NetInterface *serverInterface;
93 NetInterface *clientInterface[DHCPV6_RELAY_MAX_CLIENT_IF];
95 Ipv6Addr serverAddress;
96 Socket *serverSocket;
97 Socket *clientSocket[DHCPV6_RELAY_MAX_CLIENT_IF];
98 SocketEventDesc eventDesc[DHCPV6_RELAY_MAX_CLIENT_IF];
99 bool_t running;
100 bool_t stopRequest;
104#if (OS_STATIC_TASK_SUPPORT == ENABLED)
105 OsTaskTcb taskTcb;
106 OsStackType taskStack[DHCPV6_RELAY_STACK_SIZE];
107#endif
108 uint8_t buffer[DHCPV6_MAX_MSG_SIZE];
110
111
112//DHCPv6 relay agent specific functions
113error_t dhcpv6RelayStart(Dhcpv6RelayContext *context, const Dhcpv6RelaySettings *settings);
114error_t dhcpv6RelayStop(Dhcpv6RelayContext *context);
115
116error_t dhcpv6RelayJoinMulticastGroup(Dhcpv6RelayContext *context);
117error_t dhcpv6RelayLeaveMulticastGroup(Dhcpv6RelayContext *context);
118
119void dhcpv6RelayTask(void *param);
120
121error_t dhcpv6ForwardClientMessage(Dhcpv6RelayContext *context, uint_t index);
122error_t dhcpv6ForwardRelayReplyMessage(Dhcpv6RelayContext *context);
123
124//C++ guard
125#ifdef __cplusplus
126}
127#endif
128
129#endif
Definitions common to DHCPv6 client, server and relay agent.
error_t
Error codes.
Definition error.h:43
uint_t OsEvent
Event object.
Definition os_port_none.h:104
uint_t OsTaskId
Task identifier.
Definition os_port_none.h:97
Socket API.
DHCPv6 relay agent context.
Definition dhcpv6_relay.h:91
OsEvent event
Event object used to poll the sockets.
Definition dhcpv6_relay.h:102
uint_t clientInterfaceCount
Number of client-facing interfaces.
Definition dhcpv6_relay.h:94
bool_t running
DHCPv6 relay agent is currently running or not?
Definition dhcpv6_relay.h:99
bool_t stopRequest
Stop request.
Definition dhcpv6_relay.h:100
OsTaskTcb taskTcb
Task control block.
Definition dhcpv6_relay.h:105
NetInterface * serverInterface
Network-facing interface.
Definition dhcpv6_relay.h:92
OsTaskId taskId
Task identifier.
Definition dhcpv6_relay.h:103
Socket * serverSocket
Socket that handles the network-facing interface.
Definition dhcpv6_relay.h:96
OsEvent ackEvent
Event object use to acknowledge user requests.
Definition dhcpv6_relay.h:101
Ipv6Addr serverAddress
Address to be used when relaying messages to the server.
Definition dhcpv6_relay.h:95
DHCPv6 relay agent settings.
Definition dhcpv6_relay.h:78
Ipv6Addr serverAddress
Address to be used when relaying messages to the server.
Definition dhcpv6_relay.h:82
uint_t clientInterfaceCount
Number of client-facing interfaces.
Definition dhcpv6_relay.h:81
NetInterface * serverInterface
Network-facing interface.
Definition dhcpv6_relay.h:79
Structure describing socket events.
Definition socket.h:395