This commit is contained in:
Nishi 2026-01-29 18:34:15 +09:00
commit 0e2ca4f931
6 changed files with 55 additions and 11 deletions

View file

@ -25,7 +25,7 @@ GSDECL void GSNetServerClose(GSNetServer net);
/* net_base.c */
GSDECL GSBool GSNetBaseHasData(int fd);
GSDECL int GSNetBaseServer(int port);
GSDECL int GSNetBaseClient(const char* hostname, int port);
GSDECL int GSNetBaseClient(const char* hostname, int port, GSNetAddress* address);
GSDECL void GSNetBaseClose(int fd);
GSDECL int GSNetBaseRead(int fd, void* data, int size, GSNetAddress* address); /* always read 508 bytes! */
GSDECL void GSNetBaseWrite(int fd, void* data, int size, GSNetAddress* address);

View file

@ -50,6 +50,7 @@ typedef struct _GSNetPacket GSNetPacket;
typedef struct _GSNetAddress GSNetAddress;
typedef struct _GSBinary GSBinary;
typedef struct _GSNetState GSNetState;
typedef struct _GSNetKV GSNetKV;
#ifdef _GEARSRC
typedef struct _GSClient* GSClient;
typedef struct _GSServer* GSServer;
@ -154,6 +155,13 @@ struct _GSNetState {
GSBinary* rx;
GSBinary* tx;
void* opaque;
};
struct _GSNetKV {
GSNetAddress key;
GSNetState value;
};
#ifdef _GEARSRC
@ -273,6 +281,7 @@ struct _GSNetClient {
int fd;
GSNetAddress address;
GSNetState state;
};
@ -280,6 +289,8 @@ struct _GSNetServer {
GSEngine engine;
int fd;
GSNetKV* client;
};
struct _GSClient {