-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.h
executable file
·66 lines (57 loc) · 1.5 KB
/
chat.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
66
#if !defined(CHAT_H)
#define CHAT_H
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <errno.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
#include "chat_io.h"
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include "chat_io.h"
#include "chat_timeq.h"
#include "chat_table.h"
#define TRUE 1
#define FALSE 0
#define CHAT_CONNECTION_HEADER_LENGTH 3
#define CHAT_REREGISTER_TIME (CHAT_SOFT_STATE/2)
/*
#define CHAT_DEFAULT_TIMEOUT 60000
#define CHAT_SOFT_STATE 300000
#define CHAT_IDLE_CHANNEL_TIMEOUT 120000
*/
#define CHAT_DEFAULT_TIMEOUT -1
#define CHAT_SOFT_STATE 360000
#define CHAT_IDLE_CHANNEL_TIMEOUT 240000
#define CHAT_FILE_CONNECT_TIMEOUT 60000
typedef enum
{
CHAT_SUCCESS = 0,
CHAT_ERROR_PROTOCOL = -1,
CHAT_ERROR_USERNAME_EXISTS = -2,
CHAT_ERROR_USERNAME_NOT_FOUND = -3,
CHAT_ERROR_SOCKET_IN_USE = -4,
CHAT_ERROR_SOCKET = -5,
CHAT_ERROR_CANCELED = -6,
CHAT_ERROR_EOF = -7,
CHAT_ERROR_INCOMPLETE = -8,
CHAT_ERROR_CLOSED = -9
} chat_error_t;
void
chat_debug_set_level(
int level);
int
chat_debug_print(
int level,
const char * fmt,
...);
#endif