Webserver+3d print

Dependents:   Nucleo

Committer:
Sergunb
Date:
Sat Feb 04 18:15:49 2017 +0000
Revision:
0:8918a71cdbe9
nothing else

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:8918a71cdbe9 1 /**
Sergunb 0:8918a71cdbe9 2 * @file ipv6cp.h
Sergunb 0:8918a71cdbe9 3 * @brief IPV6CP (PPP IPv6 Control Protocol)
Sergunb 0:8918a71cdbe9 4 *
Sergunb 0:8918a71cdbe9 5 * @section License
Sergunb 0:8918a71cdbe9 6 *
Sergunb 0:8918a71cdbe9 7 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
Sergunb 0:8918a71cdbe9 8 *
Sergunb 0:8918a71cdbe9 9 * This file is part of CycloneTCP Open.
Sergunb 0:8918a71cdbe9 10 *
Sergunb 0:8918a71cdbe9 11 * This program is free software; you can redistribute it and/or
Sergunb 0:8918a71cdbe9 12 * modify it under the terms of the GNU General Public License
Sergunb 0:8918a71cdbe9 13 * as published by the Free Software Foundation; either version 2
Sergunb 0:8918a71cdbe9 14 * of the License, or (at your option) any later version.
Sergunb 0:8918a71cdbe9 15 *
Sergunb 0:8918a71cdbe9 16 * This program is distributed in the hope that it will be useful,
Sergunb 0:8918a71cdbe9 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Sergunb 0:8918a71cdbe9 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Sergunb 0:8918a71cdbe9 19 * GNU General Public License for more details.
Sergunb 0:8918a71cdbe9 20 *
Sergunb 0:8918a71cdbe9 21 * You should have received a copy of the GNU General Public License
Sergunb 0:8918a71cdbe9 22 * along with this program; if not, write to the Free Software Foundation,
Sergunb 0:8918a71cdbe9 23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Sergunb 0:8918a71cdbe9 24 *
Sergunb 0:8918a71cdbe9 25 * @author Oryx Embedded SARL (www.oryx-embedded.com)
Sergunb 0:8918a71cdbe9 26 * @version 1.7.6
Sergunb 0:8918a71cdbe9 27 **/
Sergunb 0:8918a71cdbe9 28
Sergunb 0:8918a71cdbe9 29 #ifndef _IPV6CP_H
Sergunb 0:8918a71cdbe9 30 #define _IPV6CP_H
Sergunb 0:8918a71cdbe9 31
Sergunb 0:8918a71cdbe9 32 //Dependencies
Sergunb 0:8918a71cdbe9 33 #include "core/net.h"
Sergunb 0:8918a71cdbe9 34 #include "ppp/ppp.h"
Sergunb 0:8918a71cdbe9 35
Sergunb 0:8918a71cdbe9 36
Sergunb 0:8918a71cdbe9 37 /**
Sergunb 0:8918a71cdbe9 38 * @brief IPV6CP option types
Sergunb 0:8918a71cdbe9 39 **/
Sergunb 0:8918a71cdbe9 40
Sergunb 0:8918a71cdbe9 41 typedef enum
Sergunb 0:8918a71cdbe9 42 {
Sergunb 0:8918a71cdbe9 43 IPV6CP_OPTION_INTERFACE_ID = 1, ///<Interface-Identifier
Sergunb 0:8918a71cdbe9 44 IPV6CP_OPTION_IPV6_COMP_PROTOCOL = 2 ///<IPv6-Compression-Protocol
Sergunb 0:8918a71cdbe9 45 } Ipv6cpOptionType;
Sergunb 0:8918a71cdbe9 46
Sergunb 0:8918a71cdbe9 47
Sergunb 0:8918a71cdbe9 48 //CodeWarrior or Win32 compiler?
Sergunb 0:8918a71cdbe9 49 #if defined(__CWCC__) || defined(_WIN32)
Sergunb 0:8918a71cdbe9 50 #pragma pack(push, 1)
Sergunb 0:8918a71cdbe9 51 #endif
Sergunb 0:8918a71cdbe9 52
Sergunb 0:8918a71cdbe9 53
Sergunb 0:8918a71cdbe9 54 /**
Sergunb 0:8918a71cdbe9 55 * @brief Interface-Identifier option
Sergunb 0:8918a71cdbe9 56 **/
Sergunb 0:8918a71cdbe9 57
Sergunb 0:8918a71cdbe9 58 typedef __start_packed struct
Sergunb 0:8918a71cdbe9 59 {
Sergunb 0:8918a71cdbe9 60 uint8_t type; //0
Sergunb 0:8918a71cdbe9 61 uint8_t length; //1
Sergunb 0:8918a71cdbe9 62 Eui64 interfaceId; //2-9
Sergunb 0:8918a71cdbe9 63 } __end_packed Ipv6cpInterfaceIdOption;
Sergunb 0:8918a71cdbe9 64
Sergunb 0:8918a71cdbe9 65
Sergunb 0:8918a71cdbe9 66 /**
Sergunb 0:8918a71cdbe9 67 * @brief IPv6-Compression-Protocol option
Sergunb 0:8918a71cdbe9 68 **/
Sergunb 0:8918a71cdbe9 69
Sergunb 0:8918a71cdbe9 70 typedef __start_packed struct
Sergunb 0:8918a71cdbe9 71 {
Sergunb 0:8918a71cdbe9 72 uint8_t type; //0
Sergunb 0:8918a71cdbe9 73 uint8_t length; //1
Sergunb 0:8918a71cdbe9 74 uint16_t protocol; //2-3
Sergunb 0:8918a71cdbe9 75 uint8_t data[]; //4
Sergunb 0:8918a71cdbe9 76 } __end_packed Ipv6cpIpCompProtocolOption;
Sergunb 0:8918a71cdbe9 77
Sergunb 0:8918a71cdbe9 78
Sergunb 0:8918a71cdbe9 79 //CodeWarrior or Win32 compiler?
Sergunb 0:8918a71cdbe9 80 #if defined(__CWCC__) || defined(_WIN32)
Sergunb 0:8918a71cdbe9 81 #pragma pack(pop)
Sergunb 0:8918a71cdbe9 82 #endif
Sergunb 0:8918a71cdbe9 83
Sergunb 0:8918a71cdbe9 84
Sergunb 0:8918a71cdbe9 85 //IPV6CP FSM events
Sergunb 0:8918a71cdbe9 86 error_t ipv6cpOpen(PppContext *context);
Sergunb 0:8918a71cdbe9 87 error_t ipv6cpClose(PppContext *context);
Sergunb 0:8918a71cdbe9 88
Sergunb 0:8918a71cdbe9 89 void ipv6cpTick(PppContext *context);
Sergunb 0:8918a71cdbe9 90
Sergunb 0:8918a71cdbe9 91 void ipv6cpProcessPacket(PppContext *context, const PppPacket *packet, size_t length);
Sergunb 0:8918a71cdbe9 92
Sergunb 0:8918a71cdbe9 93 error_t ipv6cpProcessConfigureReq(PppContext *context,
Sergunb 0:8918a71cdbe9 94 const PppConfigurePacket *configureReqPacket);
Sergunb 0:8918a71cdbe9 95
Sergunb 0:8918a71cdbe9 96 error_t ipv6cpProcessConfigureAck(PppContext *context,
Sergunb 0:8918a71cdbe9 97 const PppConfigurePacket *configureAckPacket);
Sergunb 0:8918a71cdbe9 98
Sergunb 0:8918a71cdbe9 99 error_t ipv6cpProcessConfigureNak(PppContext *context,
Sergunb 0:8918a71cdbe9 100 const PppConfigurePacket *configureNakPacket);
Sergunb 0:8918a71cdbe9 101
Sergunb 0:8918a71cdbe9 102 error_t ipv6cpProcessConfigureReject(PppContext *context,
Sergunb 0:8918a71cdbe9 103 const PppConfigurePacket *configureRejPacket);
Sergunb 0:8918a71cdbe9 104
Sergunb 0:8918a71cdbe9 105 error_t ipv6cpProcessTerminateReq(PppContext *context,
Sergunb 0:8918a71cdbe9 106 const PppTerminatePacket *terminateReqPacket);
Sergunb 0:8918a71cdbe9 107
Sergunb 0:8918a71cdbe9 108 error_t ipv6cpProcessTerminateAck(PppContext *context,
Sergunb 0:8918a71cdbe9 109 const PppTerminatePacket *terminateAckPacket);
Sergunb 0:8918a71cdbe9 110
Sergunb 0:8918a71cdbe9 111 error_t ipv6cpProcessCodeRej(PppContext *context,
Sergunb 0:8918a71cdbe9 112 const PppCodeRejPacket *codeRejPacket);
Sergunb 0:8918a71cdbe9 113
Sergunb 0:8918a71cdbe9 114 error_t ipv6cpProcessUnknownCode(PppContext *context,
Sergunb 0:8918a71cdbe9 115 const PppPacket *packet);
Sergunb 0:8918a71cdbe9 116
Sergunb 0:8918a71cdbe9 117 //IPV6CP FSM callback functions
Sergunb 0:8918a71cdbe9 118 void ipv6cpThisLayerUp(PppContext *context);
Sergunb 0:8918a71cdbe9 119 void ipv6cpThisLayerDown(PppContext *context);
Sergunb 0:8918a71cdbe9 120 void ipv6cpThisLayerStarted(PppContext *context);
Sergunb 0:8918a71cdbe9 121 void ipv6cpThisLayerFinished(PppContext *context);
Sergunb 0:8918a71cdbe9 122
Sergunb 0:8918a71cdbe9 123 void ipv6cpInitRestartCount(PppContext *context, uint_t value);
Sergunb 0:8918a71cdbe9 124 void ipv6cpZeroRestartCount(PppContext *context);
Sergunb 0:8918a71cdbe9 125
Sergunb 0:8918a71cdbe9 126 error_t ipv6cpSendConfigureReq(PppContext *context);
Sergunb 0:8918a71cdbe9 127
Sergunb 0:8918a71cdbe9 128 error_t ipv6cpSendConfigureAck(PppContext *context,
Sergunb 0:8918a71cdbe9 129 const PppConfigurePacket *configureReqPacket);
Sergunb 0:8918a71cdbe9 130
Sergunb 0:8918a71cdbe9 131 error_t ipv6cpSendConfigureNak(PppContext *context,
Sergunb 0:8918a71cdbe9 132 const PppConfigurePacket *configureReqPacket);
Sergunb 0:8918a71cdbe9 133
Sergunb 0:8918a71cdbe9 134 error_t ipv6cpSendConfigureRej(PppContext *context,
Sergunb 0:8918a71cdbe9 135 const PppConfigurePacket *configureReqPacket);
Sergunb 0:8918a71cdbe9 136
Sergunb 0:8918a71cdbe9 137 error_t ipv6cpSendTerminateReq(PppContext *context);
Sergunb 0:8918a71cdbe9 138
Sergunb 0:8918a71cdbe9 139 error_t ipv6cpSendTerminateAck(PppContext *context,
Sergunb 0:8918a71cdbe9 140 const PppTerminatePacket *terminateReqPacket);
Sergunb 0:8918a71cdbe9 141
Sergunb 0:8918a71cdbe9 142 error_t ipv6cpSendCodeRej(PppContext *context, const PppPacket *packet);
Sergunb 0:8918a71cdbe9 143
Sergunb 0:8918a71cdbe9 144 //IPV6CP options checking
Sergunb 0:8918a71cdbe9 145 error_t ipv6cpParseOption(PppContext *context, PppOption *option,
Sergunb 0:8918a71cdbe9 146 size_t inPacketLen, PppConfigurePacket *outPacket);
Sergunb 0:8918a71cdbe9 147
Sergunb 0:8918a71cdbe9 148 error_t ipv6cpParseInterfaceIdOption(PppContext *context,
Sergunb 0:8918a71cdbe9 149 Ipv6cpInterfaceIdOption *option, PppConfigurePacket *outPacket);
Sergunb 0:8918a71cdbe9 150
Sergunb 0:8918a71cdbe9 151 #endif
Sergunb 0:8918a71cdbe9 152