C11
[ps4-sdk.git] / include / network.h
blob9ba00da101105b4f35274b5c54ecce1ba507c16b
1 #pragma once
3 #include "types.h"
5 #define IP(a, b, c, d) (((a) << 0) + ((b) << 8) + ((c) << 16) + ((d) << 24))
6 #define htons(a) __builtin_bswap16(a)
8 #define AF_INET 0x0002
10 #define IN_ADDR_ANY 0
12 #define SOCK_STREAM 1
13 #define SOCK_DGRAM 2
15 #define SOL_SOCKET 0xffff
16 #define SO_NBIO 0x1200
18 #define MSG_DONTWAIT 0x80
19 #define MSG_WAITALL 0x40
21 struct in_addr {
22 unsigned long s_addr;
25 struct sockaddr_in {
26 unsigned char sin_len;
27 unsigned char sin_family;
28 unsigned short sin_port;
29 struct in_addr sin_addr;
30 unsigned short sin_vport;
31 char sin_zero[6];
34 struct sockaddr {
35 unsigned char sin_len;
36 unsigned char sa_family;
37 char sa_data[14];
40 typedef unsigned int socklen_t;
42 extern int (*sceNetSocket)(const char *, int, int, int);
43 extern int (*sceNetSocketClose)(int);
44 extern int (*sceNetConnect)(int, struct sockaddr *, int);
45 extern int (*sceNetSend)(int, const void *, size_t, int);
46 extern int (*sceNetBind)(int, struct sockaddr *, int);
47 extern int (*sceNetListen)(int, int);
48 extern int (*sceNetAccept)(int, struct sockaddr *, unsigned int *);
49 extern int (*sceNetRecv)(int, void *, size_t, int);
50 extern int (*sceNetSocketAbort)(int , int );
52 extern int (*sceNetGetsockname)(int, struct sockaddr *, unsigned int *);
53 extern int (*sceNetGetsockopt)(int s, int level, int optname, void *restrict optval, socklen_t *restrict optlen);
54 extern int (*sceNetSetsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen);
56 extern const char (*sceNetInetNtop)(int af, const void *src, char *dst, int size);
57 extern int (*sceNetInetPton)(int af, const char *src, void *dst);
59 extern uint64_t (*sceNetHtonll)(uint64_t host64);
60 extern uint32_t (*sceNetHtonl)(uint32_t host32);
61 extern uint16_t (*sceNetHtons)(uint16_t host16);
62 extern uint64_t (*sceNetNtohll)(uint64_t net64);
63 extern uint32_t (*sceNetNtohl)(uint32_t net32);
64 extern uint16_t (*sceNetNtohs)(uint16_t net16);
66 void initNetwork(void);