1/*************************************************************************** 2*** 3*** Copyright 2005 Hon Hai Precision Ind. Co. Ltd. 4*** All Rights Reserved. 5*** No portions of this material shall be reproduced in any form without the 6*** written permission of Hon Hai Precision Ind. Co. Ltd. 7*** 8*** All information contained in this document is Hon Hai Precision Ind. 9*** Co. Ltd. company private, proprietary, and trade secret property and 10*** are protected by international intellectual property laws and treaties. 11*** 12****************************************************************************/ 13 14# include <sys/types.h> 15# include <sys/socket.h> 16 17/* Length of interface name. */ 18#define IF_NAMESIZE 16 19 20/* Device mapping structure. I'd just gone off and designed a 21 beautiful scheme using only loadable modules with arguments for 22 driver options and along come the PCMCIA people 8) 23 24 Ah well. The get() side of this is good for WDSETUP, and it'll be 25 handy for debugging things. The set side is fine for now and being 26 very small might be worth keeping for clean configuration. */ 27 28struct ifmap 29 { 30 unsigned long int mem_start; 31 unsigned long int mem_end; 32 unsigned short int base_addr; 33 unsigned char irq; 34 unsigned char dma; 35 unsigned char port; 36 /* 3 bytes spare */ 37 }; 38 39/* Interface request structure used for socket ioctl's. All interface 40 ioctl's must have parameter definitions which begin with ifr_name. 41 The remainder may be interface specific. */ 42 43struct ifreq 44 { 45# define IFHWADDRLEN 6 46# define IFNAMSIZ IF_NAMESIZE 47 union 48 { 49 char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ 50 } ifr_ifrn; 51 52 union 53 { 54 struct sockaddr ifru_addr; 55 struct sockaddr ifru_dstaddr; 56 struct sockaddr ifru_broadaddr; 57 struct sockaddr ifru_netmask; 58 struct sockaddr ifru_hwaddr; 59 short int ifru_flags; 60 int ifru_ivalue; 61 int ifru_mtu; 62 struct ifmap ifru_map; 63 char ifru_slave[IFNAMSIZ]; /* Just fits the size */ 64 char ifru_newname[IFNAMSIZ]; 65 __caddr_t ifru_data; 66 } ifr_ifru; 67 }; 68# define ifr_name ifr_ifrn.ifrn_name /* interface name */ 69# define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ 70# define ifr_addr ifr_ifru.ifru_addr /* address */ 71# define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ 72# define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 73# define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ 74# define ifr_flags ifr_ifru.ifru_flags /* flags */ 75# define ifr_metric ifr_ifru.ifru_ivalue /* metric */ 76# define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ 77# define ifr_map ifr_ifru.ifru_map /* device map */ 78# define ifr_slave ifr_ifru.ifru_slave /* slave device */ 79# define ifr_data ifr_ifru.ifru_data /* for use by interface */ 80# define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ 81# define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ 82# define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */ 83# define ifr_newname ifr_ifru.ifru_newname /* New name */ 84# define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0) 85# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0) 86# define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0) 87 88 89/* Foxconn added start, Winster Chan, 06/26/2006 */ 90#include <linux/types.h> 91#include <linux/ppp_defs.h> 92#include <linux/if_ppp.h> 93/*#include <linux/if_pppox.h>*/ 94 95#include <linux/if_ether.h> /* ETH_ALEN */ 96#include <net/if.h> /* IFNAMSIZ */ 97#include <sys/file.h> 98 99 100#define PX_PROTO_OE 0 /* Currently just PPPoE */ 101#define PX_PROTO_TP 1 /* Add PPTP */ 102#define PX_MAX_PROTO 2 103 104#define ETH_ALEN 6 /* Ethernet MAC address length */ 105#define IPV4_LEN 4 /* IP V4 length */ 106 107/* This definition must refer to linux/if_ppp.h */ 108#define PPTPIOCGGRESEQ _IOR('t', 54, unsigned long) /* get GRE sequence number */ 109 110/************************************************************************ 111 * PPTP addressing definition 112 */ 113struct pptp_addr{ 114 unsigned char remote[ETH_ALEN]; /* Remote address */ 115 unsigned short sid; /* PPPoE session id */ 116 unsigned short cid; /* PPTP call id */ 117 unsigned short pcid; /* PPTP peer call id */ 118 unsigned long seq_num; /* Seq number of PPP packet */ 119 unsigned long ack_num; /* Ack number of PPP packet */ 120 unsigned long srcaddr; /* Source IP address */ 121 unsigned long dstaddr; /* Destination IP address */ 122 char dev[IFNAMSIZ]; /* Local device to use */ 123}; 124 125struct sockaddr_pptpox { 126 sa_family_t sa_family; /* address family, AF_PPPOX */ 127 unsigned int sa_protocol; /* protocol identifier */ 128 union{ 129 struct pptp_addr pptp; 130 }sa_addr; 131}__attribute__ ((packed)); 132 133/************************************************************************ 134 * PPPoE addressing definition 135 */ 136typedef __u16 sid_t; 137struct pppoe_addr{ 138 sid_t sid; /* Session identifier */ 139 unsigned char remote[ETH_ALEN]; /* Remote address */ 140 char dev[IFNAMSIZ]; /* Local device to use */ 141}; 142 143struct sockaddr_pppox { 144 sa_family_t sa_family; /* address family, AF_PPPOX */ 145 unsigned int sa_protocol; /* protocol identifier */ 146 union{ 147 struct pppoe_addr pppoe; 148 }sa_addr; 149}__attribute__ ((packed)); 150 151 152void pptp_pppox_open(int *poxfd, int *pppfd); 153int pptp_pppox_connect(int *poxfd, int *pppfd); /* foxconn wklin modified, 154 07/31/2007 */ 155struct sockaddr_pppox pptp_pppox_get_info(void); 156void pptp_pppox_release(int *poxfd, int *pppfd); 157 158/* Foxconn added end, pptp, Winster Chan, 06/26/2006 */ 159