PS2SDK
PS2 Homebrew Libraries
netcnf.h
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
11 #ifndef _NETCNF_H
12 #define _NETCNF_H
13 
14 typedef struct sceNetCnfList
15 {
16  int type;
17  int stat;
18  char sys_name[256];
19  char usr_name[256];
21 
22 typedef struct sceNetCnfAddress
23 {
24  int reserved;
25  char data[16];
27 
28 typedef struct sceNetCnfCommand
29 {
30  struct sceNetCnfCommand *forw;
31  struct sceNetCnfCommand *back;
32  int code;
34 
35 typedef struct sceNetCnfUnknown
36 {
37  struct sceNetCnfUnknown *forw;
38  struct sceNetCnfUnknown *back;
40 
41 typedef struct sceNetCnfUnknownList
42 {
43  struct sceNetCnfUnknown *head;
44  struct sceNetCnfUnknown *tail;
46 
47 typedef int (*sceNetCnfOpenFunction)(const char *device, const char *pathname, int flags, int mode, int *filesize);
48 typedef int (*sceNetCnfReadFunction)(int fd, const char *device, const char *pathname, void *buf, int offset, int size);
49 typedef int (*sceNetCnfCloseFunction)(int fd);
50 
51 typedef struct sceNetCnfCallback
52 {
53  int type;
54  sceNetCnfOpenFunction open;
55  sceNetCnfReadFunction read;
56  sceNetCnfCloseFunction close;
58 
60 {
61  unsigned char mru_nego;
62  unsigned char accm_nego;
63  unsigned char magic_nego;
64  unsigned char prc_nego;
65  unsigned char acc_nego;
66  unsigned char address_nego;
67  unsigned char vjcomp_nego;
68  unsigned char dns1_nego;
69  unsigned char dns2_nego;
70  unsigned char reserved_nego[7];
71  unsigned short mru;
72  unsigned int accm;
73  unsigned char auth;
74  unsigned char f_mru;
75  unsigned char f_accm;
76  unsigned char f_auth;
77  unsigned char *ip_address;
78  unsigned char *ip_mask;
79  unsigned char *dns1;
80  unsigned char *dns2;
81  unsigned int reserved_value[8];
82 };
83 
84 typedef struct sceNetCnfInterface
85 {
86  int type;
87  unsigned char *vendor;
88  unsigned char *product;
89  unsigned char *location;
90  unsigned char dhcp;
91  unsigned char *dhcp_host_name;
92  unsigned char dhcp_host_name_null_terminated;
93  unsigned char dhcp_release_on_stop;
94  unsigned char *address;
95  unsigned char *netmask;
96  unsigned char *chat_additional;
97  int redial_count;
98  int redial_interval;
99  unsigned char *outside_number;
100  unsigned char *outside_delay;
101  unsigned char *phone_numbers[10];
102  unsigned char answer_mode;
103  int answer_timeout;
104  int dialing_type;
105  unsigned char *chat_login;
106  unsigned char *auth_name;
107  unsigned char *auth_key;
108  unsigned char *peer_name;
109  unsigned char *peer_key;
110  int lcp_timeout;
111  int ipcp_timeout;
112  int idle_timeout;
113  int connect_timeout;
114  struct sceNetCnfInterface_want_allow want;
115  struct sceNetCnfInterface_want_allow allow;
116  int log_flags;
117  unsigned char force_chap_type;
118  unsigned char omit_empty_frame;
119  unsigned char pppoe;
120  unsigned char pppoe_host_uniq_auto;
121  unsigned char pppoe_reserved[2];
122  unsigned char *pppoe_service_name;
123  unsigned char *pppoe_ac_name;
124  int mtu;
125  unsigned char lcp_max_configure;
126  unsigned char lcp_max_terminate;
127  unsigned char ipcp_max_configure;
128  unsigned char ipcp_max_terminate;
129  unsigned char auth_timeout;
130  unsigned char auth_max_failure;
131  unsigned char reserved[6];
132  int phy_config;
133  struct sceNetCnfCommand *cmd_head;
134  struct sceNetCnfCommand *cmd_tail;
135  struct sceNetCnfUnknownList unknown_list;
137 
138 typedef struct sceNetCnfDial
139 {
140  unsigned char *tone_dial;
141  unsigned char *pulse_dial;
142  unsigned char *any_dial;
143  unsigned char *chat_init;
144  unsigned char *chat_dial;
145  unsigned char *chat_answer;
146  unsigned char *redial_string;
147  struct sceNetCnfUnknownList unknown_list;
149 
150 typedef struct sceNetCnfCtl
151 {
152  struct sceNetCnfDial *dial;
153  struct sceNetCnfInterface *ifc;
154  int id;
155  int phone_index;
156  int redial_index;
157  char interface[9];
159 
160 typedef struct sceNetCnfPair
161 {
162  struct sceNetCnfPair *forw;
163  struct sceNetCnfPair *back;
164  unsigned char *display_name;
165  unsigned char *attach_ifc;
166  unsigned char *attach_dev;
167  struct sceNetCnfInterface *ifc;
168  struct sceNetCnfInterface *dev;
169  struct sceNetCnfUnknownList unknown_list;
170  struct sceNetCnfCtl *ctl;
172 
173 typedef struct sceNetCnfRoot
174 {
175  struct sceNetCnfPair *pair_head;
176  struct sceNetCnfPair *pair_tail;
177  int version;
178  unsigned char *chat_additional;
179  int redial_count;
180  int redial_interval;
181  unsigned char *outside_number;
182  unsigned char *outside_delay;
183  int dialing_type;
184  struct sceNetCnfUnknownList unknown_list;
186 
187 typedef struct sceNetCnfEnv
188 {
189  char *dir_name;
190  char *arg_fname;
191  void *mem_base;
192  void *mem_ptr;
193  void *mem_last;
194  int req;
195  struct sceNetCnfRoot *root;
196  struct sceNetCnfInterface *ifc;
197  int f_no_check_magic;
198  int f_no_decode;
199  int f_verbose;
200  int file_err;
201  int alloc_err;
202  int syntax_err;
203  const char *fname;
204  int lno;
205  unsigned char lbuf[1024];
206  unsigned char dbuf[1024];
207  int ac;
208  const char *av[11];
210 
211 typedef struct sceNetCnfRoutingEntry
212 {
213  struct sceNetCnfAddress dstaddr;
214  struct sceNetCnfAddress gateway;
215  struct sceNetCnfAddress genmask;
216  int flags;
217  int mss;
218  int window;
219  char interface[9];
221 
222 typedef struct route
223 {
224  sceNetCnfCommand_t cmd;
226 } route_t;
227 
228 typedef struct nameserver
229 {
230  sceNetCnfCommand_t cmd;
231  sceNetCnfAddress_t address;
232 } nameserver_t;
233 
234 extern int sceNetCnfGetCount(const char *fname, int type);
235 extern int sceNetCnfGetList(const char *fname, int type, sceNetCnfList_t *p);
236 extern int sceNetCnfLoadEntry(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e);
237 extern int sceNetCnfAddEntry(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e);
238 extern int sceNetCnfDeleteEntry(const char *fname, int type, const char *usr_name);
239 extern int sceNetCnfSetLatestEntry(const char *fname, int type, const char *usr_name);
240 extern void *sceNetCnfAllocMem(sceNetCnfEnv_t *e, int size, int align);
241 extern int sceNetCnfInitIFC(sceNetCnfInterface_t *ifc);
242 extern int sceNetCnfLoadConf(sceNetCnfEnv_t *e);
243 extern int sceNetCnfLoadDial(sceNetCnfEnv_t *e, sceNetCnfPair_t *pair);
244 extern int sceNetCnfMergeConf(sceNetCnfEnv_t *e);
245 extern int sceNetCnfName2Address(sceNetCnfAddress_t *paddr, const char *buf);
246 extern int sceNetCnfAddress2String(char *buf, int len, const sceNetCnfAddress_t *paddr);
247 extern int
248 sceNetCnfEditEntry(const char *fname, int type, const char *usr_name, const char *new_usr_name, sceNetCnfEnv_t *e);
249 extern int sceNetCnfDeleteAll(const char *dev);
250 extern int sceNetCnfCheckCapacity(const char *fname);
251 extern int sceNetCnfConvA2S(char *sp_, char *dp_, int len);
252 extern int sceNetCnfConvS2A(char *sp_, char *dp_, int len);
253 extern int sceNetCnfCheckSpecialProvider(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e);
254 extern void sceNetCnfSetCallback(sceNetCnfCallback_t *pcallback);
255 
256 #define netcnf_IMPORTS_start DECLARE_IMPORT_TABLE(netcnf, 1, 32)
257 #define netcnf_IMPORTS_end END_IMPORT_TABLE
258 
259 #define I_sceNetCnfGetCount DECLARE_IMPORT(4, sceNetCnfGetCount)
260 #define I_sceNetCnfGetList DECLARE_IMPORT(5, sceNetCnfGetList)
261 #define I_sceNetCnfLoadEntry DECLARE_IMPORT(6, sceNetCnfLoadEntry)
262 #define I_sceNetCnfAddEntry DECLARE_IMPORT(7, sceNetCnfAddEntry)
263 #define I_sceNetCnfDeleteEntry DECLARE_IMPORT(8, sceNetCnfDeleteEntry)
264 #define I_sceNetCnfSetLatestEntry DECLARE_IMPORT(9, sceNetCnfSetLatestEntry)
265 #define I_sceNetCnfAllocMem DECLARE_IMPORT(10, sceNetCnfAllocMem)
266 #define I_sceNetCnfInitIFC DECLARE_IMPORT(11, sceNetCnfInitIFC)
267 #define I_sceNetCnfLoadConf DECLARE_IMPORT(12, sceNetCnfLoadConf)
268 #define I_sceNetCnfLoadDial DECLARE_IMPORT(13, sceNetCnfLoadDial)
269 #define I_sceNetCnfMergeConf DECLARE_IMPORT(14, sceNetCnfMergeConf)
270 #define I_sceNetCnfName2Address DECLARE_IMPORT(15, sceNetCnfName2Address)
271 #define I_sceNetCnfAddress2String DECLARE_IMPORT(16, sceNetCnfAddress2String)
272 #define I_sceNetCnfEditEntry DECLARE_IMPORT(17, sceNetCnfEditEntry)
273 #define I_sceNetCnfDeleteAll DECLARE_IMPORT(18, sceNetCnfDeleteAll)
274 #define I_sceNetCnfCheckCapacity DECLARE_IMPORT(19, sceNetCnfCheckCapacity)
275 #define I_sceNetCnfConvA2S DECLARE_IMPORT(20, sceNetCnfConvA2S)
276 #define I_sceNetCnfConvS2A DECLARE_IMPORT(21, sceNetCnfConvS2A)
277 #define I_sceNetCnfCheckSpecialProvider DECLARE_IMPORT(22, sceNetCnfCheckSpecialProvider)
278 #define I_sceNetCnfSetCallback DECLARE_IMPORT(23, sceNetCnfSetCallback)
279 
280 #endif
sceNetCnfEnv
Definition: netcnf.h:187
sceNetCnfDial
Definition: netcnf.h:138
sceNetCnfPair
Definition: netcnf.h:160
sceNetCnfCommand
Definition: netcnf.h:28
sceNetCnfUnknown
Definition: netcnf.h:35
sceNetCnfRoot
Definition: netcnf.h:173
sceNetCnfCallback
Definition: netcnf.h:51
sceNetCnfInterface_want_allow
Definition: netcnf.h:59
nameserver
Definition: netcnf.h:228
sceNetCnfCtl
Definition: netcnf.h:150
sceNetCnfRoutingEntry
Definition: netcnf.h:211
sceNetCnfInterface
Definition: netcnf.h:84
route
Definition: netcnf.h:222
sceNetCnfAddress
Definition: netcnf.h:22
sceNetCnfList
Definition: netcnf.h:14
version
unsigned int version
Definition: fileXio.h:5
sceNetCnfUnknownList
Definition: netcnf.h:41