36 lines
844 B
C
36 lines
844 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
#include <netinet/in.h>
|
|
|
|
#define SERVER_LOCAL_PORT_DEFAULT 8080
|
|
#define SERVER_LOCAL_THREAD_SLEEP_TIME 1000
|
|
#define SERVER_LOCAL_THREAD_ACCEPT_SLEEP_TIME 60000
|
|
|
|
typedef enum {
|
|
SERVER_LOCAL_THREAD_STATE_STOPPED = 0,
|
|
SERVER_LOCAL_THREAD_STATE_STARTING = 1,
|
|
SERVER_LOCAL_THREAD_STATE_RUNNING = 2,
|
|
SERVER_LOCAL_THREAD_STATE_STOPPING = 3
|
|
} serverlocalthreadstate_t;
|
|
|
|
typedef struct {
|
|
uint32_t port;
|
|
} serverlocalstart_t;
|
|
|
|
typedef struct {
|
|
int32_t sockDesc;
|
|
struct sockaddr_in sockAddr;
|
|
pthread_t thread;
|
|
uint8_t threadState;
|
|
} serverlocal_t;
|
|
|
|
void serverLocalStart(const serverlocalstart_t start);
|
|
void serverLocalStop();
|
|
void * serverLocalThread(void *arg); |