1 |
#pragma once |
2 |
|
3 |
#include <stdlib.h> |
4 |
#include <stdio.h> |
5 |
#define DDrStartupMessage printf |
6 |
|
7 |
#include <string.h> |
8 |
#include <stdbool.h> |
9 |
#include <stdint.h> |
10 |
|
11 |
#ifdef WIN32 |
12 |
#include <winsock2.h> |
13 |
#include "Flatline_Win32.h" |
14 |
#else |
15 |
#include <sys/ioctl.h> |
16 |
#include <sys/types.h> |
17 |
#include <sys/socket.h> |
18 |
#include <unistd.h> |
19 |
#include <stropts.h> |
20 |
#include <arpa/inet.h> |
21 |
#include <netinet/in.h> |
22 |
|
23 |
#define NetPlatform_Initalize() /* */ |
24 |
#define NetPlatform_Shutdown() /* */ |
25 |
#define closesocket close |
26 |
#define ioctlsocket ioctl |
27 |
#endif |
28 |
|
29 |
typedef struct sockaddr sockaddr; |
30 |
typedef struct sockaddr_in sockaddr_in; |
31 |
|
32 |
bool Net_Listen(uint16_t port, bool (*packet_callback)(char* data, int datalen, int from)); |
33 |
int Net_CreateSocket(uint16_t port); |
34 |
bool Net_Send(int socket, int ip, uint16_t port, char* data, int datalen); |
35 |
void Net_CloseSocket(int sock); |
36 |
bool FLrListen_PacketCallback(char* data, int datalen, int from); |
37 |
bool FLrListen_Run(); |