Blame


1 38b9cb88 2001-12-14 alex /*
2 38b9cb88 2001-12-14 alex * ngIRCd -- The Next Generation IRC Daemon
3 1547f76c 2002-01-02 alex * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
4 38b9cb88 2001-12-14 alex *
5 c7f07523 2002-12-12 alex * This program is free software; you can redistribute it and/or modify
6 c7f07523 2002-12-12 alex * it under the terms of the GNU General Public License as published by
7 c7f07523 2002-12-12 alex * the Free Software Foundation; either version 2 of the License, or
8 c7f07523 2002-12-12 alex * (at your option) any later version.
9 c7f07523 2002-12-12 alex * Please read the file COPYING, README and AUTHORS for more information.
10 38b9cb88 2001-12-14 alex *
11 939767d5 2003-01-15 alex * $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $
12 38b9cb88 2001-12-14 alex *
13 c7f07523 2002-12-12 alex * Client management (header)
14 38b9cb88 2001-12-14 alex */
15 38b9cb88 2001-12-14 alex
16 38b9cb88 2001-12-14 alex
17 38b9cb88 2001-12-14 alex #ifndef __client_h__
18 38b9cb88 2001-12-14 alex #define __client_h__
19 38b9cb88 2001-12-14 alex
20 38b9cb88 2001-12-14 alex
21 c7f07523 2002-12-12 alex #define CLIENT_UNKNOWN 1 /* connection of unknown type */
22 c7f07523 2002-12-12 alex #define CLIENT_GOTPASS 2 /* client did send PASS */
23 c7f07523 2002-12-12 alex #define CLIENT_GOTNICK 4 /* client did send NICK */
24 c7f07523 2002-12-12 alex #define CLIENT_GOTUSER 8 /* client did send USER */
25 c7f07523 2002-12-12 alex #define CLIENT_USER 16 /* client is an IRC user */
26 c7f07523 2002-12-12 alex #define CLIENT_UNKNOWNSERVER 32 /* unregistered server connection */
27 c7f07523 2002-12-12 alex #define CLIENT_GOTPASSSERVER 64 /* client did send PASS in "server style" */
28 c7f07523 2002-12-12 alex #define CLIENT_SERVER 128 /* client is a server */
29 c7f07523 2002-12-12 alex #define CLIENT_SERVICE 256 /* client is a service */
30 38b9cb88 2001-12-14 alex
31 1e59617d 2002-11-30 alex #define CLIENT_TYPE INT
32 38b9cb88 2001-12-14 alex
33 1e59617d 2002-11-30 alex
34 95a4b1b1 2002-03-25 alex #if defined(__client_c__) | defined(S_SPLINT_S)
35 ca33cbda 2002-03-12 alex
36 ca33cbda 2002-03-12 alex #include "defines.h"
37 ca33cbda 2002-03-12 alex
38 38b9cb88 2001-12-14 alex typedef struct _CLIENT
39 38b9cb88 2001-12-14 alex {
40 c7f07523 2002-12-12 alex CHAR id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */
41 c7f07523 2002-12-12 alex UINT32 hash; /* hash of lower-case ID */
42 c7f07523 2002-12-12 alex POINTER *next; /* pointer to next client structure */
43 c7f07523 2002-12-12 alex CLIENT_TYPE type; /* type of client, see CLIENT_xxx */
44 c7f07523 2002-12-12 alex CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */
45 c7f07523 2002-12-12 alex struct _CLIENT *introducer; /* ID of the servers which the client is connected to */
46 c7f07523 2002-12-12 alex struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
47 c7f07523 2002-12-12 alex CHAR pwd[CLIENT_PASS_LEN]; /* password received of the client */
48 c7f07523 2002-12-12 alex CHAR host[CLIENT_HOST_LEN]; /* hostname of the client */
49 c7f07523 2002-12-12 alex CHAR user[CLIENT_USER_LEN]; /* user name ("login") */
50 c7f07523 2002-12-12 alex CHAR info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
51 c7f07523 2002-12-12 alex CHAR modes[CLIENT_MODE_LEN]; /* client modes */
52 c7f07523 2002-12-12 alex INT hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
53 c7f07523 2002-12-12 alex BOOLEAN oper_by_me; /* client is local IRC operator on this server? */
54 c7f07523 2002-12-12 alex CHAR away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */
55 c7f07523 2002-12-12 alex CHAR flags[CLIENT_FLAGS_LEN]; /* flags of the client */
56 38b9cb88 2001-12-14 alex } CLIENT;
57 ca33cbda 2002-03-12 alex
58 f7551900 2002-01-04 alex #else
59 ca33cbda 2002-03-12 alex
60 f7551900 2002-01-04 alex typedef POINTER CLIENT;
61 ca33cbda 2002-03-12 alex
62 f7551900 2002-01-04 alex #endif
63 38b9cb88 2001-12-14 alex
64 38b9cb88 2001-12-14 alex
65 939767d5 2003-01-15 alex GLOBAL VOID Client_Init PARAMS(( VOID ));
66 939767d5 2003-01-15 alex GLOBAL VOID Client_Exit PARAMS(( VOID ));
67 38b9cb88 2001-12-14 alex
68 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ));
69 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ));
70 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ));
71 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented ));
72 f7551900 2002-01-04 alex
73 939767d5 2003-01-15 alex GLOBAL VOID Client_Destroy PARAMS(( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ));
74 939767d5 2003-01-15 alex #ifdef CONN_MODULE
75 939767d5 2003-01-15 alex GLOBAL VOID Client_DestroyNow PARAMS(( CLIENT *Client ));
76 939767d5 2003-01-15 alex #endif
77 07903baa 2002-01-03 alex
78 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_ThisServer PARAMS(( VOID ));
79 07903baa 2002-01-03 alex
80 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx ));
81 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token ));
82 07903baa 2002-01-03 alex
83 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID ));
84 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_First PARAMS(( VOID ));
85 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c ));
86 38b9cb88 2001-12-14 alex
87 939767d5 2003-01-15 alex GLOBAL INT Client_Type PARAMS(( CLIENT *Client ));
88 939767d5 2003-01-15 alex GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client ));
89 939767d5 2003-01-15 alex GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client ));
90 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client ));
91 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client ));
92 939767d5 2003-01-15 alex GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client ));
93 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client ));
94 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client ));
95 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client ));
96 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client ));
97 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
98 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client ));
99 939767d5 2003-01-15 alex GLOBAL INT Client_Hops PARAMS(( CLIENT *Client ));
100 939767d5 2003-01-15 alex GLOBAL INT Client_Token PARAMS(( CLIENT *Client ));
101 939767d5 2003-01-15 alex GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client ));
102 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client ));
103 939767d5 2003-01-15 alex GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client ));
104 939767d5 2003-01-15 alex GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client ));
105 3ad1bc00 2001-12-23 alex
106 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode ));
107 f7551900 2002-01-04 alex
108 939767d5 2003-01-15 alex GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname ));
109 939767d5 2003-01-15 alex GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick ));
110 939767d5 2003-01-15 alex GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented ));
111 939767d5 2003-01-15 alex GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info ));
112 939767d5 2003-01-15 alex GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd ));
113 939767d5 2003-01-15 alex GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type ));
114 939767d5 2003-01-15 alex GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops ));
115 939767d5 2003-01-15 alex GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token ));
116 939767d5 2003-01-15 alex GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe ));
117 939767d5 2003-01-15 alex GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes ));
118 939767d5 2003-01-15 alex GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags ));
119 939767d5 2003-01-15 alex GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer ));
120 939767d5 2003-01-15 alex GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt ));
121 f7551900 2002-01-04 alex
122 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_ModeAdd PARAMS(( CLIENT *Client, CHAR Mode ));
123 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_ModeDel PARAMS(( CLIENT *Client, CHAR Mode ));
124 f7551900 2002-01-04 alex
125 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_CheckNick PARAMS(( CLIENT *Client, CHAR *Nick ));
126 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_CheckID PARAMS(( CLIENT *Client, CHAR *ID ));
127 f7551900 2002-01-04 alex
128 939767d5 2003-01-15 alex GLOBAL LONG Client_UserCount PARAMS(( VOID ));
129 939767d5 2003-01-15 alex GLOBAL LONG Client_ServiceCount PARAMS(( VOID ));
130 939767d5 2003-01-15 alex GLOBAL LONG Client_ServerCount PARAMS(( VOID ));
131 939767d5 2003-01-15 alex GLOBAL LONG Client_OperCount PARAMS(( VOID ));
132 939767d5 2003-01-15 alex GLOBAL LONG Client_UnknownCount PARAMS(( VOID ));
133 939767d5 2003-01-15 alex GLOBAL LONG Client_MyUserCount PARAMS(( VOID ));
134 939767d5 2003-01-15 alex GLOBAL LONG Client_MyServiceCount PARAMS(( VOID ));
135 939767d5 2003-01-15 alex GLOBAL LONG Client_MyServerCount PARAMS(( VOID ));
136 939767d5 2003-01-15 alex GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
137 939767d5 2003-01-15 alex GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
138 b9d701db 2002-01-16 alex
139 939767d5 2003-01-15 alex GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick ));
140 b9d701db 2002-01-16 alex
141 175b20bb 2002-02-06 alex
142 38b9cb88 2001-12-14 alex #endif
143 38b9cb88 2001-12-14 alex
144 38b9cb88 2001-12-14 alex
145 38b9cb88 2001-12-14 alex /* -eof- */