refactor: move to myclib

This commit is contained in:
2025-09-12 18:51:42 +02:00
parent fc21c740bd
commit b6041fdcb4
9 changed files with 8 additions and 90 deletions

View File

@@ -2,9 +2,8 @@
#define CWS_SERVER_H
#include <myclib/myhashmap.h>
#include <netdb.h>
#include <myclib/mysocket.h>
#include <signal.h>
#include <sys/socket.h>
#include "utils/config.h"

View File

@@ -1,37 +1,11 @@
#ifndef CWS_UTILS_H
#define CWS_UTILS_H
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <myclib/mysocket.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <sys/types.h>
/**
* @brief Prints each IP address associated with a host
*
* @param[in] hostname Hostname
* @param[in] port Port
*/
void cws_utils_print_ips(const char *hostname, const char *port);
/**
* @brief Retrieves the client ip from the sockaddr_storage and put it in the ip str
*
* @param[in] sa The sockaddr_storage of the client
* @param[out] ip The IP of the client
*/
void cws_utils_get_client_ip(struct sockaddr_storage *sa, char *ip);
/**
* @brief Remove whitespaces from a string
*
* @param[in] str The string pointer
* @return Returns the new string without whitespaces
*/
char *cws_strip(char *str);
/* Functions used for hash maps */
unsigned int my_str_hash_fn(const void *key);
bool my_str_equal_fn(const void *a, const void *b);