mikroSDK Reference Manual
ipv6cp.h
Go to the documentation of this file.
1
31#ifndef _IPV6CP_H
32#define _IPV6CP_H
33
34//Dependencies
35#include "core/net.h"
36#include "ppp/ppp.h"
37
38//C++ guard
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43
53
54
55//CodeWarrior or Win32 compiler?
56#if defined(__CWCC__) || defined(_WIN32)
57 #pragma pack(push, 1)
58#endif
59
60
66{
67 uint8_t type; //0
68 uint8_t length; //1
69 Eui64 interfaceId; //2-9
70} Ipv6cpInterfaceIdOption;
71
72
77typedef __packed_struct
78{
79 uint8_t type; //0
80 uint8_t length; //1
81 uint16_t protocol; //2-3
82 uint8_t data[]; //4
83} Ipv6cpIpCompProtocolOption;
84
85
86//CodeWarrior or Win32 compiler?
87#if defined(__CWCC__) || defined(_WIN32)
88 #pragma pack(pop)
89#endif
90
91//IPV6CP FSM events
92error_t ipv6cpOpen(PppContext *context);
93error_t ipv6cpClose(PppContext *context);
94
95void ipv6cpTick(PppContext *context);
96
97void ipv6cpProcessPacket(PppContext *context, const PppPacket *packet, size_t length);
98
99error_t ipv6cpProcessConfigureReq(PppContext *context,
100 const PppConfigurePacket *configureReqPacket);
101
102error_t ipv6cpProcessConfigureAck(PppContext *context,
103 const PppConfigurePacket *configureAckPacket);
104
105error_t ipv6cpProcessConfigureNak(PppContext *context,
106 const PppConfigurePacket *configureNakPacket);
107
108error_t ipv6cpProcessConfigureReject(PppContext *context,
109 const PppConfigurePacket *configureRejPacket);
110
111error_t ipv6cpProcessTerminateReq(PppContext *context,
112 const PppTerminatePacket *terminateReqPacket);
113
114error_t ipv6cpProcessTerminateAck(PppContext *context,
115 const PppTerminatePacket *terminateAckPacket);
116
117error_t ipv6cpProcessCodeRej(PppContext *context,
118 const PppCodeRejPacket *codeRejPacket);
119
120error_t ipv6cpProcessUnknownCode(PppContext *context,
121 const PppPacket *packet);
122
123//IPV6CP FSM callback functions
124void ipv6cpThisLayerUp(PppContext *context);
125void ipv6cpThisLayerDown(PppContext *context);
126void ipv6cpThisLayerStarted(PppContext *context);
127void ipv6cpThisLayerFinished(PppContext *context);
128
129void ipv6cpInitRestartCount(PppContext *context, uint_t value);
130void ipv6cpZeroRestartCount(PppContext *context);
131
132error_t ipv6cpSendConfigureReq(PppContext *context);
133
134error_t ipv6cpSendConfigureAck(PppContext *context,
135 const PppConfigurePacket *configureReqPacket);
136
137error_t ipv6cpSendConfigureNak(PppContext *context,
138 const PppConfigurePacket *configureReqPacket);
139
140error_t ipv6cpSendConfigureRej(PppContext *context,
141 const PppConfigurePacket *configureReqPacket);
142
143error_t ipv6cpSendTerminateReq(PppContext *context);
144
145error_t ipv6cpSendTerminateAck(PppContext *context,
146 const PppTerminatePacket *terminateReqPacket);
147
148error_t ipv6cpSendCodeRej(PppContext *context, const PppPacket *packet);
149
150//IPV6CP options checking
151error_t ipv6cpParseOption(PppContext *context, PppOption *option,
152 size_t inPacketLen, PppConfigurePacket *outPacket);
153
154error_t ipv6cpParseInterfaceIdOption(PppContext *context,
155 Ipv6cpInterfaceIdOption *option, PppConfigurePacket *outPacket);
156
157//C++ guard
158#ifdef __cplusplus
159}
160#endif
161
162#endif
error_t
Error codes.
Definition error.h:43
Ipv6cpOptionType
IPV6CP option types.
Definition ipv6cp.h:49
@ IPV6CP_OPTION_INTERFACE_ID
Interface-Identifier.
Definition ipv6cp.h:50
@ IPV6CP_OPTION_IPV6_COMP_PROTOCOL
IPv6-Compression-Protocol.
Definition ipv6cp.h:51
typedef __packed_struct
Interface-Identifier option.
Definition ipv6cp.h:66
TCP/IP stack core.
PPP (Point-to-Point Protocol)