Mercurial
diff seobeo/seobeo.h @ 4:0b3b4f5887bb
[Seobeo] Updated so that it create socket for both server and clients.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 26 Sep 2025 15:14:46 -0700 |
| parents | 2758f5527d2b |
| children | 3e12bf044589 |
line wrap: on
line diff
--- a/seobeo/seobeo.h Wed Sep 24 18:49:09 2025 -0700 +++ b/seobeo/seobeo.h Fri Sep 26 15:14:46 2025 -0700 @@ -21,14 +21,38 @@ #include "dowa/dowa.h" +#define INITIAL_BUFFER_CAPACITY 4096 + +typedef struct { + int socket; + char *host; + char *port; + + uint8 *read_buffer; + uint32 read_buffer_capacity; + uint32 read_buffer_len; // current size + uint32 read_buffer_pos; // TODO: Implement this for client + + uint8 *write_buffer; + uint32 write_buffer_capacity; + uint32 write_buffer_len; // current size + + void *file; + void *text_copy; + char *file_name; +} Sebeo_Handle, *Seobeo_PHandle; + // --- Internal? --- // -extern int Seobeo_CreateSocket(int32 stream, char* port, int32 backlog); -extern void Seobeo_ListenClient(int sock_fd, void (*handle_client)(int)); -extern void *Seobeo_GetIP4OrIP6(struct sockaddr *sa); +extern int Seobeo_CreateSocket(int32 stream, const char *host, const char* port, int32 backlog); +extern void *Seobeo_GetIP4OrIP6(struct sockaddr *sa); // --- TCP --- // -// extern int Seobeo_TCP_SocketCreate(char* port, int32 backlog) +extern Seobeo_PHandle Seobeo_Stream_Handle_Create(const char *host, const char* port); +extern Seobeo_PHandle Seobeo_Stream_Handle_Accept(Seobeo_PHandle server_h); +extern void Seobeo_Handle_Destroy(Seobeo_PHandle h); +extern int Seobeo_Handle_Flush(Seobeo_PHandle h); +extern int Seobeo_Handle_QueueData(Seobeo_PHandle h, const uint8_t *data, uint32_t data_size); #endif