refactor: simplify file name
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef CWS_EPOLL_UTILS_H
|
||||
#define CWS_EPOLL_UTILS_H
|
||||
#ifndef CWS_EPOLL_H
|
||||
#define CWS_EPOLL_H
|
||||
|
||||
int cws_epoll_add(int epfd, int sockfd);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "config/config.h"
|
||||
#include "core/worker.h"
|
||||
#include "utils/net_utils.h"
|
||||
#include "utils/error.h"
|
||||
|
||||
/* Clients max queue */
|
||||
#define CWS_SERVER_BACKLOG 128
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "utils/net_utils.h"
|
||||
|
||||
extern volatile sig_atomic_t cws_server_run;
|
||||
|
||||
@@ -23,8 +22,4 @@ void cws_worker_free(cws_worker_s **workers, size_t workers_num);
|
||||
|
||||
void *cws_worker_loop(void *arg);
|
||||
|
||||
void cws_server_close_client(int epfd, int client_fd);
|
||||
|
||||
cws_server_ret cws_server_handle_client_data(int epfd, int client_fd);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CWS_HTTP_H
|
||||
#define CWS_HTTP_H
|
||||
#ifndef CWS_REQUEST_H
|
||||
#define CWS_REQUEST_H
|
||||
|
||||
#include <myclib/myhashmap.h>
|
||||
#include <myclib/mystring.h>
|
||||
@@ -35,11 +35,6 @@ typedef struct cws_http {
|
||||
|
||||
cws_http_s *cws_http_parse(string_s *request_str);
|
||||
|
||||
void cws_http_send_response(cws_http_s *request, cws_http_status_e status);
|
||||
|
||||
size_t http_response_builder(char **response, cws_http_status_e status, char *content_type,
|
||||
char *body, size_t body_len_bytes);
|
||||
|
||||
void cws_http_free(cws_http_s *request);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CWS_COLORS_H
|
||||
#define CWS_COLORS_H
|
||||
#ifndef CWS_DEBUG_H
|
||||
#define CWS_DEBUG_H
|
||||
|
||||
/* ANSI color escape sequences */
|
||||
#define RED "\033[31m"
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#ifndef CWS_UTILS_H
|
||||
#define CWS_UTILS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/socket.h>
|
||||
#ifndef CWS_ERROR_H
|
||||
#define CWS_ERROR_H
|
||||
|
||||
typedef enum cws_server_ret {
|
||||
CWS_SERVER_OK,
|
||||
@@ -29,8 +26,4 @@ typedef enum cws_server_ret {
|
||||
CWS_SERVER_WORKER_ERROR,
|
||||
} cws_server_ret;
|
||||
|
||||
cws_server_ret cws_fd_set_nonblocking(int sockfd);
|
||||
|
||||
void cws_utils_get_client_ip(struct sockaddr_storage *sa, char *ip);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CWS_HASH_UTILS_H
|
||||
#define CWS_HASH_UTILS_H
|
||||
#ifndef CWS_HASH_H
|
||||
#define CWS_HASH_H
|
||||
|
||||
unsigned int my_str_hash_fn(const void *key);
|
||||
|
||||
13
include/utils/net.h
Normal file
13
include/utils/net.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef CWS_NET_H
|
||||
#define CWS_NET_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "utils/error.h"
|
||||
|
||||
cws_server_ret cws_fd_set_nonblocking(int sockfd);
|
||||
|
||||
void cws_utils_get_client_ip(struct sockaddr_storage *sa, char *ip);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user