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