-
Notifications
You must be signed in to change notification settings - Fork 0
/
state.h
44 lines (36 loc) · 1.79 KB
/
state.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
/**
* COPYRIGHT 2014 (C) Jason Volk
* COPYRIGHT 2014 (C) Svetlana Tkachenko
*
* DISTRIBUTED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) (see: LICENSE)
*/
enum Flag : uint16_t
{
CONNECTED = 0x0001, // TCP handshake complete
PROXIED = 0x0002, // If proxying, got 200 OK
NEGOTIATED = 0x0004, // CAP registration has ended
WELCOMED = 0x0008, // USER/ircd registration taken place
IDENTIFIED = 0x0010, // NickServ identification confirmed
CLOAKED = 0x0020, // Host Hidden confirmed
// Faults
TIMEOUT = 0x0100, // Timer expired triggered fault state
SOCKERR = 0x0200, // Any socket/connection error
SERVERR = 0x0400, // Server triggered the fault state
// Masks // (not a flag)
NONE = 0x0000, // Mask for no flags
FAULT = 0xff00, // Mask for fault flags
ALL = 0xffff, // Mask for all flags
};
enum class State : int
{
FAULT = -1, // Handling of exceptional events
INACTIVE = 0, // The session is inactive or was terminated
CONNECTING = 1, // Attemping a TCP connection to target
PROXYING = 2, // If proxying, sent a CONNECT, awaiting response
NEGOTIATING = 3, // CAP registration is open and has not ended
REGISTERING = 4, // USER/ircd registration in progress
IDENTIFYING = 5, // Services identification in progress
ACTIVE = 6, // Normal handling of IRC events
};
using state_t = std::underlying_type<State>::type;
using flag_t = std::underlying_type<Flag>::type;