]>
jfr.im git - solanum.git/blob - tests/client_util.h
2 * client_util.c: Utility functions for making test clients
3 * Copyright 2017 Simon Arlott
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
26 #include "ircd_defs.h"
30 #include "ircd_util.h"
32 #define TEST_NICK "local_test"
33 #define TEST_USERNAME "username"
34 #define TEST_HOSTNAME "example.test"
35 #define TEST_IP "2001:db8::1:5ee:bad:c0de"
36 #define TEST_REALNAME "Test user"
37 #define TEST_ID TEST_ME_ID "00000"
39 #define TEST_ID_SUFFIX "!" TEST_USERNAME "@" TEST_HOSTNAME
41 #define TEST_SERVER_NAME "remote.test"
42 #define TEST_SERVER_ID "1BB"
44 #define TEST_REMOTE_NICK "remote_test"
45 #define TEST_REMOTE_ID TEST_SERVER_ID "00001"
47 #define TEST_SERVER2_NAME "remote2.test"
48 #define TEST_SERVER2_ID "2CC"
50 #define TEST_REMOTE2_NICK "remote2_test"
51 #define TEST_REMOTE2_ID TEST_SERVER2_ID "00002"
53 #define TEST_SERVER3_NAME "remote3.test"
54 #define TEST_SERVER3_ID "3DD"
56 #define TEST_REMOTE3_NICK "remote3_test"
57 #define TEST_REMOTE3_ID TEST_SERVER3_ID "00003"
59 #define TEST_CHANNEL "#test"
63 void client_util_init(void);
64 void client_util_free(void);
66 struct Client
*make_local_unknown(void);
67 struct Client
*make_local_person(void);
68 struct Client
*make_local_person_nick(const char *nick
);
69 struct Client
*make_local_person_full(const char *nick
, const char *username
, const char *hostname
, const char *ip
, const char *realname
);
70 void make_local_person_oper(struct Client
*client
);
71 void remove_local_person(struct Client
*client
);
73 struct Client
*make_remote_server(struct Client
*uplink
);
74 struct Client
*make_remote_server_name(struct Client
*uplink
, const char *name
);
75 struct Client
*make_remote_server_full(struct Client
*uplink
, const char *name
, const char *id
);
76 struct Client
*make_remote_person(struct Client
*server
);
77 struct Client
*make_remote_person_nick(struct Client
*server
, const char *nick
);
78 struct Client
*make_remote_person_full(struct Client
*server
, const char *nick
, const char *username
, const char *hostname
, const char *ip
, const char *realname
);
79 void make_remote_person_oper(struct Client
*client
);
80 void remove_remote_person(struct Client
*client
);
81 void remove_remote_server(struct Client
*server
);
83 struct Channel
*make_channel(void);
85 char *get_client_sendq(const struct Client
*client
);
87 void client_util_parse(struct Client
*client
, const char *message
);
89 #define is_client_sendq_empty(client, message, ...) do { \
90 is_string("", get_client_sendq(client), message, ##__VA_ARGS__); \
93 #define is_client_sendq_one(queue, client, message, ...) do { \
94 is_string(queue, get_client_sendq(client), message, ##__VA_ARGS__); \
97 #define is_client_sendq(queue, client, message, ...) do { \
98 is_client_sendq_one(queue, client, message, ##__VA_ARGS__); \
99 is_client_sendq_empty(client, message, ##__VA_ARGS__); \