1 // One of the headers for HaxServ
3 // Written by: Test_User <hax@andrewyu.org>
5 // This is free and unencumbered software released into the public
8 // Anyone is free to copy, modify, publish, use, compile, sell, or
9 // distribute this software, either in source code form or as a compiled
10 // binary, for any purpose, commercial or non-commercial, and by any
13 // In jurisdictions that recognize copyright laws, the author or authors
14 // of this software dedicate any and all copyright interest in the
15 // software to the public domain. We make this dedication for the benefit
16 // of the public at large and to the detriment of our heirs and
17 // successors. We intend this dedication to be an overt act of
18 // relinquishment in perpetuity of all present and future rights to this
19 // software under copyright law.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 // OTHER DEALINGS IN THE SOFTWARE.
31 #include <netinet/in.h>
38 // ID is the index you got this from
40 uint64_t distance
; // gl if you exceed this
42 struct string address
;
44 struct string via
; // netsplit purposes
47 struct table user_list
;
57 struct string hostname
;
61 struct string realname
;
62 struct string opertype
;
65 struct table channel_list
;
67 struct table metadata
;
76 struct table modes
; // TODO: Parse modes properly
77 struct table user_list
; // points to corresponding user_info struct (if available, currently not)
79 struct table metadata
;
82 extern struct table server_network_commands
;
83 extern struct table client_network_commands
;
84 extern struct table channel_list
;
85 extern struct table server_list
;
86 extern struct table user_list
;
88 extern pthread_mutex_t send_lock
;
91 extern int client_listen_fd
;
92 extern struct string client_nick
;
93 extern uint8_t client_connected
;
95 extern int resolve(char* address
, char* port
, struct sockaddr
*server
);
97 extern int initservernetwork(void);
98 extern int initclientnetwork(void);
100 #define MODE_TYPE_UNKNOWN 0
101 #define MODE_TYPE_NOARGS 1
102 #define MODE_TYPE_REPLACE 2
103 #define MODE_TYPE_MULTIPLE 3
104 // Mode goes away when the user leaves the channel
105 #define MODE_TYPE_USERS 4
107 extern char channel_mode_types
[UCHAR_MAX
+1];
110 extern ssize_t
SENDCLIENT(struct string msg
);
112 #define SENDCLIENT(x) write(client_fd, x.data, x.len)
115 extern int privmsg(struct string source
, struct string target
, size_t num_message_parts
, struct string message
[num_message_parts
]);
116 extern int add_local_client(struct string uid
, struct string nick_arg
, struct string vhost_arg
, struct string ident_arg
, struct string realname_arg
, time_t timestamp
, char fake_cert
);
117 extern int remove_user(struct string uid
, struct string reason
);