mikroSDK Reference Manual
ipv4_routing.h
Go to the documentation of this file.
1
31#ifndef _IPV4_ROUTING_H
32#define _IPV4_ROUTING_H
33
34//Dependencies
35#include "core/net.h"
36#include "ipv4/ipv4.h"
37
38//IPv4 routing support
39#ifndef IPV4_ROUTING_SUPPORT
40 #define IPV4_ROUTING_SUPPORT DISABLED
41#elif (IPV4_ROUTING_SUPPORT != ENABLED && IPV4_ROUTING_SUPPORT != DISABLED)
42 #error IPV4_ROUTING_SUPPORT parameter is not valid
43#endif
44
45//Size of the IPv4 routing table
46#ifndef IPV4_ROUTING_TABLE_SIZE
47 #define IPV4_ROUTING_TABLE_SIZE 8
48#elif (IPV4_ROUTING_TABLE_SIZE < 1)
49 #error IPV4_ROUTING_TABLE_SIZE parameter is not valid
50#endif
51
52//C++ guard
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57
71
72
73//IPv4 routing related functions
74error_t ipv4InitRouting(void);
75error_t ipv4EnableRouting(NetInterface *interface, bool_t enable);
76
77error_t ipv4AddRoute(Ipv4Addr networkDest, Ipv4Addr networkMask,
78 NetInterface *interface, Ipv4Addr nextHop, uint_t metric);
79
80error_t ipv4DeleteRoute(Ipv4Addr networkDest, Ipv4Addr networkMask);
81error_t ipv4DeleteAllRoutes(void);
82
83error_t ipv4ForwardPacket(NetInterface *srcInterface, const NetBuffer *ipPacket,
84 size_t ipPacketOffset);
85
86//C++ guard
87#ifdef __cplusplus
88}
89#endif
90
91#endif
error_t
Error codes.
Definition error.h:43
IPv4 (Internet Protocol Version 4)
uint32_t Ipv4Addr
IPv4 network address.
Definition ipv4.h:267
TCP/IP stack core.
Routing table entry.
Definition ipv4_routing.h:63
Ipv4Addr networkDest
Network destination.
Definition ipv4_routing.h:65
uint_t metric
Metric value.
Definition ipv4_routing.h:69
Ipv4Addr nextHop
Next hop.
Definition ipv4_routing.h:68
NetInterface * interface
Outgoing network interface.
Definition ipv4_routing.h:67
bool_t valid
Valid entry.
Definition ipv4_routing.h:64
Ipv4Addr networkMask
Subnet mask for this route.
Definition ipv4_routing.h:66
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89