-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.h
52 lines (45 loc) · 1.13 KB
/
client.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
#pragma once
/**
* @file client.h
* @brief Client definition and related functions
*
* @author Valérian Rousset
*/
#include <stddef.h> // for size_t
#include "error.h" // for error_code type
#include "node.h" // in week 5
#include "node_list.h" // weeks 6 to 10
#include "args.h" // weeks 10 and after
#include "ring.h" // weeks 11 and after
/**
* @brief client state
*/
typedef struct
{
const char* name;
ring_t* server; // not sure if that's what we're supposed to modify
args_t* args;
}client_t;
/**
* @brief client_init function arguments.
* To be defined in week 05 and THEN UPDATED in week 10.
*/
typedef struct
{
char*** argv;
size_t argc;
size_t nb_args;
size_t supported_args;
client_t* client;
}client_init_args_t;
/**
* @brief does all the work to be done at the end of life of a client
* @param client the client to end
*/
void client_end(client_t *client);
/**
* @brief does all the work to be done at the beginning of life of a client
* @param client the client to initialize
* @return some error code, if any.
*/
error_code client_init(client_init_args_t);