diff --git a/iop/network/Makefile b/iop/network/Makefile index cc0453a98654..6dd71ba7ae4b 100644 --- a/iop/network/Makefile +++ b/iop/network/Makefile @@ -7,6 +7,8 @@ # Review ps2sdk README & LICENSE files for further details. SUBDIRS = \ + netcnf \ + netcnfif \ netman \ smap \ smap-modular-netman \ diff --git a/iop/network/netcnf/Makefile b/iop/network/netcnf/Makefile new file mode 100644 index 000000000000..6f7998613acb --- /dev/null +++ b/iop/network/netcnf/Makefile @@ -0,0 +1,25 @@ +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. + +IOP_BIN ?= netcnf.irx + +IOP_IMPORT_INCS += \ + system/heaplib \ + system/loadcore \ + system/threadman \ + system/sysclib \ + system/iomanx \ + system/stdio \ + cdvd/cdvdman + +IOP_OBJS = netcnf.o exports.o imports.o + +include $(PS2SDKSRC)/Defs.make +include $(PS2SDKSRC)/iop/Rules.bin.make +include $(PS2SDKSRC)/iop/Rules.make +include $(PS2SDKSRC)/iop/Rules.release diff --git a/iop/network/netcnf/README.md b/iop/network/netcnf/README.md new file mode 100644 index 000000000000..a27f67704929 --- /dev/null +++ b/iop/network/netcnf/README.md @@ -0,0 +1,16 @@ +# Network configuration library + +This module provides functions to access the "Your Network Configuration File" +(YNCF) stored on the memory card, the hard drive, or other device. + +## Configurations + +There are multiple configurations of this library, allowing the choice of +balancing between size, speed, and features. + +* `netcnf` -> The recommended version. + +## How to use this module in your program + +In order to use this module in your program, use `LoadModule` or \ +`LoadModuleBuffer` with no arguments. diff --git a/iop/network/netcnf/include/netcnf.h b/iop/network/netcnf/include/netcnf.h new file mode 100644 index 000000000000..3f98ed9fa955 --- /dev/null +++ b/iop/network/netcnf/include/netcnf.h @@ -0,0 +1,280 @@ +/* +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. +*/ + +#ifndef _NETCNF_H +#define _NETCNF_H + +typedef struct sceNetCnfList +{ + int type; + int stat; + char sys_name[256]; + char usr_name[256]; +} sceNetCnfList_t; + +typedef struct sceNetCnfAddress +{ + int reserved; + char data[16]; +} sceNetCnfAddress_t; + +typedef struct sceNetCnfCommand +{ + struct sceNetCnfCommand *forw; + struct sceNetCnfCommand *back; + int code; +} sceNetCnfCommand_t; + +typedef struct sceNetCnfUnknown +{ + struct sceNetCnfUnknown *forw; + struct sceNetCnfUnknown *back; +} sceNetCnfUnknown_t; + +typedef struct sceNetCnfUnknownList +{ + struct sceNetCnfUnknown *head; + struct sceNetCnfUnknown *tail; +} sceNetCnfUnknownList_t; + +typedef int (*sceNetCnfOpenFunction)(const char *device, const char *pathname, int flags, int mode, int *filesize); +typedef int (*sceNetCnfReadFunction)(int fd, const char *device, const char *pathname, void *buf, int offset, int size); +typedef int (*sceNetCnfCloseFunction)(int fd); + +typedef struct sceNetCnfCallback +{ + int type; + sceNetCnfOpenFunction open; + sceNetCnfReadFunction read; + sceNetCnfCloseFunction close; +} sceNetCnfCallback_t; + +struct sceNetCnfInterface_want_allow +{ + unsigned char mru_nego; + unsigned char accm_nego; + unsigned char magic_nego; + unsigned char prc_nego; + unsigned char acc_nego; + unsigned char address_nego; + unsigned char vjcomp_nego; + unsigned char dns1_nego; + unsigned char dns2_nego; + unsigned char reserved_nego[7]; + unsigned short mru; + unsigned int accm; + unsigned char auth; + unsigned char f_mru; + unsigned char f_accm; + unsigned char f_auth; + unsigned char *ip_address; + unsigned char *ip_mask; + unsigned char *dns1; + unsigned char *dns2; + unsigned int reserved_value[8]; +}; + +typedef struct sceNetCnfInterface +{ + int type; + unsigned char *vendor; + unsigned char *product; + unsigned char *location; + unsigned char dhcp; + unsigned char *dhcp_host_name; + unsigned char dhcp_host_name_null_terminated; + unsigned char dhcp_release_on_stop; + unsigned char *address; + unsigned char *netmask; + unsigned char *chat_additional; + int redial_count; + int redial_interval; + unsigned char *outside_number; + unsigned char *outside_delay; + unsigned char *phone_numbers[10]; + unsigned char answer_mode; + int answer_timeout; + int dialing_type; + unsigned char *chat_login; + unsigned char *auth_name; + unsigned char *auth_key; + unsigned char *peer_name; + unsigned char *peer_key; + int lcp_timeout; + int ipcp_timeout; + int idle_timeout; + int connect_timeout; + struct sceNetCnfInterface_want_allow want; + struct sceNetCnfInterface_want_allow allow; + int log_flags; + unsigned char force_chap_type; + unsigned char omit_empty_frame; + unsigned char pppoe; + unsigned char pppoe_host_uniq_auto; + unsigned char pppoe_reserved[2]; + unsigned char *pppoe_service_name; + unsigned char *pppoe_ac_name; + int mtu; + unsigned char lcp_max_configure; + unsigned char lcp_max_terminate; + unsigned char ipcp_max_configure; + unsigned char ipcp_max_terminate; + unsigned char auth_timeout; + unsigned char auth_max_failure; + unsigned char reserved[6]; + int phy_config; + struct sceNetCnfCommand *cmd_head; + struct sceNetCnfCommand *cmd_tail; + struct sceNetCnfUnknownList unknown_list; +} sceNetCnfInterface_t; + +typedef struct sceNetCnfDial +{ + unsigned char *tone_dial; + unsigned char *pulse_dial; + unsigned char *any_dial; + unsigned char *chat_init; + unsigned char *chat_dial; + unsigned char *chat_answer; + unsigned char *redial_string; + struct sceNetCnfUnknownList unknown_list; +} sceNetCnfDial_t; + +typedef struct sceNetCnfCtl +{ + struct sceNetCnfDial *dial; + struct sceNetCnfInterface *ifc; + int id; + int phone_index; + int redial_index; + char interface[9]; +} sceNetCnfCtl_t; + +typedef struct sceNetCnfPair +{ + struct sceNetCnfPair *forw; + struct sceNetCnfPair *back; + unsigned char *display_name; + unsigned char *attach_ifc; + unsigned char *attach_dev; + struct sceNetCnfInterface *ifc; + struct sceNetCnfInterface *dev; + struct sceNetCnfUnknownList unknown_list; + struct sceNetCnfCtl *ctl; +} sceNetCnfPair_t; + +typedef struct sceNetCnfRoot +{ + struct sceNetCnfPair *pair_head; + struct sceNetCnfPair *pair_tail; + int version; + unsigned char *chat_additional; + int redial_count; + int redial_interval; + unsigned char *outside_number; + unsigned char *outside_delay; + int dialing_type; + struct sceNetCnfUnknownList unknown_list; +} sceNetCnfRoot_t; + +typedef struct sceNetCnfEnv +{ + char *dir_name; + char *arg_fname; + void *mem_base; + void *mem_ptr; + void *mem_last; + int req; + struct sceNetCnfRoot *root; + struct sceNetCnfInterface *ifc; + int f_no_check_magic; + int f_no_decode; + int f_verbose; + int file_err; + int alloc_err; + int syntax_err; + const char *fname; + int lno; + unsigned char lbuf[1024]; + unsigned char dbuf[1024]; + int ac; + const char *av[11]; +} sceNetCnfEnv_t; + +typedef struct sceNetCnfRoutingEntry +{ + struct sceNetCnfAddress dstaddr; + struct sceNetCnfAddress gateway; + struct sceNetCnfAddress genmask; + int flags; + int mss; + int window; + char interface[9]; +} sceNetCnfRoutingEntry_t; + +typedef struct route +{ + sceNetCnfCommand_t cmd; + sceNetCnfRoutingEntry_t re; +} route_t; + +typedef struct nameserver +{ + sceNetCnfCommand_t cmd; + sceNetCnfAddress_t address; +} nameserver_t; + +extern int sceNetCnfGetCount(const char *fname, int type); +extern int sceNetCnfGetList(const char *fname, int type, sceNetCnfList_t *p); +extern int sceNetCnfLoadEntry(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e); +extern int sceNetCnfAddEntry(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e); +extern int sceNetCnfDeleteEntry(const char *fname, int type, const char *usr_name); +extern int sceNetCnfSetLatestEntry(const char *fname, int type, const char *usr_name); +extern void *sceNetCnfAllocMem(sceNetCnfEnv_t *e, int size, int align); +extern int sceNetCnfInitIFC(sceNetCnfInterface_t *ifc); +extern int sceNetCnfLoadConf(sceNetCnfEnv_t *e); +extern int sceNetCnfLoadDial(sceNetCnfEnv_t *e, sceNetCnfPair_t *pair); +extern int sceNetCnfMergeConf(sceNetCnfEnv_t *e); +extern int sceNetCnfName2Address(sceNetCnfAddress_t *paddr, const char *buf); +extern int sceNetCnfAddress2String(char *buf, int len, const sceNetCnfAddress_t *paddr); +extern int +sceNetCnfEditEntry(const char *fname, int type, const char *usr_name, const char *new_usr_name, sceNetCnfEnv_t *e); +extern int sceNetCnfDeleteAll(const char *dev); +extern int sceNetCnfCheckCapacity(const char *fname); +extern int sceNetCnfConvA2S(char *sp_, char *dp_, int len); +extern int sceNetCnfConvS2A(char *sp_, char *dp_, int len); +extern int sceNetCnfCheckSpecialProvider(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e); +extern void sceNetCnfSetCallback(sceNetCnfCallback_t *pcallback); + +#define netcnf_IMPORTS_start DECLARE_IMPORT_TABLE(netcnf, 1, 32) +#define netcnf_IMPORTS_end END_IMPORT_TABLE + +#define I_sceNetCnfGetCount DECLARE_IMPORT(4, sceNetCnfGetCount) +#define I_sceNetCnfGetList DECLARE_IMPORT(5, sceNetCnfGetList) +#define I_sceNetCnfLoadEntry DECLARE_IMPORT(6, sceNetCnfLoadEntry) +#define I_sceNetCnfAddEntry DECLARE_IMPORT(7, sceNetCnfAddEntry) +#define I_sceNetCnfDeleteEntry DECLARE_IMPORT(8, sceNetCnfDeleteEntry) +#define I_sceNetCnfSetLatestEntry DECLARE_IMPORT(9, sceNetCnfSetLatestEntry) +#define I_sceNetCnfAllocMem DECLARE_IMPORT(10, sceNetCnfAllocMem) +#define I_sceNetCnfInitIFC DECLARE_IMPORT(11, sceNetCnfInitIFC) +#define I_sceNetCnfLoadConf DECLARE_IMPORT(12, sceNetCnfLoadConf) +#define I_sceNetCnfLoadDial DECLARE_IMPORT(13, sceNetCnfLoadDial) +#define I_sceNetCnfMergeConf DECLARE_IMPORT(14, sceNetCnfMergeConf) +#define I_sceNetCnfName2Address DECLARE_IMPORT(15, sceNetCnfName2Address) +#define I_sceNetCnfAddress2String DECLARE_IMPORT(16, sceNetCnfAddress2String) +#define I_sceNetCnfEditEntry DECLARE_IMPORT(17, sceNetCnfEditEntry) +#define I_sceNetCnfDeleteAll DECLARE_IMPORT(18, sceNetCnfDeleteAll) +#define I_sceNetCnfCheckCapacity DECLARE_IMPORT(19, sceNetCnfCheckCapacity) +#define I_sceNetCnfConvA2S DECLARE_IMPORT(20, sceNetCnfConvA2S) +#define I_sceNetCnfConvS2A DECLARE_IMPORT(21, sceNetCnfConvS2A) +#define I_sceNetCnfCheckSpecialProvider DECLARE_IMPORT(22, sceNetCnfCheckSpecialProvider) +#define I_sceNetCnfSetCallback DECLARE_IMPORT(23, sceNetCnfSetCallback) + +#endif diff --git a/iop/network/netcnf/src/exports.tab b/iop/network/netcnf/src/exports.tab new file mode 100644 index 000000000000..f8f54e4eba43 --- /dev/null +++ b/iop/network/netcnf/src/exports.tab @@ -0,0 +1,29 @@ + +DECLARE_EXPORT_TABLE(netcnf, 1, 32) + DECLARE_EXPORT(_start) + DECLARE_EXPORT(_retonly) + DECLARE_EXPORT(_retonly) + DECLARE_EXPORT(_retonly) + DECLARE_EXPORT(sceNetCnfGetCount) + DECLARE_EXPORT(sceNetCnfGetList) + DECLARE_EXPORT(sceNetCnfLoadEntry) + DECLARE_EXPORT(sceNetCnfAddEntry) + DECLARE_EXPORT(sceNetCnfDeleteEntry) + DECLARE_EXPORT(sceNetCnfSetLatestEntry) + DECLARE_EXPORT(sceNetCnfAllocMem) + DECLARE_EXPORT(sceNetCnfInitIFC) + DECLARE_EXPORT(sceNetCnfLoadConf) + DECLARE_EXPORT(sceNetCnfLoadDial) + DECLARE_EXPORT(sceNetCnfMergeConf) + DECLARE_EXPORT(sceNetCnfName2Address) + DECLARE_EXPORT(sceNetCnfAddress2String) + DECLARE_EXPORT(sceNetCnfEditEntry) + DECLARE_EXPORT(sceNetCnfDeleteAll) + DECLARE_EXPORT(sceNetCnfCheckCapacity) + DECLARE_EXPORT(sceNetCnfConvA2S) + DECLARE_EXPORT(sceNetCnfConvS2A) + DECLARE_EXPORT(sceNetCnfCheckSpecialProvider) + DECLARE_EXPORT(sceNetCnfSetCallback) +END_EXPORT_TABLE + +void _retonly() {} diff --git a/iop/network/netcnf/src/imports.lst b/iop/network/netcnf/src/imports.lst new file mode 100644 index 000000000000..8fb0b920670a --- /dev/null +++ b/iop/network/netcnf/src/imports.lst @@ -0,0 +1,65 @@ + +heaplib_IMPORTS_start +I_CreateHeap +I_DeleteHeap +I_AllocHeapMemory +I_FreeHeapMemory +heaplib_IMPORTS_end + +loadcore_IMPORTS_start +I_RegisterLibraryEntries +I_ReleaseLibraryEntries +loadcore_IMPORTS_end + +thbase_IMPORTS_start +I_DelayThread +thbase_IMPORTS_end + +thsemap_IMPORTS_start +I_CreateSema +I_DeleteSema +I_SignalSema +I_WaitSema +thsemap_IMPORTS_end + +sysclib_IMPORTS_start +I_look_ctype_table +I_memcpy +I_memset +I_sprintf +I_strcat +I_strchr +I_strcmp +I_strcpy +I_index +I_strlen +I_strncmp +I_strtol +sysclib_IMPORTS_end + +iomanX_IMPORTS_start +I_iomanX_open +I_iomanX_close +I_iomanX_read +I_iomanX_write +I_iomanX_lseek +I_iomanX_remove +I_iomanX_mkdir +I_iomanX_rmdir +I_iomanX_dopen +I_iomanX_dclose +I_iomanX_dread +I_iomanX_getstat +I_iomanX_chstat +I_iomanX_rename +I_iomanX_sync +I_iomanX_devctl +iomanX_IMPORTS_end + +stdio_IMPORTS_start +I_printf +stdio_IMPORTS_end + +cdvdman_IMPORTS_start +I_sceCdRI +cdvdman_IMPORTS_end diff --git a/iop/network/netcnf/src/irx_imports.h b/iop/network/netcnf/src/irx_imports.h new file mode 100644 index 000000000000..1e9aa385289b --- /dev/null +++ b/iop/network/netcnf/src/irx_imports.h @@ -0,0 +1,29 @@ +/* +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. +# +# Defines all IRX imports. +*/ + +#ifndef IOP_IRX_IMPORTS_H +#define IOP_IRX_IMPORTS_H + +#include + +/* Please keep these in alphabetical order! */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* IOP_IRX_IMPORTS_H */ diff --git a/iop/network/netcnf/src/netcnf.c b/iop/network/netcnf/src/netcnf.c new file mode 100644 index 000000000000..cf81268ad17f --- /dev/null +++ b/iop/network/netcnf/src/netcnf.c @@ -0,0 +1,4980 @@ +/* +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. +*/ + +#ifdef _IOP +#include "irx_imports.h" +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef intptr_t siptr; +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uintptr_t uiptr; +#define iomanX_rename(old, new) rename(old, new) +#define iomanX_sync(...) 0 +typedef struct +{ + unsigned int mode; + unsigned int attr; + unsigned int size; + unsigned char ctime[8]; + unsigned char atime[8]; + unsigned char mtime[8]; + unsigned int hisize; + unsigned int private_0; + unsigned int private_1; + unsigned int private_2; + unsigned int private_3; + unsigned int private_4; + unsigned int private_5; +} iox_stat_t; +typedef struct +{ + iox_stat_t stat; + char name[256]; + void *privdata; +} iox_dirent_t; +#endif +#include +#include + +#ifdef _IOP +IRX_ID("NET_configuration", 2, 30); +#endif +// Based on the module from SCE SDK 3.1.0. + +struct netcnf_callback_handle_info +{ + int m_fd; + char m_device[16]; + char m_pathname[256]; + void *m_buf; + int m_filesize; + int m_bufpos; + int m_allocstate; +}; + +struct netcnf_option +{ + int m_type; + int m_offset; + const char *m_key; +}; + +static void do_init_xor_magic(const char *in_id_buf); +static int magic_shift_write_netcnf_2(int inshft, int buflen); +static int magic_shift_read_netcnf_2(int inshft, int buflen); +static int magic_shift_write_netcnf_1(int inshft, int buflen); +static int magic_shift_read_netcnf_1(int inshft, int buflen); +static int do_check_capacity_inner(const char *fpath); +static int do_get_count_list_inner(const char *fname, int type, sceNetCnfList_t *p); +static int do_load_entry_inner(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e); +static int do_add_entry_inner( + const char *fname, + int type, + const char *usr_name, + sceNetCnfEnv_t *e, + const char *icon_value, + const char *iconsys_value, + int no_check_capacity); +static int do_edit_entry_inner( + const char *fname, + int type, + const char *usr_name, + const char *new_usr_name, + sceNetCnfEnv_t *e, + const char *icon_value, + const char *iconsys_value, + int no_check_capacity); +static int do_delete_entry_inner( + const char *fname, + int type, + const char *usr_name, + const char *icon_value, + const char *iconsys_value, + int no_check_capacity); +static int do_set_latest_entry_inner(const char *fname, int type, const char *usr_name); +static int do_delete_all_inner(const char *dev); +static int do_check_special_provider_inner(const char *fname, int type, const char *usr_name, sceNetCnfEnv_t *e); +static char *do_alloc_mem_inner(sceNetCnfEnv_t *e, unsigned int size, int align); +static void do_init_ifc_inner(sceNetCnfInterface_t *ifc); +static int do_merge_conf_inner(sceNetCnfEnv_t *e); +static int do_load_conf_inner(sceNetCnfEnv_t *e); +static int do_load_dial_inner(sceNetCnfEnv_t *e, sceNetCnfPair_t *pair); +static int do_export_netcnf(sceNetCnfEnv_t *e); +static void do_address_to_string_inner(char *dst, unsigned int srcint); +static int do_name_2_address_inner(unsigned int *dst, const char *buf); +static int do_conv_a2s_inner(char *sp_, char *dp_, int len); +static int do_conv_s2a_inner(char *sp_, char *dp_, int len); +static int do_read_check_netcnf(const char *netcnf_path, int type, int no_check_magic, int no_decode); +static int do_check_provider_inner(const sceNetCnfEnv_t *e, int type); +static const char *do_handle_netcnf_dirname(const char *fpath, const char *entry_buffer, char *netcnf_file_path); +static int do_open_netcnf(const char *netcnf_path, int file_flags, int file_mode); +static int do_readfile_netcnf(int fd, void *ptr, int size); +static int do_write_netcnf_no_encode(int fd, void *ptr, int size); +static int do_dopen_wrap(const char *fn); +static int do_dread_wrap(int fn, iox_dirent_t *buf); +static int do_remove_wrap(const char *fn); +static void do_close_netcnf(int fd); +static void do_dclose_wrap(int fd); +static int do_filesize_netcnf(int fd); +static void do_getstat_wrap(const char *fn, iox_stat_t *stx); +static void do_chstat_mode_copyprotect_wrap(const char *fn); +static void do_set_callback_inner(sceNetCnfCallback_t *pcallback); +#ifdef _IOP +static int do_init_heap(void); +#endif +static void *do_alloc_heapmem(int nbytes); +static void do_free_heapmem(void *ptr); +#ifdef _IOP +static void do_delete_heap(void); +#endif + +#ifdef _IOP +extern struct irx_export_table _exp_netcnf; +#endif +// Unofficial: move to bss +static int g_no_check_capacity; +// Unofficial: move to bss +static int g_no_check_provider; +// Unofficial: move to bss +static u32 g_id_result; +// Unofficial: move to bss +static char *g_count_list_heapptr; +// Unofficial: move to bss +static char *g_load_entry_heapptr; +// Unofficial: move to bss +static char *g_add_entry_heapptr; +// Unofficial: move to bss +static char *g_edit_entry_heapptr; +// Unofficial: move to bss +static char *g_delete_entry_heapptr; +// Unofficial: move to bss +static char *g_set_latest_entry_heapptr; +// Unofficial: move to bss +static char *g_check_special_provider_heapptr; +static const struct netcnf_option g_options_net_cnf[] = { + {112, 12, "chat_additional"}, + {52, 16, "redial_count"}, + {52, 20, "redial_interval"}, + {112, 24, "outside_number"}, + {112, 28, "outside_delay"}, + {68, 32, "dialing_type"}, + {0, 0, NULL}}; +static const struct netcnf_option g_options_attach_cnf[] = { + {84, 0, "type"}, + {112, 4, "vendor"}, + {112, 8, "product"}, + {112, 12, "location"}, + {98, 16, "dhcp"}, + {112, 20, "dhcp_host_name"}, + {98, 24, "dhcp_host_name_null_terminated"}, + {98, 25, "dhcp_release_on_stop"}, + {112, 28, "address"}, + {112, 32, "netmask"}, + {112, 36, "chat_additional"}, + {52, 40, "redial_count"}, + {52, 44, "redial_interval"}, + {112, 48, "outside_number"}, + {112, 52, "outside_delay"}, + {98, 96, "answer_mode"}, + {52, 100, "answer_timeout"}, + {68, 104, "dialing_type"}, + {112, 108, "chat_login"}, + {112, 112, "auth_name"}, + {112, 116, "auth_key"}, + {112, 120, "peer_name"}, + {112, 124, "peer_key"}, + {52, 128, "lcp_timeout"}, + {52, 132, "ipcp_timeout"}, + {52, 136, "idle_timeout"}, + {52, 140, "connect_timeout"}, + {98, 144, "want.mru_nego"}, + {98, 145, "want.accm_nego"}, + {98, 146, "want.magic_nego"}, + {98, 147, "want.prc_nego"}, + {98, 148, "want.acc_nego"}, + {98, 149, "want.address_nego"}, + {98, 150, "want.vjcomp_nego"}, + {98, 151, "want.dns1_nego"}, + {98, 152, "want.dns2_nego"}, + {77, 160, "want.mru"}, + {67, 164, "want.accm"}, + {65, 168, "want.auth"}, + {112, 172, "want.ip_address"}, + {112, 176, "want.ip_mask"}, + {112, 180, "want.dns1"}, + {112, 184, "want.dns2"}, + {98, 220, "allow.mru_nego"}, + {98, 221, "allow.accm_nego"}, + {98, 222, "allow.magic_nego"}, + {98, 223, "allow.prc_nego"}, + {98, 224, "allow.acc_nego"}, + {98, 225, "allow.address_nego"}, + {98, 226, "allow.vjcomp_nego"}, + {98, 227, "allow.dns1_nego"}, + {98, 228, "allow.dns2_nego"}, + {77, 236, "allow.mru"}, + {67, 240, "allow.accm"}, + {65, 244, "allow.auth"}, + {112, 248, "allow.ip_address"}, + {112, 252, "allow.ip_mask"}, + {112, 256, "allow.dns1"}, + {112, 260, "allow.dns2"}, + {76, 296, "log_flags"}, + {99, 300, "force_chap_type"}, + {98, 301, "omit_empty_frame"}, + {80, 332, "phy_config"}, + {98, 302, "pppoe"}, + {98, 303, "pppoe_host_uniq_auto"}, + {112, 308, "pppoe_service_name"}, + {112, 312, "pppoe_ac_name"}, + {52, 316, "mtu"}, + {49, 324, "auth_timeout"}, + {49, 321, "lcp_max_terminate"}, + {49, 323, "ipcp_max_terminate"}, + {49, 320, "lcp_max_configure"}, + {49, 322, "ipcp_max_configure"}, + {49, 325, "auth_max_failure"}, + {0, 0, NULL}}; +static const struct netcnf_option g_options_dial_cnf[] = { + {112, 12, "chat_init"}, {112, 16, "chat_dial"}, {112, 20, "chat_answer"}, {112, 24, "redial_string"}, {0, 0, NULL}}; +static int g_callbacks_set; +#ifdef _IOP +// Unofficial: move to bss +static void *g_netcnf_heap; +static int g_semid; +#endif +static char g_icon_value[0x100]; +static char g_iconsys_value[0x100]; +static char g_id_xorbuf[24]; +static char g_id_buffer[8]; +static char g_ifc_buffer[0x3e8]; +static char g_arg_fname[0x400]; +static char g_entry_buffer[0x400]; +static char g_netcnf_file_path[0x100]; +static char g_dir_name[0x100]; +static char g_combination_buf1[0x100]; +static char g_combination_buf2[0x100]; +static char *g_read_check_netcnf_heapptr; +static sceNetCnfCallback_t g_callbacks; +static struct netcnf_callback_handle_info g_callback_handle_infos[4]; +static int g_open_callback_handle_count; + +static int get_check_provider_eq_zero(void) +{ + return !g_no_check_provider; +} + +#ifdef _IOP +static void do_print_usage(void) +{ + printf("Usage: netcnf [