Fix networking struct
[ps4-sdk.git] / include / network.h
blob6d5f29a340ee11c40815022d00ea93b570f5fe23
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 struct in_addr {
16 unsigned long s_addr;
19 struct sockaddr_in {
20 unsigned short sin_len;
21 short sin_family;
22 unsigned short sin_port;
23 struct in_addr sin_addr;
24 char sin_zero[6];
27 struct sockaddr {
28 unsigned short sa_family;
29 char sa_data[14];
32 extern int (*sceNetSocket)(const char *, int, int, int);
33 extern int (*sceNetSocketClose)(int);
34 extern int (*sceNetConnect)(int, struct sockaddr *, int);
35 extern int (*sceNetSend)(int, const void *, size_t, int);
36 extern int (*sceNetBind)(int, struct sockaddr *, int);
37 extern int (*sceNetListen)(int, int);
38 extern int (*sceNetAccept)(int, struct sockaddr *, unsigned int *);
39 extern int (*sceNetRecv)(int, void *, size_t, int);
41 extern int (*sceNetGetsockname)(int, struct sockaddr *, unsigned int *);
43 extern const char (*sceNetInetNtop)(int af, const void *src, char *dst, int size);
44 extern int (*sceNetInetPton)(int af, const char *src, void *dst);
46 extern uint64_t (*sceNetHtonll)(uint64_t host64);
47 extern uint32_t (*sceNetHtonl)(uint32_t host32);
48 extern uint16_t (*sceNetHtons)(uint16_t host16);
49 extern uint64_t (*sceNetNtohll)(uint64_t net64);
50 extern uint32_t (*sceNetNtohl)(uint32_t net32);
51 extern uint16_t (*sceNetNtohs)(uint16_t net16);
54 void initNetwork(void);