-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminitalk.h
49 lines (41 loc) · 1.68 KB
/
minitalk.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minitalk.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rcaillie <rcaillie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/04 13:37:13 by rcaillie #+# #+# */
/* Updated: 2024/11/12 10:48:59 by rcaillie ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINITALK_H
# define MINITALK_H
# include "libft/libft.h"
# include <unistd.h>
# include <signal.h>
# include <stdlib.h>
# define PID_MAX 4194304
# ifndef SLEEP_TIME
# define SLEEP_TIME 100
# endif
typedef struct s_data
{
char c;
int i;
int client_pid;
} t_data;
// PROTOTYPES FOR SERVER
void server_handler(int signum, siginfo_t *info, void *context);
void handle_sigint(int sig);
void process_received_bit(int signum, t_data *data);
void handle_complete_byte(t_data *data);
// PROTOTYPES FOR SERVER_UTILS
char *ft_lst_to_str(t_list *lst);
void reset_data(t_data *data, siginfo_t *info);
char *ft_strdup_char(char c);
// PROTOTYPES FOR CLIENT
void send_bit(int pid, int bit);
void send_char(int pid, char c);
void send_message(int pid, char *msg);
#endif