vitasdk
Documentation of the vitasdk
net.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2_NET_NET_H_
8 #define _PSP2_NET_NET_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2common/net.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
35 
37 typedef enum SceNetDumpType {
38  SCE_NET_DUMP_PEEK = 0x00000010,
39  SCE_NET_DUMP_DONTWAIT = 0x00000020,
40  SCE_NET_DUMP_OVERFLOW = 0x00000040,
43 
45 typedef enum SceNetEpollEventType {
46  SCE_NET_EPOLLIN = 0x00000001,
47  SCE_NET_EPOLLOUT = 0x00000002,
48  SCE_NET_EPOLLERR = 0x00000008,
49  SCE_NET_EPOLLHUP = 0x00000010,
50  SCE_NET_EPOLLDESCID = 0x00010000
52 
54 typedef enum SceNetEpollControlFlag {
59 
61 typedef enum SceNetEmulationFlag {
65 
67 typedef enum SceNetResolverFlag {
68  SCE_NET_RESOLVER_ASYNC = 0x00000001,
71 
77 
79 typedef enum SceNetSocketAbortFlag {
83 
85 typedef enum SceNetShutdownFlag {
90 
91 /* Defines */
92 #define SCE_NET_EPOLL_ABORT_FLAG_PRESERVATION 0x00000001
93 
94 #define SCE_NET_RESOLVER_PORT 53
95 #define SCE_NET_RESOLVER_HOSTNAME_LEN_MAX 255
96 
97 /* callback */
98 
99 typedef void *(*SceNetResolverFunctionAllocate)(
100  unsigned int size,
101  int rid,
102  const char *name,
103  void *user);
105  void *ptr,
106  int rid,
107  const char *name,
108  void *user);
109 
110 /* struct */
111 
112 typedef struct SceNetInitParam {
113  void *memory;
114  int size;
115  int flags;
118 
119 typedef struct SceNetEmulationData {
120  unsigned short int drop_rate;
121  unsigned short int drop_duration;
122  unsigned short int pass_duration;
123  unsigned short int delay_time;
124  unsigned short int delay_jitter;
125  unsigned short int order_rate;
126  unsigned short int order_delay_time;
127  unsigned short int duplication_rate;
128  unsigned int bps_limit;
129  unsigned short int lower_size_limit;
130  unsigned short int upper_size_limit;
131  unsigned int system_policy_pattern;
132  unsigned int game_policy_pattern;
133  unsigned short int policy_flags[64];
134  unsigned char reserved[64];
137 
138 typedef struct SceNetEmulationParam {
139  unsigned short int version;
140  unsigned short int option_number;
141  unsigned short int current_version;
142  unsigned short int result;
143  unsigned int flags;
144  unsigned int reserved1;
147  unsigned int seed;
148  unsigned char reserved[44];
151 
152 typedef struct SceNetEpollDataExt {
153  int id;
154  unsigned int u32;
157 
158 typedef union SceNetEpollData {
159  void *ptr;
160  int fd;
161  unsigned int u32;
162  unsigned long long int u64;
166 
167 typedef struct SceNetEpollSystemData {
168  unsigned int system[4];
171 
172 typedef struct SceNetEpollEvent {
173  unsigned int events;
174  unsigned int reserved;
179 
180 typedef struct SceNetResolverParam {
183  void *user;
186 
187 /* prototypes */
188 
190 int sceNetTerm(void);
191 
192 int sceNetShowIfconfig(void *p, int b);
193 int sceNetShowRoute(void);
195 
198 
199 int sceNetResolverCreate(const char *name, SceNetResolverParam *param, int flags);
200 int sceNetResolverStartNtoa(int rid, const char *hostname, SceNetInAddr *addr, int timeout, int retry, int flags);
201 int sceNetResolverStartAton(int rid, const SceNetInAddr *addr, char *hostname, int len, int timeout, int retry, int flags);
202 int sceNetResolverGetError(int rid, int *result);
204 int sceNetResolverAbort(int rid, int flags);
205 
206 int sceNetDumpCreate(const char *name, int len, int flags);
207 int sceNetDumpRead(int id, void *buf, int len, int *pflags);
208 int sceNetDumpDestroy(int id);
209 int sceNetDumpAbort(int id, int flags);
210 int sceNetEpollCreate(const char *name, int flags);
211 int sceNetEpollControl(int eid, int op, int id,SceNetEpollEvent *event);
212 int sceNetEpollWait(int eid, SceNetEpollEvent *events, int maxevents, int timeout);
213 int sceNetEpollWaitCB(int eid, SceNetEpollEvent *events, int maxevents, int timeout);
214 int sceNetEpollDestroy(int eid);
215 int sceNetEpollAbort(int eid, int flags);
216 
217 int sceNetEtherStrton(const char *str, SceNetEtherAddr *n);
218 int sceNetEtherNtostr(const SceNetEtherAddr *n, char *str, unsigned int len);
220 
221 int sceNetSocket(const char *name, int domain, int type, int protocol);
222 int sceNetAccept(int s, SceNetSockaddr *addr, unsigned int *addrlen);
223 int sceNetBind(int s, const SceNetSockaddr *addr, unsigned int addrlen);
224 int sceNetConnect(int s, const SceNetSockaddr *name, unsigned int namelen);
225 int sceNetGetpeername(int s, SceNetSockaddr *name, unsigned int *namelen);
226 int sceNetGetsockname(int s, SceNetSockaddr *name, unsigned int *namelen);
227 int sceNetGetsockopt(int s, int level, int optname, void *optval, unsigned int *optlen);
228 int sceNetListen(int s, int backlog);
229 int sceNetRecv(int s, void *buf, unsigned int len, int flags);
230 int sceNetRecvfrom(int s, void *buf, unsigned int len, int flags, SceNetSockaddr *from, unsigned int *fromlen);
231 int sceNetRecvmsg(int s, SceNetMsghdr *msg, int flags);
232 int sceNetSend(int s, const void *msg, unsigned int len, int flags);
233 int sceNetSendto(int s, const void *msg, unsigned int len, int flags, const SceNetSockaddr *to, unsigned int tolen);
234 int sceNetSendmsg(int s, const SceNetMsghdr *msg, int flags);
235 int sceNetSetsockopt(int s, int level, int optname, const void *optval, unsigned int optlen);
236 int sceNetShutdown(int s, int how);
237 int sceNetSocketClose(int s);
238 int sceNetSocketAbort(int s, int flags);
239 int sceNetGetSockInfo(int s, SceNetSockInfo *info, int n, int flags);
240 int sceNetGetSockIdInfo(SceNetFdSet *fds, int sockinfoflags, int flags);
242 
245 
246 const char *sceNetInetNtop(int af,const void *src,char *dst,unsigned int size);
247 int sceNetInetPton(int af, const char *src, void *dst);
248 
249 //TODO : create BSD aliases ?
250 
251 long long unsigned int sceNetHtonll(unsigned long long int host64);
252 unsigned int sceNetHtonl(unsigned int host32);
253 unsigned short int sceNetHtons(unsigned short int host16);
254 unsigned long long int sceNetNtohll(unsigned long long int net64);
255 unsigned int sceNetNtohl(unsigned int net32);
256 unsigned short int sceNetNtohs(unsigned short int net16);
257 
263 int *sceNetErrnoLoc(void);
264 
265 #ifdef __cplusplus
266 }
267 #endif
268 
269 #endif /* _PSP2_NET_NET_H_ */
270 
uint8_t type
0 = read?, 1 = write?, 2 = feature?, 3 = ?
Definition: bt.h:2
SceSize size
struct size(variable size)
Definition: debug.h:0
int flags
Event flags.
Definition: debug.h:3
int sceNetClearDnsCache(int flags)
int sceNetListen(int s, int backlog)
SceNetResolverErrorCode
Resolver specific error codes.
Definition: net.h:18
int sceNetGetpeername(int s, SceNetSockaddr *name, unsigned int *namelen)
unsigned char reserved[44]
Definition: net.h:148
SceNetEmulationData send
Definition: net.h:145
int sceNetSocketAbort(int s, int flags)
SceNetResolverFunctionFree free
Definition: net.h:182
unsigned short int sceNetHtons(unsigned short int host16)
int sceNetSendmsg(int s, const SceNetMsghdr *msg, int flags)
SceNetEpollControlFlag
Flags to specify as argument to sceNetEpollControl()
Definition: net.h:54
int sceNetResolverStartNtoa(int rid, const char *hostname, SceNetInAddr *addr, int timeout, int retry, int flags)
unsigned short int sceNetNtohs(unsigned short int net16)
int sceNetTerm(void)
int sceNetRecvmsg(int s, SceNetMsghdr *msg, int flags)
void * memory
Definition: net.h:113
int sceNetEpollWaitCB(int eid, SceNetEpollEvent *events, int maxevents, int timeout)
unsigned short int upper_size_limit
Definition: net.h:130
int sceNetEpollWait(int eid, SceNetEpollEvent *events, int maxevents, int timeout)
unsigned int u32
Definition: net.h:154
int sceNetSend(int s, const void *msg, unsigned int len, int flags)
int sceNetDumpRead(int id, void *buf, int len, int *pflags)
const char * sceNetInetNtop(int af, const void *src, char *dst, unsigned int size)
void * ptr
Definition: net.h:159
int sceNetShowIfconfig(void *p, int b)
int sceNetResolverDestroy(int rid)
void * user
Definition: net.h:183
int sceNetConnect(int s, const SceNetSockaddr *name, unsigned int namelen)
int sceNetEpollControl(int eid, int op, int id, SceNetEpollEvent *event)
SceNetSocketAbortFlag
Flags to specify as argument to sceNetSocketAbort()
Definition: net.h:79
int * sceNetErrnoLoc(void)
Get pointer to last network errno.
int sceNetGetSockIdInfo(SceNetFdSet *fds, int sockinfoflags, int flags)
int size
Definition: net.h:114
int sceNetResolverGetError(int rid, int *result)
unsigned int bps_limit
Definition: net.h:128
unsigned int seed
Definition: net.h:147
SceNetEmulationFlag
Flags to specify as argument to sceNetEmulationGet() / sceNetEmulationSet()
Definition: net.h:61
SceNetDumpType
Flags to specify as argument to sceNetDumpRead()
Definition: net.h:37
unsigned short int drop_duration
Definition: net.h:121
int sceNetDumpAbort(int id, int flags)
int sceNetEtherStrton(const char *str, SceNetEtherAddr *n)
int sceNetResolverCreate(const char *name, SceNetResolverParam *param, int flags)
unsigned int system_policy_pattern
Definition: net.h:131
int sceNetEmulationSet(SceNetEmulationParam *param, int flags)
int sceNetRecv(int s, void *buf, unsigned int len, int flags)
unsigned int system[4]
Definition: net.h:168
int sceNetShutdown(int s, int how)
int sceNetShowNetstat(void)
int sceNetDumpDestroy(int id)
int sceNetSocketClose(int s)
unsigned int events
Definition: net.h:173
unsigned long long int sceNetNtohll(unsigned long long int net64)
unsigned int game_policy_pattern
Definition: net.h:132
long long unsigned int sceNetHtonll(unsigned long long int host64)
unsigned short int duplication_rate
Definition: net.h:127
unsigned short int version
Definition: net.h:139
int sceNetEpollDestroy(int eid)
unsigned int reserved
Definition: net.h:174
int sceNetRecvfrom(int s, void *buf, unsigned int len, int flags, SceNetSockaddr *from, unsigned int *fromlen)
SceNetShutdownFlag
Flags to specify as argument to sceNetShutdown.
Definition: net.h:85
int sceNetBind(int s, const SceNetSockaddr *addr, unsigned int addrlen)
unsigned short int result
Definition: net.h:142
void *(* SceNetResolverFunctionAllocate)(unsigned int size, int rid, const char *name, void *user)
Definition: net.h:99
SceNetEpollData data
Definition: net.h:176
unsigned int reserved1
Definition: net.h:144
int sceNetInit(SceNetInitParam *param)
unsigned short int pass_duration
Definition: net.h:122
SceNetResolverFlag
Flags to specify as argument to sceNetResolverStartNtoa() / sceNetResolverStartAton()
Definition: net.h:67
SceNetResolverFunctionAllocate allocate
Definition: net.h:181
unsigned short int order_rate
Definition: net.h:125
int sceNetEtherNtostr(const SceNetEtherAddr *n, char *str, unsigned int len)
int sceNetResolverAbort(int rid, int flags)
int sceNetGetSockInfo(int s, SceNetSockInfo *info, int n, int flags)
int sceNetResolverStartAton(int rid, const SceNetInAddr *addr, char *hostname, int len, int timeout, int retry, int flags)
unsigned char reserved[64]
Definition: net.h:134
int sceNetGetsockopt(int s, int level, int optname, void *optval, unsigned int *optlen)
int sceNetInetPton(int af, const char *src, void *dst)
unsigned int sceNetHtonl(unsigned int host32)
unsigned short int lower_size_limit
Definition: net.h:129
unsigned short int option_number
Definition: net.h:140
SceNetEpollSystemData system
Definition: net.h:175
unsigned short int delay_jitter
Definition: net.h:124
unsigned short int drop_rate
Definition: net.h:120
int sceNetSetDnsInfo(SceNetDnsInfo *info, int flags)
VITASDK_BUILD_ASSERT_EQ(0xC, SceNetInitParam)
int sceNetDumpCreate(const char *name, int len, int flags)
int sceNetSetsockopt(int s, int level, int optname, const void *optval, unsigned int optlen)
int sceNetAccept(int s, SceNetSockaddr *addr, unsigned int *addrlen)
int flags
Definition: net.h:115
unsigned short int order_delay_time
Definition: net.h:126
int sceNetSendto(int s, const void *msg, unsigned int len, int flags, const SceNetSockaddr *to, unsigned int tolen)
unsigned short int current_version
Definition: net.h:141
SceNetEpollDataExt ext
Definition: net.h:163
int fd
Definition: net.h:160
SceNetResolverAbortFlag
Flags to specify as argument to sceNetResolverAbort()
Definition: net.h:73
int sceNetEpollCreate(const char *name, int flags)
int sceNetGetMacAddress(SceNetEtherAddr *addr, int flags)
int sceNetGetStatisticsInfo(SceNetStatisticsInfo *info, int flags)
unsigned int flags
Definition: net.h:143
int id
Definition: net.h:153
int sceNetShowRoute(void)
unsigned short int policy_flags[64]
Definition: net.h:133
int sceNetGetsockname(int s, SceNetSockaddr *name, unsigned int *namelen)
unsigned int u32
Definition: net.h:161
int sceNetEmulationGet(SceNetEmulationParam *param, int flags)
unsigned int sceNetNtohl(unsigned int net32)
unsigned short int delay_time
Definition: net.h:123
int sceNetSocket(const char *name, int domain, int type, int protocol)
int sceNetEpollAbort(int eid, int flags)
SceNetEmulationData recv
Definition: net.h:146
void(* SceNetResolverFunctionFree)(void *ptr, int rid, const char *name, void *user)
Definition: net.h:104
SceNetEpollEventType
Events for SceNetEpollEvent.
Definition: net.h:45
unsigned long long int u64
Definition: net.h:162
@ SCE_NET_RESOLVER_ENOHOST
Definition: net.h:29
@ SCE_NET_RESOLVER_EALIGNMENT
Definition: net.h:33
@ SCE_NET_RESOLVER_EBUSY
Definition: net.h:20
@ SCE_NET_RESOLVER_ENODNS
Definition: net.h:24
@ SCE_NET_RESOLVER_ENOSUPPORT
Definition: net.h:26
@ SCE_NET_RESOLVER_EPACKET
Definition: net.h:22
@ SCE_NET_RESOLVER_EFORMAT
Definition: net.h:27
@ SCE_NET_RESOLVER_ENORECORD
Definition: net.h:32
@ SCE_NET_RESOLVER_ESERVERFAILURE
Definition: net.h:28
@ SCE_NET_RESOLVER_ENOTIMPLEMENTED
Definition: net.h:30
@ SCE_NET_RESOLVER_EINTERNAL
Definition: net.h:19
@ SCE_NET_RESOLVER_ETIMEDOUT
Definition: net.h:25
@ SCE_NET_RESOLVER_ESERVERREFUSED
Definition: net.h:31
@ SCE_NET_RESOLVER_ENOSPACE
Definition: net.h:21
@ SCE_NET_RESOLVER_ERESERVED224
Definition: net.h:23
@ SCE_NET_EPOLL_CTL_DEL
Definition: net.h:57
@ SCE_NET_EPOLL_CTL_ADD
Definition: net.h:55
@ SCE_NET_EPOLL_CTL_MOD
Definition: net.h:56
@ SCE_NET_SOCKET_ABORT_FLAG_RCV_PRESERVATION
Definition: net.h:80
@ SCE_NET_SOCKET_ABORT_FLAG_SND_PRESERVATION
Definition: net.h:81
@ SCE_NET_EMULATION_FLAG_WLAN0
Definition: net.h:63
@ SCE_NET_EMULATION_FLAG_ETH0
Definition: net.h:62
@ SCE_NET_DUMP_PEEK
Definition: net.h:38
@ SCE_NET_DUMP_DONTWAIT
Definition: net.h:39
@ SCE_NET_DUMP_OVERFLOW
Definition: net.h:40
@ SCE_NET_DUMP_ABORT_FLAG_PRESERVATION
Definition: net.h:41
@ SCE_NET_SHUT_WR
Definition: net.h:87
@ SCE_NET_SHUT_RDWR
Definition: net.h:88
@ SCE_NET_SHUT_RD
Definition: net.h:86
@ SCE_NET_RESOLVER_START_NTOA_DISABLE_IPADDRESS
Definition: net.h:69
@ SCE_NET_RESOLVER_ASYNC
Definition: net.h:68
@ SCE_NET_RESOLVER_ABORT_FLAG_NTOA_PRESERVATION
Definition: net.h:74
@ SCE_NET_RESOLVER_ABORT_FLAG_ATON_PRESERVATION
Definition: net.h:75
@ SCE_NET_EPOLLHUP
Definition: net.h:49
@ SCE_NET_EPOLLDESCID
Definition: net.h:50
@ SCE_NET_EPOLLIN
Definition: net.h:46
@ SCE_NET_EPOLLOUT
Definition: net.h:47
@ SCE_NET_EPOLLERR
Definition: net.h:48
Definition: net.h:440
Definition: net.h:119
Definition: net.h:138
Definition: net.h:152
Definition: net.h:172
Definition: net.h:167
Definition: net.h:435
Definition: net.h:409
Definition: net.h:414
Definition: net.h:112
Definition: net.h:464
Definition: net.h:180
Definition: net.h:475
Definition: net.h:451
Definition: net.h:496
Definition: net.h:158