-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirc.h
65 lines (61 loc) · 1.37 KB
/
irc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
** EPITECH PROJECT, 2018
** irc
** File description:
** irc
*/
#ifndef MY_IRC_H_
#define MY_IRC_H_
#define _GNU_SOURCE
#include <fcntl.h>
#include <netdb.h>
#include <memory.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdbool.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
/* PART I: STRUCT */
typedef struct s_node {
void *data;
struct s_node *next;
} t_node;
typedef struct s_list {
t_node *head;
} t_list;
typedef struct s_com {
char *ip;
int socket;
int port;
struct sockaddr_in s_in;
} t_com;
/* PART II: LINKED LIST FUNCTONS */
t_list *emptyt_list(void);
size_t count(t_list *list);
void add(void *data, t_list *list);
void delete(void *data, t_list *list);
/* PART III: FUNCTIONS */
char *read_fd(int fd);
int my_strncmp(char *s1, char *s2, size_t len);
size_t count_character(const char *str, char filter);
char **str_to_tab(char *str);
void **free_array(char **array);
void *free_secur(void *ptr);
bool check_ip(char *ip);
bool is_valid_fd(int fd);
int close_fd(int fd);
bool my_break(bool state);
int my_signal(void);
bool connect_socket(t_com *com, char *proto_name);
bool create_socket(t_com *chanel, char *proto_name);
int write_fd(int fd, char *str);
/* PART 6: MACCRO */
#define ENDL "\r\n"
#define READ_SIZE 1024
#endif /* !MY_IRC_H_ */