1 //---------------------------------------------------------------------- 2 // This software is part of the OpenBeOS distribution and is covered 3 // by the OpenBeOS license. 4 // 5 // Copyright (c) 2003 Waldemar Kornewald, Waldemar.Kornewald@web.de 6 //--------------------------------------------------------------------- 7 8 #ifndef _PPP_DEFS__H 9 #define _PPP_DEFS__H 10 11 #include <SupportDefs.h> 12 13 14 typedef uint32 interface_id; 15 16 17 // settings keys 18 #define PPP_DISONNECT_AFTER_IDLE_SINCE_KEY "DisonnectAfterIdleSince" 19 #define PPP_MODE_KEY "Mode" 20 #define PPP_DIAL_ON_DEMAND_KEY "DialOnDemand" 21 #define PPP_AUTO_REDIAL_KEY "AutoRedial" 22 #define PPP_LOAD_MODULE_KEY "LoadModule" 23 #define PPP_PROTOCOL_KEY "Protocol" 24 #define PPP_DEVICE_KEY "Device" 25 #define PPP_AUTHENTICATOR_KEY "Authenticator" 26 #define PPP_MULTILINK_KEY "Multilink-Protocol" 27 28 // settings values 29 #define PPP_CLIENT_MODE_VALUE "Client" 30 #define PPP_SERVER_MODE_VALUE "Server" 31 32 // path defines 33 #define PPP_MODULES_PATH "network/ppp" 34 35 // built-in protocols 36 #define PPP_LCP_PROTOCOL 0xC021 37 38 39 #define PPP_ERROR_BASE B_ERRORS_END + 1 40 41 42 // this is used when talking to the interface manager 43 enum ppp_interface_filter { 44 PPP_ALL_INTERFACES, 45 PPP_REGISTERED_INTERFACES, 46 PPP_UNREGISTERED_INTERFACES 47 }; 48 49 // return values for Send()/Receive() methods in addition to B_ERROR and B_OK 50 // PPP_UNHANDLED is also used by PPPOptionHandler 51 enum { 52 // B_ERROR means that the packet is corrupted 53 // B_OK means the packet was handled correctly 54 55 // return values for PPPProtocol 56 PPP_UNHANDLED = PPP_ERROR_BASE, 57 // The packet does not belong to this protocol. 58 // Do not delete the packet when you return this! 59 60 // return values of PPPInterface::Receive() 61 PPP_DISCARDED, 62 // packet was silently discarded 63 PPP_REJECTED, 64 // a protocol-reject was sent 65 66 PPP_NO_CONNECTION 67 // could not send a packet because device is not connected 68 }; 69 70 // PFC options 71 enum { 72 PPP_REQUEST_PFC = 0x01, 73 // try to request PFC (does not fail if not successful) 74 PPP_ALLOW_PFC = 0x02, 75 // allow PFC if other side requests it 76 PPP_FORCE_PFC_REQUEST = 0x04, 77 // if PFC request fails the connection attempt will terminate 78 PPP_FREEZE_PFC_OPTIONS = 0x80 79 // the options cannot be changed if this flag is set (mainly used by PPPDevice) 80 }; 81 82 enum ppp_pfc_state { 83 PPP_PFC_DISABLED, 84 PPP_PFC_ACCEPTED, 85 PPP_PFC_REJECTED 86 // not used for peer state 87 }; 88 89 // protocol flags 90 enum { 91 PPP_NO_FLAGS = 0x00, 92 PPP_ALWAYS_ALLOWED = 0x01, 93 // protocol may send/receive in Phase() >= PPP_ESTABLISHMENT_PHASE, 94 // but only LCP is allowed in State() != PPP_OPENED_STATE! 95 PPP_NOT_IMPORTANT = 0x02, 96 // if this protocol fails to go up we do not disconnect 97 PPP_INCLUDES_NCP = 0x04, 98 // This protocol includes the corresponding NCP protocol (e.g.: IPCP + IP). 99 // All protocol values will also be checked against Protocol() & 0x7FFF. 100 }; 101 102 // phase when the protocol is brought up 103 enum ppp_phase { 104 // the following may be used by protocols 105 PPP_AUTHENTICATION_PHASE = 15, 106 PPP_NCP_PHASE = 20, 107 PPP_ESTABLISHED_PHASE = 25, 108 // only use PPP_ESTABLISHED_PHASE if 109 // you want to activate this protocol after 110 // the normal protocols like IP (i.e., IPCP) 111 112 // the following must not be used by protocols! 113 PPP_DOWN_PHASE = 0, 114 PPP_TERMINATION_PHASE = 1, 115 // this is the selected phase when we are GOING down 116 PPP_ESTABLISHMENT_PHASE = 2 117 // in this phase some protocols (with PPP_ALWAYS_ALLOWED 118 // flag set) may be used 119 }; 120 121 // this defines the order in which the packets get encapsulated 122 enum ppp_level { 123 PPP_DEVICE_LEVEL = 0, 124 PPP_INTERFACE_LEVEL = 1, 125 // only used by PPPInterface 126 PPP_MULTILINK_LEVEL = 2, 127 PPP_ENCRYPTION_LEVEL = 5, 128 PPP_COMPRESSION_LEVEL = 10, 129 PPP_PROTOCOL_LEVEL = 1000 130 // highest level possible; use for protocols that do not encapsulate 131 }; 132 133 // we can be a ppp client or a ppp server interface 134 enum ppp_mode { 135 PPP_CLIENT_MODE = 0, 136 PPP_SERVER_MODE 137 }; 138 139 // which side the protocol works for 140 enum ppp_side { 141 PPP_NO_SIDE, 142 PPP_LOCAL_SIDE, 143 PPP_PEER_SIDE, 144 PPP_BOTH_SIDES 145 }; 146 147 // authentication status 148 enum ppp_authentication_status { 149 PPP_AUTHENTICATION_FAILED = -1, 150 PPP_NOT_AUTHENTICATED = 0, 151 PPP_AUTHENTICATION_SUCCESSFUL = 1, 152 PPP_AUTHENTICATING = 0xFF 153 }; 154 155 // PPP states as defined in RFC 1661 156 enum ppp_state { 157 PPP_INITIAL_STATE, 158 PPP_STARTING_STATE, 159 PPP_CLOSED_STATE, 160 PPP_STOPPED_STATE, 161 PPP_CLOSING_STATE, 162 PPP_STOPPING_STATE, 163 PPP_REQ_SENT_STATE, 164 PPP_ACK_RCVD_STATE, 165 PPP_ACK_SENT_STATE, 166 PPP_OPENED_STATE 167 }; 168 169 #endif 170