PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
include/psp2/net/net.h
Go to the documentation of this file.
00001 
00011 #ifndef _PSP2_NET_NET_H_
00012 #define _PSP2_NET_NET_H_
00013 
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00019 enum {
00020     PSP2_NET_ERROR_EPERM                    = 0x80410101,
00021     PSP2_NET_ERROR_ENOENT                   = 0x80410102,
00022     PSP2_NET_ERROR_ESRCH                    = 0x80410103,
00023     PSP2_NET_ERROR_EINTR                    = 0x80410104,
00024     PSP2_NET_ERROR_EIO                      = 0x80410105,
00025     PSP2_NET_ERROR_ENXIO                    = 0x80410106,
00026     PSP2_NET_ERROR_E2BIG                    = 0x80410107,
00027     PSP2_NET_ERROR_ENOEXEC                  = 0x80410108,
00028     PSP2_NET_ERROR_EBADF                    = 0x80410109,
00029     PSP2_NET_ERROR_ECHILD                   = 0x8041010A,
00030     PSP2_NET_ERROR_EDEADLK                  = 0x8041010B,
00031     PSP2_NET_ERROR_ENOMEM                   = 0x8041010C,
00032     PSP2_NET_ERROR_EACCES                   = 0x8041010D,
00033     PSP2_NET_ERROR_EFAULT                   = 0x8041010E,
00034     PSP2_NET_ERROR_ENOTBLK                  = 0x8041010F,
00035     PSP2_NET_ERROR_EBUSY                    = 0x80410110,
00036     PSP2_NET_ERROR_EEXIST                   = 0x80410111,
00037     PSP2_NET_ERROR_EXDEV                    = 0x80410112,
00038     PSP2_NET_ERROR_ENODEV                   = 0x80410113,
00039     PSP2_NET_ERROR_ENOTDIR                  = 0x80410114,
00040     PSP2_NET_ERROR_EISDIR                   = 0x80410115,
00041     PSP2_NET_ERROR_EINVAL                   = 0x80410116,
00042     PSP2_NET_ERROR_ENFILE                   = 0x80410117,
00043     PSP2_NET_ERROR_EMFILE                   = 0x80410118,
00044     PSP2_NET_ERROR_ENOTTY                   = 0x80410119,
00045     PSP2_NET_ERROR_ETXTBSY                  = 0x8041011A,
00046     PSP2_NET_ERROR_EFBIG                    = 0x8041011B,
00047     PSP2_NET_ERROR_ENOSPC                   = 0x8041011C,
00048     PSP2_NET_ERROR_ESPIPE                   = 0x8041011D,
00049     PSP2_NET_ERROR_EROFS                    = 0x8041011E,
00050     PSP2_NET_ERROR_EMLINK                   = 0x8041011F,
00051     PSP2_NET_ERROR_EPIPE                    = 0x80410120,
00052     PSP2_NET_ERROR_EDOM                     = 0x80410121,
00053     PSP2_NET_ERROR_ERANGE                   = 0x80410122,
00054     PSP2_NET_ERROR_EAGAIN                   = 0x80410123,
00055     PSP2_NET_ERROR_EWOULDBLOCK              = 0x80410123,
00056     PSP2_NET_ERROR_EINPROGRESS              = 0x80410124,
00057     PSP2_NET_ERROR_EALREADY                 = 0x80410125,
00058     PSP2_NET_ERROR_ENOTSOCK                 = 0x80410126,
00059     PSP2_NET_ERROR_EDESTADDRREQ             = 0x80410127,
00060     PSP2_NET_ERROR_EMSGSIZE                 = 0x80410128,
00061     PSP2_NET_ERROR_EPROTOTYPE               = 0x80410129,
00062     PSP2_NET_ERROR_ENOPROTOOPT              = 0x8041012A,
00063     PSP2_NET_ERROR_EPROTONOSUPPORT          = 0x8041012B,
00064     PSP2_NET_ERROR_ESOCKTNOSUPPOR           = 0x8041012C,
00065     PSP2_NET_ERROR_EOPNOTSUPP               = 0x8041012D,
00066     PSP2_NET_ERROR_EPFNOSUPPORT             = 0x8041012E,
00067     PSP2_NET_ERROR_EAFNOSUPPORT             = 0x8041012F,
00068     PSP2_NET_ERROR_EADDRINUSE               = 0x80410130,
00069     PSP2_NET_ERROR_EADDRNOTAVAIL            = 0x80410131,
00070     PSP2_NET_ERROR_ENETDOWN                 = 0x80410132,
00071     PSP2_NET_ERROR_ENETUNREACH              = 0x80410133,
00072     PSP2_NET_ERROR_ENETRESET                = 0x80410134,
00073     PSP2_NET_ERROR_ECONNABORTED             = 0x80410135,
00074     PSP2_NET_ERROR_ECONNRESET               = 0x80410136,
00075     PSP2_NET_ERROR_ENOBUFS                  = 0x80410137,
00076     PSP2_NET_ERROR_EISCONN                  = 0x80410138,
00077     PSP2_NET_ERROR_ENOTCONN                 = 0x80410139,
00078     PSP2_NET_ERROR_ESHUTDOWN                = 0x8041013A,
00079     PSP2_NET_ERROR_ETOOMANYREFS             = 0x8041013B,
00080     PSP2_NET_ERROR_ETIMEDOUT                = 0x8041013C,
00081     PSP2_NET_ERROR_ECONNREFUSED             = 0x8041013D,
00082     PSP2_NET_ERROR_ELOOP                    = 0x8041013E,
00083     PSP2_NET_ERROR_ENAMETOOLONG             = 0x8041013F,
00084     PSP2_NET_ERROR_EHOSTDOWN                = 0x80410140,
00085     PSP2_NET_ERROR_EHOSTUNREACH             = 0x80410141,
00086     PSP2_NET_ERROR_ENOTEMPTY                = 0x80410142,
00087     PSP2_NET_ERROR_EPROCLIM                 = 0x80410143,
00088     PSP2_NET_ERROR_EUSERS                   = 0x80410144,
00089     PSP2_NET_ERROR_EDQUOT                   = 0x80410145,
00090     PSP2_NET_ERROR_ESTALE                   = 0x80410146,
00091     PSP2_NET_ERROR_EREMOTE                  = 0x80410147,
00092     PSP2_NET_ERROR_EBADRPC                  = 0x80410148,
00093     PSP2_NET_ERROR_ERPCMISMATCH             = 0x80410149,
00094     PSP2_NET_ERROR_EPROGUNAVAIL             = 0x8041014A,
00095     PSP2_NET_ERROR_EPROGMISMATCH            = 0x8041014B,
00096     PSP2_NET_ERROR_EPROCUNAVAIL             = 0x8041014C,
00097     PSP2_NET_ERROR_ENOLCK                   = 0x8041014D,
00098     PSP2_NET_ERROR_ENOSYS                   = 0x8041014E,
00099     PSP2_NET_ERROR_EFTYPE                   = 0x8041014F,
00100     PSP2_NET_ERROR_EAUTH                    = 0x80410150,
00101     PSP2_NET_ERROR_ENEEDAUTH                = 0x80410151,
00102     PSP2_NET_ERROR_EIDRM                    = 0x80410152,
00103     PSP2_NET_ERROR_ENOMS                    = 0x80410153,
00104     PSP2_NET_ERROR_EOVERFLOW                = 0x80410154,
00105     PSP2_NET_ERROR_EILSEQ                   = 0x80410155,
00106     PSP2_NET_ERROR_ENOTSUP                  = 0x80410156,
00107     PSP2_NET_ERROR_ECANCELED                = 0x80410157,
00108     PSP2_NET_ERROR_EBADMSG                  = 0x80410158,
00109     PSP2_NET_ERROR_ENODATA                  = 0x80410159,
00110     PSP2_NET_ERROR_ENOSR                    = 0x8041015A,
00111     PSP2_NET_ERROR_ENOSTR                   = 0x8041015B,
00112     PSP2_NET_ERROR_ETIME                    = 0x8041015C,
00113     PSP2_NET_ERROR_EADHOC                   = 0x804101A0,
00114     PSP2_NET_ERROR_EDISABLEDIF              = 0x804101A1,
00115     PSP2_NET_ERROR_ERESUME                  = 0x804101A2,
00116     PSP2_NET_ERROR_ENOTINIT                 = 0x804101C8,
00117     PSP2_NET_ERROR_ENOLIBMEM                = 0x804101C9,
00118     PSP2_NET_ERROR_ERESERVED202             = 0x804101CA,
00119     PSP2_NET_ERROR_ECALLBACK                = 0x804101CB,
00120     PSP2_NET_ERROR_EINTERNAL                = 0x804101CC,
00121     PSP2_NET_ERROR_ERETURN                  = 0x804101CD,
00122     PSP2_NET_ERROR_RESOLVER_EINTERNAL       = 0x804101DC,
00123     PSP2_NET_ERROR_RESOLVER_EBUSY           = 0x804101DD,
00124     PSP2_NET_ERROR_RESOLVER_ENOSPACE        = 0x804101DE,
00125     PSP2_NET_ERROR_RESOLVER_EPACKET         = 0x804101DF,
00126     PSP2_NET_ERROR_RESOLVER_ERESERVED22     = 0x804101E0,
00127     PSP2_NET_ERROR_RESOLVER_ENODNS          = 0x804101E1,
00128     PSP2_NET_ERROR_RESOLVER_ETIMEDOUT       = 0x804101E2,
00129     PSP2_NET_ERROR_RESOLVER_ENOSUPPORT      = 0x804101E3,
00130     PSP2_NET_ERROR_RESOLVER_EFORMAT         = 0x804101E4,
00131     PSP2_NET_ERROR_RESOLVER_ESERVERFAILURE  = 0x804101E5,
00132     PSP2_NET_ERROR_RESOLVER_ENOHOST         = 0x804101E6,
00133     PSP2_NET_ERROR_RESOLVER_ENOTIMPLEMENTED = 0x804101E7,
00134     PSP2_NET_ERROR_RESOLVER_ESERVERREFUSED  = 0x804101E8,
00135     PSP2_NET_ERROR_RESOLVER_ENORECORD       = 0x804101E9,
00136     PSP2_NET_ERROR_RESOLVER_EALIGNMENT      = 0x804101EA
00137 };
00138 
00140 enum {
00141     PSP2_NET_EPERM              = 1,
00142     PSP2_NET_ENOENT             = 2,
00143     PSP2_NET_ESRCH              = 3,
00144     PSP2_NET_EINTR              = 4,
00145     PSP2_NET_EIO                = 5,
00146     PSP2_NET_ENXIO              = 6,
00147     PSP2_NET_E2BIG              = 7,
00148     PSP2_NET_ENOEXEC            = 8,
00149     PSP2_NET_EBADF              = 9,
00150     PSP2_NET_ECHILD             = 10,
00151     PSP2_NET_EDEADLK            = 11,
00152     PSP2_NET_ENOMEM             = 12,
00153     PSP2_NET_EACCES             = 13,
00154     PSP2_NET_EFAULT             = 14,
00155     PSP2_NET_ENOTBLK            = 15,
00156     PSP2_NET_EBUSY              = 16,
00157     PSP2_NET_EEXIST             = 17,
00158     PSP2_NET_EXDEV              = 18,
00159     PSP2_NET_ENODEV             = 19,
00160     PSP2_NET_ENOTDIR            = 20,
00161     PSP2_NET_EISDIR             = 21,
00162     PSP2_NET_EINVAL             = 22,
00163     PSP2_NET_ENFILE             = 23,
00164     PSP2_NET_EMFILE             = 24,
00165     PSP2_NET_ENOTTY             = 25,
00166     PSP2_NET_ETXTBSY            = 26,
00167     PSP2_NET_EFBIG              = 27,
00168     PSP2_NET_ENOSPC             = 28,
00169     PSP2_NET_ESPIPE             = 29,
00170     PSP2_NET_EROFS              = 30,
00171     PSP2_NET_EMLINK             = 31,
00172     PSP2_NET_EPIPE              = 32,
00173     PSP2_NET_EDOM               = 33,
00174     PSP2_NET_ERANGE             = 34,
00175     PSP2_NET_EAGAIN             = 35,
00176     PSP2_NET_EWOULDBLOCK        = 35,
00177     PSP2_NET_EINPROGRESS        = 36,
00178     PSP2_NET_EALREADY           = 37,
00179     PSP2_NET_ENOTSOCK           = 38,
00180     PSP2_NET_EDESTADDRREQ       = 39,
00181     PSP2_NET_EMSGSIZE           = 40,
00182     PSP2_NET_EPROTOTYPE         = 41,
00183     PSP2_NET_ENOPROTOOPT        = 42,
00184     PSP2_NET_EPROTONOSUPPORT    = 43,
00185     PSP2_NET_ESOCKTNOSUPPORT    = 44,
00186     PSP2_NET_EOPNOTSUPP         = 45,
00187     PSP2_NET_EPFNOSUPPORT       = 46,
00188     PSP2_NET_EAFNOSUPPORT       = 47,
00189     PSP2_NET_EADDRINUSE         = 48,
00190     PSP2_NET_EADDRNOTAVAIL      = 49,
00191     PSP2_NET_ENETDOWN           = 50,
00192     PSP2_NET_ENETUNREACH        = 51,
00193     PSP2_NET_ENETRESET          = 52,
00194     PSP2_NET_ECONNABORTED       = 53,
00195     PSP2_NET_ECONNRESET         = 54,
00196     PSP2_NET_ENOBUFS            = 55,
00197     PSP2_NET_EISCONN            = 56,
00198     PSP2_NET_ENOTCONN           = 57,
00199     PSP2_NET_ESHUTDOWN          = 58,
00200     PSP2_NET_ETOOMANYREFS       = 59,
00201     PSP2_NET_ETIMEDOUT          = 60,
00202     PSP2_NET_ECONNREFUSED       = 61,
00203     PSP2_NET_ELOOP              = 62,
00204     PSP2_NET_ENAMETOOLONG       = 63,
00205     PSP2_NET_EHOSTDOWN          = 64,
00206     PSP2_NET_EHOSTUNREACH       = 65,
00207     PSP2_NET_ENOTEMPTY          = 66,
00208     PSP2_NET_EPROCLIM           = 67,
00209     PSP2_NET_EUSERS             = 68,
00210     PSP2_NET_EDQUOT             = 69,
00211     PSP2_NET_ESTALE             = 70,
00212     PSP2_NET_EREMOTE            = 71,
00213     PSP2_NET_EBADRPC            = 72,
00214     PSP2_NET_ERPCMISMATCH       = 73,
00215     PSP2_NET_EPROGUNAVAIL       = 74,
00216     PSP2_NET_EPROGMISMATCH      = 75,
00217     PSP2_NET_EPROCUNAVAIL       = 76,
00218     PSP2_NET_ENOLCK             = 77,
00219     PSP2_NET_ENOSYS             = 78,
00220     PSP2_NET_EFTYPE             = 79,
00221     PSP2_NET_EAUTH              = 80,
00222     PSP2_NET_ENEEDAUTH          = 81,
00223     PSP2_NET_EIDRM              = 82,
00224     PSP2_NET_ENOMSG             = 83,
00225     PSP2_NET_EOVERFLOW          = 84,
00226     PSP2_NET_EILSEQ             = 85,
00227     PSP2_NET_ENOTSUP            = 86,
00228     PSP2_NET_ECANCELED          = 87,
00229     PSP2_NET_EBADMSG            = 88,
00230     PSP2_NET_ENODATA            = 89,
00231     PSP2_NET_ENOSR              = 90,
00232     PSP2_NET_ENOSTR             = 91,
00233     PSP2_NET_ETIME              = 92,
00234     PSP2_NET_EADHOC             = 160,
00235     PSP2_NET_EDISABLEDIF        = 161,
00236     PSP2_NET_ERESUME            = 162
00237 };
00238 
00239 
00241 enum {
00242     PSP2_NET_ENOTINIT   = 200,
00243     PSP2_NET_ENOLIBMEM,
00244     PSP2_NET_ETLS,
00245     PSP2_NET_ECALLBACK,
00246     PSP2_NET_EINTERNAL,
00247     PSP2_NET_ERETURN
00248 };
00249 
00251 enum {
00252     PSP2_NET_RESOLVER_EINTERNAL = 220,
00253     PSP2_NET_RESOLVER_EBUSY,
00254     PSP2_NET_RESOLVER_ENOSPACE,
00255     PSP2_NET_RESOLVER_EPACKET,
00256     PSP2_NET_RESOLVER_ERESERVED224,
00257     PSP2_NET_RESOLVER_ENODNS,
00258     PSP2_NET_RESOLVER_ETIMEDOUT,
00259     PSP2_NET_RESOLVER_ENOSUPPORT,
00260     PSP2_NET_RESOLVER_EFORMAT,
00261     PSP2_NET_RESOLVER_ESERVERFAILURE,
00262     PSP2_NET_RESOLVER_ENOHOST,
00263     PSP2_NET_RESOLVER_ENOTIMPLEMENTED,
00264     PSP2_NET_RESOLVER_ESERVERREFUSED,
00265     PSP2_NET_RESOLVER_ENORECORD,
00266     PSP2_NET_RESOLVER_EALIGNMENT
00267 };
00268 
00270 enum {
00271     PSP2_NET_DUMP_PEEK                      = 0x00000010,
00272     PSP2_NET_DUMP_DONTWAIT                  = 0x00000020,
00273     PSP2_NET_DUMP_OVERFLOW                  = 0x00000040,
00274     PSP2_NET_DUMP_ABORT_FLAG_PRESERVATION   = 0x00000001
00275 };
00276 
00278 enum {
00279     PSP2_NET_EPOLLIN        = 0x00000001,
00280     PSP2_NET_EPOLLOUT       = 0x00000002,
00281     PSP2_NET_EPOLLERR       = 0x00000008,
00282     PSP2_NET_EPOLLHUP       = 0x00000010,
00283     PSP2_NET_EPOLLDESCID    = 0x00010000
00284 };
00285 
00287 enum {
00288     PSP2_NET_EPOLL_CTL_ADD = 1,
00289     PSP2_NET_EPOLL_CTL_MOD,
00290     PSP2_NET_EPOLL_CTL_DEL
00291 };
00292 
00294 enum {
00295     PSP2_NET_SOCKINFO_STATE_UNKNOWN,
00296     PSP2_NET_SOCKINFO_STATE_CLOSED,
00297     PSP2_NET_SOCKINFO_STATE_OPENED,
00298     PSP2_NET_SOCKINFO_STATE_LISTEN,
00299     PSP2_NET_SOCKINFO_STATE_SYN_SENT,
00300     PSP2_NET_SOCKINFO_STATE_SYN_RECEIVED,
00301     PSP2_NET_SOCKINFO_STATE_ESTABLISHED,
00302     PSP2_NET_SOCKINFO_STATE_FIN_WAIT_1,
00303     PSP2_NET_SOCKINFO_STATE_FIN_WAIT_2,
00304     PSP2_NET_SOCKINFO_STATE_CLOSE_WAIT,
00305     PSP2_NET_SOCKINFO_STATE_CLOSING,
00306     PSP2_NET_SOCKINFO_STATE_LAST_ACK,
00307     PSP2_NET_SOCKINFO_STATE_TIME_WAIT
00308 };
00309 
00311 enum {
00312     PSP2_NET_SOCKINFO_F_SELF            = 0x00000001,
00313     PSP2_NET_SOCKINFO_F_KERNEL          = 0x00000002,
00314     PSP2_NET_SOCKINFO_F_OTHERS          = 0x00000004,
00315     PSP2_NET_SOCKINFO_F_RECV_WAIT       = 0x00010000,
00316     PSP2_NET_SOCKINFO_F_SEND_WAIT       = 0x00020000,
00317     PSP2_NET_SOCKINFO_F_RECV_EWAIT      = 0x00040000,
00318     PSP2_NET_SOCKINFO_F_SEND_EWAIT      = 0x00080000,
00319     PSP2_NET_SOCKINFO_F_WAKEUP_SIGNAL   = 0x00100000,
00320     PSP2_NET_SOCKINFO_F_ALL             = 0x001F0007
00321 };
00322 
00324 enum {
00325     PSP2_NET_EMULATION_FLAG_ETH0    = 1,
00326     PSP2_NET_EMULATION_FLAG_WLAN0
00327 };
00328 
00330 enum {
00331     PSP2_NET_RESOLVER_ASYNC                         = 0x00000001,
00332     PSP2_NET_RESOLVER_START_NTOA_DISABLE_IPADDRESS  = 0x00010000
00333 };
00334 
00336 enum {
00337     PSP2_NET_RESOLVER_ABORT_FLAG_NTOA_PRESERVATION  = 0x00000001,
00338     PSP2_NET_RESOLVER_ABORT_FLAG_ATON_PRESERVATION  = 0x00000002
00339 };
00340 
00342 enum {
00343     PSP2_NET_SOCKET_ABORT_FLAG_RCV_PRESERVATION = 0x00000001,
00344     PSP2_NET_SOCKET_ABORT_FLAG_SND_PRESERVATION = 0x00000002
00345 };
00346 
00348 enum {
00349     PSP2_NET_IPPROTO_IP     = 0,
00350     PSP2_NET_IPPROTO_ICMP   = 1,
00351     PSP2_NET_IPPROTO_IGMP   = 2,
00352     PSP2_NET_IPPROTO_TCP    = 6,
00353     PSP2_NET_IPPROTO_UDP    = 17,
00354     PSP2_NET_SOL_SOCKET     = 0xffff
00355 };
00356 
00358 enum {
00359     /* IP */
00360     PSP2_NET_IP_HDRINCL             = 2,
00361     PSP2_NET_IP_TOS                 = 3,
00362     PSP2_NET_IP_TTL                 = 4,
00363     PSP2_NET_IP_MULTICAST_IF        = 9,
00364     PSP2_NET_IP_MULTICAST_TTL       = 10,
00365     PSP2_NET_IP_MULTICAST_LOOP      = 11,
00366     PSP2_NET_IP_ADD_MEMBERSHIP      = 12,
00367     PSP2_NET_IP_DROP_MEMBERSHIP     = 13,
00368     PSP2_NET_IP_TTLCHK              = 23,
00369     PSP2_NET_IP_MAXTTL              = 24,
00370     /* TCP */
00371     PSP2_NET_TCP_NODELAY            = 1,
00372     PSP2_NET_TCP_MAXSEG             = 2,
00373     PSP2_NET_TCP_MSS_TO_ADVERTISE   = 3,
00374     /* SOCKET */
00375     PSP2_NET_SO_REUSEADDR           = 0x00000004,
00376     PSP2_NET_SO_KEEPALIVE           = 0x00000008,
00377     PSP2_NET_SO_BROADCAST           = 0x00000020,
00378     PSP2_NET_SO_LINGER              = 0x00000080,
00379     PSP2_NET_SO_OOBINLINE           = 0x00000100,
00380     PSP2_NET_SO_REUSEPORT           = 0x00000200,
00381     PSP2_NET_SO_ONESBCAST           = 0x00000800,
00382     PSP2_NET_SO_USECRYPTO           = 0x00001000,
00383     PSP2_NET_SO_USESIGNATURE        = 0x00002000,
00384     PSP2_NET_SO_SNDBUF              = 0x1001,
00385     PSP2_NET_SO_RCVBUF              = 0x1002,
00386     PSP2_NET_SO_SNDLOWAT            = 0x1003,
00387     PSP2_NET_SO_RCVLOWAT            = 0x1004,
00388     PSP2_NET_SO_SNDTIMEO            = 0x1005,
00389     PSP2_NET_SO_RCVTIMEO            = 0x1006,
00390     PSP2_NET_SO_ERROR               = 0x1007,
00391     PSP2_NET_SO_TYPE                = 0x1008,
00392     PSP2_NET_SO_NBIO                = 0x1100,
00393     PSP2_NET_SO_TPPOLICY            = 0x1101,
00394     PSP2_NET_SO_NAME                = 0x1102
00395 };
00396 
00398 enum {
00399     PSP2_NET_SOCK_STREAM        = 1,
00400     PSP2_NET_SOCK_DGRAM         = 2,
00401     PSP2_NET_SOCK_RAW           = 3,
00402     PSP2_NET_SOCK_DGRAM_P2P     = 6,
00403     PSP2_NET_SOCK_STREAM_P2P    = 10
00404 };
00405 
00407 enum {
00408     PSP2_NET_MSG_PEEK           = 0x00000002,
00409     PSP2_NET_MSG_WAITALL        = 0x00000040,
00410     PSP2_NET_MSG_DONTWAIT       = 0x00000080,
00411     PSP2_NET_MSG_USECRYPTO      = 0x00000400,
00412     PSP2_NET_MSG_USESIGNATURE   = 0x00000800
00413 };
00414 
00416 enum {
00417     PSP2_NET_SHUT_RD,
00418     PSP2_NET_SHUT_WR,
00419     PSP2_NET_SHUT_RDWR
00420 };
00421 
00423 enum {
00424     PSP2_NET_ICMP_TYPE_ECHO_REPLY           = 0,
00425     PSP2_NET_ICMP_TYPE_DEST_UNREACH         = 3,
00426     PSP2_NET_ICMP_TYPE_SOURCE_QUENCH        = 4,
00427     PSP2_NET_ICMP_TYPE_REDIRECT             = 5,
00428     PSP2_NET_ICMP_TYPE_ECHO_REQUEST         = 8,
00429     PSP2_NET_ICMP_TYPE_TIME_EXCEEDED        = 11,
00430     PSP2_NET_ICMP_TYPE_PARAMETER_PROBLEM    = 12,
00431     PSP2_NET_ICMP_TYPE_TIMESTAMP_REQUEST    = 13,
00432     PSP2_NET_ICMP_TYPE_TIMESTAMP_REPLY      = 14,
00433     PSP2_NET_ICMP_TYPE_INFORMATION_REQUEST  = 15,
00434     PSP2_NET_ICMP_TYPE_INFORMATION_REPLY    = 16,
00435     PSP2_NET_ICMP_TYPE_ADDRESS_MASK_REQUEST = 17,
00436     PSP2_NET_ICMP_TYPE_ADDRESS_MASK_REPLY   = 18
00437 };
00438 
00440 enum {
00441     PSP2_NET_ICMP_CODE_DEST_UNREACH_NET_UNREACH             = 0,
00442     PSP2_NET_ICMP_CODE_DEST_UNREACH_HOST_UNREACH            = 1,
00443     PSP2_NET_ICMP_CODE_DEST_UNREACH_PROTO_UNREACH           = 2,
00444     PSP2_NET_ICMP_CODE_DEST_UNREACH_PORT_UNREACH            = 3,
00445     PSP2_NET_ICMP_CODE_DEST_UNREACH_FRAG_AND_DF             = 4,
00446     PSP2_NET_ICMP_CODE_DEST_UNREACH_SRC_HOST_FAILED         = 5,
00447     PSP2_NET_ICMP_CODE_DEST_UNREACH_DST_NET_UNKNOWN         = 6,
00448     PSP2_NET_ICMP_CODE_DEST_UNREACH_DST_HOST_UNKNOWN        = 7,
00449     PSP2_NET_ICMP_CODE_DEST_UNREACH_SRC_HOST_ISOLATED       = 8,
00450     PSP2_NET_ICMP_CODE_DEST_UNREACH_NET_ADMIN_PROHIBITED    = 9,
00451     PSP2_NET_ICMP_CODE_DEST_UNREACH_NET_HOST_PROHIBITED     = 10,
00452     PSP2_NET_ICMP_CODE_DEST_UNREACH_NET_TOS                 = 11,
00453     PSP2_NET_ICMP_CODE_DEST_UNREACH_HOST_TOS                = 12,
00454     PSP2_NET_ICMP_CODE_TIME_EXCEEDED_TTL_EXCEEDED           = 0,
00455     PSP2_NET_ICMP_CODE_TIME_EXCEEDED_FRT_EXCEEDED           = 1
00456 };
00457 
00458 /* Defines */
00459 #define PSP2_NET_EPOLL_ABORT_FLAG_PRESERVATION   0x00000001
00460 
00461 #define PSP2_NET_IP_DEFAULT_MULTICAST_TTL   1
00462 #define PSP2_NET_IP_DEFAULT_MULTICAST_LOOP  1
00463 
00464 #define PSP2_NET_IPVERSION   4
00465 
00466 #define PSP2_NET_IP_RF       0x8000
00467 #define PSP2_NET_IP_DF       0x4000
00468 #define PSP2_NET_IP_MF       0x2000
00469 #define PSP2_NET_IP_OFFMASK  0x1fff
00470 
00471 #define PSP2_NET_INADDR_ANY           0x00000000
00472 #define PSP2_NET_INADDR_LOOPBACK      0x7f000001
00473 #define PSP2_NET_INADDR_BROADCAST     0xffffffff
00474 #define PSP2_NET_INADDR_UNSPEC_GROUP  0xe0000000
00475 #define PSP2_NET_INADDR_AUTOIP        0xa9fe0000
00476 
00477 #define PSP2_NET_IN_CLASSD_NET        0xf0000000
00478 #define PSP2_NET_IN_AUTOIP_NET        0xffff0000
00479 
00480 #define PSP2_NET_ADHOC_PORT            3658
00481 
00482 #define PSP2_NET_AF_INET               2
00483 
00484 #define PSP2_NET_DEBUG_NAME_LEN_MAX 31
00485 
00486 #define PSP2_NET_RESOLVER_PORT             53
00487 #define PSP2_NET_RESOLVER_HOSTNAME_LEN_MAX 255
00488 
00489 #define PSP2_NET_ID_SOCKET_MIN      0
00490 #define PSP2_NET_ID_SOCKET_MAX      1023
00491 
00492 /* callback */
00493 
00494 typedef void *(*SceNetResolverFunctionAllocate)(
00495     unsigned int size,
00496     int rid,
00497     const char *name,
00498     void *user);
00499 typedef void (*SceNetResolverFunctionFree)(
00500     void *ptr,
00501     int rid,
00502     const char *name,
00503     void *user);
00504 
00505 /* struct */
00506 
00507 typedef struct SceNetFdSet {
00508     unsigned int bits[32];
00509 } SceNetFdSet;
00510 
00511 typedef struct SceNetInAddr {
00512     unsigned int s_addr;
00513 } SceNetInAddr;
00514 
00515 typedef struct SceNetSockaddrIn {
00516     unsigned char sin_len;
00517     unsigned char sin_family;
00518     unsigned short int sin_port;
00519     SceNetInAddr sin_addr;
00520     unsigned short int sin_vport;
00521     char sin_zero[6];
00522 } SceNetSockaddrIn;
00523 
00524 typedef struct SceNetIpMreq {
00525     SceNetInAddr imr_multiaddr;
00526     SceNetInAddr imr_interface;
00527 } SceNetIpMreq;
00528 
00529 typedef struct SceNetInitParam {
00530     void *memory;
00531     int size;
00532     int flags;
00533 } SceNetInitParam;
00534 
00535 typedef struct SceNetEmulationData {
00536     unsigned short int drop_rate;
00537     unsigned short int drop_duration;
00538     unsigned short int pass_duration;
00539     unsigned short int delay_time;
00540     unsigned short int delay_jitter;
00541     unsigned short int order_rate;
00542     unsigned short int order_delay_time;
00543     unsigned short int duplication_rate;
00544     unsigned int bps_limit;
00545     unsigned short int lower_size_limit;
00546     unsigned short int upper_size_limit;
00547     unsigned int system_policy_pattern;
00548     unsigned int game_policy_pattern;
00549     unsigned short int policy_flags[64];
00550     unsigned char reserved[64];
00551 } SceNetEmulationData;
00552 
00553 typedef struct SceNetEmulationParam {
00554     unsigned short int version;
00555     unsigned short int option_number;
00556     unsigned short int current_version;
00557     unsigned short int result;
00558     unsigned int flags;
00559     unsigned int reserved1;
00560     SceNetEmulationData send;
00561     SceNetEmulationData recv;
00562     unsigned int seed;
00563     unsigned char reserved[44];
00564 } SceNetEmulationParam;
00565 
00566 typedef struct SceNetEtherAddr {
00567     unsigned char data[6];
00568 } SceNetEtherAddr;
00569 
00570 typedef struct SceNetDnsInfo {
00571     SceNetInAddr dns_addr[2];
00572 } SceNetDnsInfo;
00573 
00574 typedef struct SceNetEpollDataExt {
00575     int id;
00576     unsigned int u32;
00577 } SceNetEpollDataExt;
00578 
00579 typedef union SceNetEpollData {
00580     void *ptr;
00581     int fd;
00582     unsigned int u32;
00583     unsigned long long int u64;
00584     SceNetEpollDataExt ext;
00585 } SceNetEpollData;
00586 
00587 typedef struct SceNetEpollSystemData {
00588     unsigned int system[4];
00589 } SceNetEpollSystemData;
00590 
00591 typedef struct SceNetEpollEvent {
00592     unsigned int events;
00593     unsigned int reserved;
00594     SceNetEpollSystemData system;
00595     SceNetEpollData data;
00596 } SceNetEpollEvent;
00597 
00598 typedef struct SceNetResolverParam {
00599     SceNetResolverFunctionAllocate allocate;
00600     SceNetResolverFunctionFree free;
00601     void *user;
00602 } SceNetResolverParam;
00603 
00604 typedef struct SceNetLinger {
00605     int l_onoff;
00606     int l_linger;
00607 } SceNetLinger;
00608 
00609 typedef struct SceNetSockaddr {
00610     unsigned char sa_len;
00611     unsigned char sa_family;
00612     char sa_data[14];
00613 } SceNetSockaddr;
00614 
00615 typedef struct SceNetIovec {
00616     void *iov_base;
00617     unsigned int iov_len;
00618 } SceNetIovec;
00619 
00620 typedef struct SceNetMsghdr {
00621     void *msg_name;
00622     unsigned int msg_namelen;
00623     SceNetIovec *msg_iov;
00624     int msg_iovlen;
00625     void *msg_control;
00626     unsigned int msg_controllen;
00627     int msg_flags;
00628 } SceNetMsghdr;
00629 
00630 typedef struct SceNetSockInfo {
00631     char name[PSP2_NET_DEBUG_NAME_LEN_MAX + 1];
00632     int pid;
00633     int s;
00634     char socket_type;
00635     char policy;
00636     short int reserved16;
00637     int recv_queue_length;
00638     int send_queue_length;
00639     SceNetInAddr local_adr;
00640     SceNetInAddr remote_adr;
00641     unsigned short int local_port;
00642     unsigned short int remote_port;
00643     unsigned short int local_vport;
00644     unsigned short int remote_vport;
00645     int state;
00646     int flags;
00647     int reserved[8];
00648 } SceNetSockInfo;
00649 
00650 typedef struct SceNetStatisticsInfo {
00651 
00652     int kernel_mem_free_size;
00653     int kernel_mem_free_min;
00654     int packet_count;
00655     int packet_qos_count;
00656 
00657     int libnet_mem_free_size;
00658     int libnet_mem_free_min;
00659 } SceNetStatisticsInfo;
00660 
00661 typedef struct SceNetIpHeaderIpVerHl {
00662     unsigned char hl;
00663     unsigned char ver;
00664 } SceNetIpHeaderIpVerHl;
00665 
00666 typedef union SceNetIpHeaderUnion {
00667     SceNetIpHeaderIpVerHl ip_ver_hl;
00668     unsigned char ver_hl;
00669 } SceNetIpHeaderUnion;
00670 
00671 typedef struct SceNetIpHeader {
00672     SceNetIpHeaderUnion un;
00673     unsigned char ip_tos;
00674     unsigned short ip_len;
00675     unsigned short ip_id;
00676     unsigned short ip_off;
00677     unsigned char ip_ttl;
00678     unsigned char ip_p;
00679     unsigned short ip_sum;
00680     SceNetInAddr ip_src;
00681     SceNetInAddr ip_dst;
00682 } SceNetIpHeader;
00683 
00684 typedef struct SceNetIcmpHeaderEcho {
00685     unsigned short id;
00686     unsigned short sequence;
00687 } SceNetIcmpHeaderEcho;
00688 
00689 typedef struct SceNetIcmpHeaderFrag {
00690     unsigned short unused;
00691     unsigned short mtu;
00692 } SceNetIcmpHeaderFrag;
00693 
00694 typedef union SceNetIcmpHeaderUnion {
00695     SceNetIcmpHeaderEcho echo;
00696     unsigned int gateway;
00697     SceNetIcmpHeaderFrag frag;
00698 } SceNetIcmpHeaderUnion;
00699 
00700 typedef struct SceNetIcmpHeader {
00701     unsigned char type;
00702     unsigned char code;
00703     unsigned short checksum;
00704     SceNetIcmpHeaderUnion un;
00705 } SceNetIcmpHeader;
00706 
00707 /* prototypes */
00708 
00709 int sceNetInit(SceNetInitParam *param);
00710 int sceNetTerm(void);
00711 
00712 int sceNetShowIfconfig(void *p, int b);
00713 int sceNetShowRoute(void);
00714 int sceNetShowNetstat(void);
00715 
00716 int sceNetEmulationSet(SceNetEmulationParam *param, int flags);
00717 int sceNetEmulationGet(SceNetEmulationParam *param, int flags);
00718 
00719 int sceNetResolverCreate(const char *name, SceNetResolverParam *param, int flags);
00720 int sceNetResolverStartNtoa(int rid, const char *hostname, SceNetInAddr *addr, int timeout, int retry, int flags);
00721 int sceNetResolverStartAton(int rid, const SceNetInAddr *addr, char *hostname, int len, int timeout, int retry, int flags);
00722 int sceNetResolverGetError(int rid, int *result);
00723 int sceNetResolverDestroy(int rid);
00724 int sceNetResolverAbort(int rid, int flags);
00725 
00726 int sceNetDumpCreate(const char *name, int len, int flags);
00727 int sceNetDumpRead(int id, void *buf, int len, int *pflags);
00728 int sceNetDumpDestroy(int id);
00729 int sceNetDumpAbort(int id, int flags);
00730 int sceNetEpollCreate(const char *name, int flags);
00731 int sceNetEpollControl(int eid, int op, int id,SceNetEpollEvent *event);
00732 int sceNetEpollWait(int eid, SceNetEpollEvent *events, int maxevents, int timeout);
00733 int sceNetEpollWaitCB(int eid, SceNetEpollEvent *events, int maxevents, int timeout);
00734 int sceNetEpollDestroy(int eid);
00735 int sceNetEpollAbort(int eid, int flags);
00736 
00737 int sceNetEtherStrton(const char *str, SceNetEtherAddr *n);
00738 int sceNetEtherNtostr(const SceNetEtherAddr *n, char *str, unsigned int len);
00739 int sceNetGetMacAddress(SceNetEtherAddr *addr, int flags);
00740 
00741 int sceNetSocket(const char *name, int domain, int type, int protocol);
00742 int sceNetAccept(int s, SceNetSockaddr *addr, unsigned int *addrlen);
00743 int sceNetBind(int s, const SceNetSockaddr *addr, unsigned int addrlen);
00744 int sceNetConnect(int s, const SceNetSockaddr *name, unsigned int namelen);
00745 int sceNetGetpeername(int s, SceNetSockaddr *name, unsigned int *namelen);
00746 int sceNetGetsockname(int s, SceNetSockaddr *name, unsigned int *namelen);
00747 int sceNetGetsockopt(int s, int level, int optname, void *optval, unsigned int *optlen);
00748 int sceNetListen(int s, int backlog);
00749 int sceNetRecv(int s, void *buf, unsigned int len, int flags);
00750 int sceNetRecvfrom(int s, void *buf, unsigned int len, int flags, SceNetSockaddr *from, unsigned int *fromlen);
00751 int sceNetRecvmsg(int s, SceNetMsghdr *msg, int flags);
00752 int sceNetSend(int s, const void *msg, unsigned int len, int flags);
00753 int sceNetSendto(int s, const void *msg, unsigned int len, int flags, const SceNetSockaddr *to, unsigned int tolen);
00754 int sceNetSendmsg(int s, const SceNetMsghdr *msg, int flags);
00755 int sceNetSetsockopt(int s, int level, int optname, const void *optval, unsigned int optlen);
00756 int sceNetShutdown(int s, int how);
00757 int sceNetSocketClose(int s);
00758 int sceNetSocketAbort(int s, int flags);
00759 int sceNetGetSockInfo(int s, SceNetSockInfo *info, int n, int flags);
00760 int sceNetGetSockIdInfo(SceNetFdSet *fds, int sockinfoflags, int flags);
00761 int sceNetGetStatisticsInfo(SceNetStatisticsInfo *info, int flags);
00762 
00763 int sceNetSetDnsInfo(SceNetDnsInfo *info, int flags);
00764 int sceNetClearDnsCache(int flags);
00765 
00766 const char *sceNetInetNtop(int af,const void *src,char *dst,unsigned int size);
00767 int sceNetInetPton(int af, const char *src, void *dst);
00768 
00769 //TODO : create BSD aliases ?
00770 
00771 long long unsigned int sceNetHtonll(unsigned long long int host64);
00772 unsigned int sceNetHtonl(unsigned int host32);
00773 unsigned short int sceNetHtons(unsigned short int host16);
00774 unsigned long long int sceNetNtohll(unsigned long long int net64);
00775 unsigned int sceNetNtohl(unsigned int net32);
00776 unsigned short int sceNetNtohs(unsigned short int net16);
00777 
00778 #ifdef __cplusplus
00779 }
00780 #endif
00781 
00782 #endif /* _PSP2_NET_NET_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines