* Copyright 2003-2005, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PPP_CONTROL__H
#define _PPP_CONTROL__H
#include <Drivers.h>
#include <driver_settings.h>
#include <PPPDefs.h>
#define IF_NAMESIZE 32
struct control_net_module_args {
char ifr_name[IF_NAMESIZE];
const char* name;
uint32 op;
void* data;
size_t length;
};
enum {
NET_IOCTL_BASE = 0xbe230000,
NET_STACK_IOCTL_BASE = NET_IOCTL_BASE + 0x200
};
enum {
NET_STACK_SOCKET = NET_STACK_IOCTL_BASE,
NET_STACK_BIND,
NET_STACK_RECVFROM,
NET_STACK_RECV,
NET_STACK_SENDTO,
NET_STACK_SEND,
NET_STACK_LISTEN,
NET_STACK_ACCEPT,
NET_STACK_CONNECT,
NET_STACK_SHUTDOWN,
NET_STACK_GETSOCKOPT,
NET_STACK_SETSOCKOPT,
NET_STACK_GETSOCKNAME,
NET_STACK_GETPEERNAME,
NET_STACK_SYSCTL,
NET_STACK_SELECT,
NET_STACK_DESELECT,
NET_STACK_GET_COOKIE,
NET_STACK_STOP,
NET_STACK_NOTIFY_SOCKET_EVENT,
NET_STACK_CONTROL_NET_MODULE,
NET_STACK_IOCTL_MAX
};
#define PPP_HANDLER_NAME_LENGTH_LIMIT 63
#define PPP_RESERVE_OPS_COUNT 0xFFFF
#define PPP_OPS_START B_DEVICE_OP_CODES_END + 1
#define PPP_INTERFACE_OPS_START PPP_OPS_START + PPP_RESERVE_OPS_COUNT
#define PPP_DEVICE_OPS_START PPP_OPS_START + 2 * PPP_RESERVE_OPS_COUNT
#define PPP_PROTOCOL_OPS_START PPP_OPS_START + 3 * PPP_RESERVE_OPS_COUNT
#define PPP_OPTION_HANDLER_OPS_START PPP_OPS_START + 5 * PPP_RESERVE_OPS_COUNT
#define PPP_LCP_EXTENSION_OPS_START PPP_OPS_START + 6 * PPP_RESERVE_OPS_COUNT
#define PPP_COMMON_OPS_START PPP_OPS_START + 10 * PPP_RESERVE_OPS_COUNT
#define PPP_USER_OPS_START PPP_OPS_START + 32 * PPP_RESERVE_OPS_COUNT
enum ppp_control_ops {
PPPC_CONTROL_MODULE = PPP_OPS_START,
PPPC_CREATE_INTERFACE,
PPPC_CREATE_INTERFACE_WITH_NAME,
PPPC_DELETE_INTERFACE,
PPPC_BRING_INTERFACE_UP,
PPPC_BRING_INTERFACE_DOWN,
PPPC_CONTROL_INTERFACE,
PPPC_GET_INTERFACES,
PPPC_COUNT_INTERFACES,
PPPC_FIND_INTERFACE_WITH_SETTINGS,
PPPC_GET_INTERFACE_INFO = PPP_INTERFACE_OPS_START,
PPPC_SET_USERNAME,
PPPC_SET_PASSWORD,
PPPC_SET_ASK_BEFORE_CONNECTING,
PPPC_SET_MRU,
PPPC_SET_CONNECT_ON_DEMAND,
PPPC_SET_AUTO_RECONNECT,
PPPC_HAS_INTERFACE_SETTINGS,
PPPC_GET_STATISTICS,
PPPC_CONTROL_DEVICE = PPP_INTERFACE_OPS_START + 0xFF,
PPPC_CONTROL_PROTOCOL,
PPPC_CONTROL_OPTION_HANDLER,
PPPC_CONTROL_LCP_EXTENSION,
PPPC_CONTROL_CHILD,
PPPC_GET_DEVICE_INFO = PPP_DEVICE_OPS_START,
PPPC_GET_PROTOCOL_INFO = PPP_PROTOCOL_OPS_START,
PPPC_ENABLE,
PPPC_GET_SIMPLE_HANDLER_INFO,
PPPC_ENABLE_REPORTS,
PPPC_DISABLE_REPORTS,
PPP_CONTROL_OPS_END = B_DEVICE_OP_CODES_END + 0xFFFF
};
typedef struct ppp_interface_description_info {
union {
const driver_settings *settings;
const char *name;
} u;
ppp_interface_id interface;
} ppp_interface_description_info;
typedef struct ppp_get_interfaces_info {
ppp_interface_id *interfaces;
int32 count;
ppp_interface_filter filter;
int32 resultCount;
} ppp_get_interfaces_info;
typedef struct ppp_control_info {
uint32 index;
uint32 op;
void *data;
size_t length;
} ppp_control_info;
#define _PPP_INFO_T_SIZE_ 256
typedef struct ppp_interface_info {
char name[PPP_HANDLER_NAME_LENGTH_LIMIT + 1];
int32 if_unit;
ppp_mode mode;
ppp_state state;
ppp_phase phase;
ppp_authentication_status localAuthenticationStatus, peerAuthenticationStatus;
ppp_pfc_state localPFCState, peerPFCState;
uint8 pfcOptions;
uint32 protocolsCount, optionHandlersCount, LCPExtensionsCount, childrenCount;
uint32 MRU, interfaceMTU;
uint32 connectAttempt, connectRetriesLimit;
uint32 connectRetryDelay, reconnectDelay;
bigtime_t connectedSince;
uint32 idleSince, disconnectAfterIdleSince;
bool doesConnectOnDemand, doesAutoReconnect, askBeforeConnecting, hasDevice;
bool isMultilink, hasParent;
} ppp_interface_info;
This structure guarantees backwards compatibility.
*/
typedef struct ppp_interface_info_t {
ppp_interface_info info;
uint8 _reserved_[_PPP_INFO_T_SIZE_ - sizeof(ppp_interface_info)];
} ppp_interface_info_t;
typedef struct ppp_statistics {
int64 bytesReceived, packetsReceived;
int64 bytesSent, packetsSent;
int64 errorBytesReceived, errorPacketsReceived;
int8 _reserved_[80];
} ppp_statistics;
typedef struct ppp_device_info {
char name[PPP_HANDLER_NAME_LENGTH_LIMIT + 1];
uint32 MTU;
uint32 inputTransferRate, outputTransferRate, outputBytesCount;
bool isUp;
} ppp_device_info;
This structure guarantees backwards compatibility.
*/
typedef struct ppp_device_info_t {
ppp_device_info info;
uint8 _reserved_[_PPP_INFO_T_SIZE_ - sizeof(ppp_device_info)];
} ppp_device_info_t;
typedef struct ppp_protocol_info {
char name[PPP_HANDLER_NAME_LENGTH_LIMIT + 1];
char type[PPP_HANDLER_NAME_LENGTH_LIMIT + 1];
ppp_phase activationPhase;
int32 addressFamily, flags;
ppp_side side;
ppp_level level;
uint32 overhead;
ppp_phase connectionPhase;
uint16 protocolNumber;
bool isEnabled;
bool isUpRequested;
} ppp_protocol_info;
This structure guarantees backwards compatibility.
*/
typedef struct ppp_protocol_info_t {
ppp_protocol_info info;
uint8 _reserved_[_PPP_INFO_T_SIZE_ - sizeof(ppp_protocol_info)];
} ppp_protocol_info_t;
typedef struct ppp_simple_handler_info {
char name[PPP_HANDLER_NAME_LENGTH_LIMIT + 1];
bool isEnabled;
uint8 code;
} ppp_simple_handler_info;
This structure guarantees backwards compatibility.
*/
typedef struct ppp_simple_handler_info_t {
ppp_simple_handler_info info;
uint8 _reserved_[_PPP_INFO_T_SIZE_ - sizeof(ppp_simple_handler_info)];
} ppp_simple_handler_info_t;
#endif