/* * init_users() * * Initializes the users heap and DTree. * * Inputs: * - none * * Outputs: * - none * * Side Effects: * - the users heap and DTree are initialized. */ void init_users(void) { user_heap = sharedheap_get(sizeof(user_t)); if (user_heap == NULL) { slog(LG_DEBUG, "init_users(): block allocator failure."); exit(EXIT_FAILURE); } userlist = mowgli_patricia_create(irccasecanon); uidlist = mowgli_patricia_create(noopcanon); }
/* * init_servers() * * Initializes the server heap and server/sid DTree structures. * * Inputs: * - nothing * * Outputs: * - nothing * * Side Effects: * - if the heap or dtrees fail to initialize, the program * will abort. */ void init_servers(void) { serv_heap = sharedheap_get(sizeof(server_t)); tld_heap = sharedheap_get(sizeof(tld_t)); if (serv_heap == NULL || tld_heap == NULL) { slog(LG_INFO, "init_servers(): block allocator failure."); exit(EXIT_FAILURE); } servlist = mowgli_patricia_create(irccasecanon); sidlist = mowgli_patricia_create(noopcanon); }
void mowgli_allocation_policy_bootstrap(void) { mowgli_allocation_policy_dict = mowgli_patricia_create(_allocation_policy_key_canon); mowgli_object_class_init(&klass, "mowgli.allocation_policy", NULL, FALSE); }
int init_upgrade(void) { u_udb_save_hooks = mowgli_list_create(); u_udb_load_hooks = mowgli_patricia_create(NULL); return 0; }
void common_ctcp_init(void) { ctcptree = mowgli_patricia_create(noopcanon); mowgli_patricia_add(ctcptree, "\001PING", ctcp_ping_handler); mowgli_patricia_add(ctcptree, "\001VERSION\001", ctcp_version_handler); mowgli_patricia_add(ctcptree, "\001CLIENTINFO\001", ctcp_clientinfo_handler); }
mowgli_allocation_policy_t * mowgli_allocation_policy_lookup(const char *name) { if (mowgli_allocation_policy_dict == NULL) mowgli_allocation_policy_dict = mowgli_patricia_create(_allocation_policy_key_canon); return mowgli_patricia_retrieve(mowgli_allocation_policy_dict, name); }
void _modinit(module_t *m) { use_groupserv_main_symbols(m); service_named_bind_command("groupserv", &gs_set); gs_set_cmdtree = mowgli_patricia_create(strcasecanon); }
static int addXMLCommand(XMLRPCCmd * xml) { if (XMLRPCCMD == NULL) XMLRPCCMD = mowgli_patricia_create(strcasecanon); mowgli_patricia_add(XMLRPCCMD, xml->name, xml); return XMLRPC_ERR_OK; }
void _modinit(module_t *m) { add_subblock_top_conf("NICKLISTS", &conft); add_conf_item("ALL", &conft, nicklist_config_handler_all); add_conf_item("NICK", &conft, nicklist_config_handler_nick); add_conf_item("USER", &conft, nicklist_config_handler_user); add_conf_item("REAL", &conft, nicklist_config_handler_real); akillalllist = mowgli_patricia_create(strcasecanon); akillnicklist = mowgli_patricia_create(strcasecanon); akilluserlist = mowgli_patricia_create(strcasecanon); akillreallist = mowgli_patricia_create(strcasecanon); hook_add_event("user_add"); hook_add_user_add(aknl_nickhook); hook_add_event("user_nickchange"); hook_add_user_nickchange(aknl_nickhook); }
void _modinit(module_t *m) { MODULE_TRY_REQUEST_SYMBOL(m, exttarget_tree, "exttarget/main", "exttarget_tree"); mowgli_patricia_add(*exttarget_tree, "chanacs", chanacs_validate_f); /* since we are dealing with channel names, we use irccasecanon. */ chanacs_exttarget_tree = mowgli_patricia_create(irccasecanon); chanacs_ext_heap = mowgli_heap_create(sizeof(chanacs_exttarget_t), 32, BH_LAZY); }
void common_ctcp_init(void) { ctcptree = mowgli_patricia_create(noopcanon); mowgli_patricia_add(ctcptree, "\001PING", ctcp_ping_handler); mowgli_patricia_add(ctcptree, "\001VERSION\001", ctcp_version_handler); mowgli_patricia_add(ctcptree, "\001CLIENTINFO\001", ctcp_clientinfo_handler); mowgli_patricia_add(ctcptree, "\001MACHINEGOD\001", ctcp_machinegod_handler); mowgli_patricia_add(ctcptree, "\001ABOUT\001", ctcp_about_handler); }
void db_init(void) { db_types = mowgli_patricia_create(strcasecanon); if (db_types == NULL) { slog(LG_ERROR, "db_init(): object allocator failure"); exit(EXIT_FAILURE); } }
int init_link(void) { mowgli_list_init(&all_origins); u_hook_add(HOOK_CONF_END, conf_end, NULL); u_conf_add_handler("listen", conf_listen, NULL); u_conf_listen_handlers = mowgli_patricia_create(ascii_canonize); u_conf_add_handler("port", conf_listen_port, u_conf_listen_handlers); return 0; }
void pcommand_init(void) { pcommand_heap = sharedheap_get(sizeof(pcommand_t)); if (!pcommand_heap) { slog(LG_INFO, "pcommand_init(): block allocator failed."); exit(EXIT_FAILURE); } pcommands = mowgli_patricia_create(noopcanon); }
void set_init(void) { service_bind_command(groupsvs, &gs_set); gs_set_cmdtree = mowgli_patricia_create(strcasecanon); command_add(&gs_set_email, gs_set_cmdtree); command_add(&gs_set_url, gs_set_cmdtree); command_add(&gs_set_description, gs_set_cmdtree); command_add(&gs_set_channel, gs_set_cmdtree); command_add(&gs_set_open, gs_set_cmdtree); command_add(&gs_set_public, gs_set_cmdtree); }
http_client_t *http_client_new(void) { http_client_t *h; h = smalloc(sizeof(http_client_t)); h->headers = mowgli_patricia_create(strcasecanon); h->query_string_size = 32; h->query_string_len = 0; h->query_string = smalloc(h->query_string_size); return h; }
static struct a_network *net_create(const char *name) { struct a_network *net; net = mowgli_alloc(sizeof(*net)); if (net == NULL) return NULL; memset(net, 0, sizeof(*net)); net->name = mowgli_strdup(name); net->acct = NULL; net->host = NULL; net->port = 0; net->use_ssl = false; /* defaults */ net->nick = mowgli_strdup(DEFAULT_NICK); net->ident = mowgli_strdup(DEFAULT_IDENT); net->gecos = mowgli_strdup(DEFAULT_GECOS); net->nd.flags = 0; net->nd.flags |= NET_MOTD_EMPTY | NET_MOTD_LOCK; net->nd.nick = mowgli_strdup(DEFAULT_NICK); net->nd.ident = mowgli_strdup(DEFAULT_IDENT); net->nd.host = mowgli_strdup(""); net->nd.gecos = mowgli_strdup(DEFAULT_GECOS); net->nd.isupport = irc_isupport_create(); net->nd.motd = mowgli_string_create(); net->nd.chans = mowgli_patricia_create(NULL); /* TODO: casemap */ net->nd.users = mowgli_patricia_create(NULL); /* TODO: casemap */ net->state = NET_DISCONNECTED; net->linebuf = NULL; net->clients = mowgli_list_create(); return net; }
void action_register(const char *action, action_f act, void *data) { action_t *a; a = calloc(sizeof(action_t), 1); a->act = act; a->action = action; a->data = data; if (action_list == NULL) action_list = mowgli_patricia_create(action_canon); mowgli_patricia_add(action_list, action, a); }
void _modinit(module_t *m) { service_named_bind_command("operserv", &os_set); os_set_cmdtree = mowgli_patricia_create(strcasecanon); command_add(&os_set_recontime, os_set_cmdtree); command_add(&os_set_maxlogins, os_set_cmdtree); command_add(&os_set_maxnicks, os_set_cmdtree); command_add(&os_set_maxusers, os_set_cmdtree); command_add(&os_set_maxchans, os_set_cmdtree); command_add(&os_set_mdlimit, os_set_cmdtree); command_add(&os_set_klinetime, os_set_cmdtree); command_add(&os_set_commitinterval, os_set_cmdtree); command_add(&os_set_chanexpire, os_set_cmdtree); command_add(&os_set_maxchanacs, os_set_cmdtree); command_add(&os_set_maxfounders, os_set_cmdtree); command_add(&os_set_akicktime, os_set_cmdtree); command_add(&os_set_spam, os_set_cmdtree); command_add(&os_set_nickexpire, os_set_cmdtree); command_add(&os_set_enforceprefix, os_set_cmdtree); }
void libguess_init(void) { /* check if already initialized */ if (guess_impl_list != NULL) return; guess_impl_list = mowgli_patricia_create(strcasecanon); guess_impl_register(GUESS_REGION_JP, guess_jp); guess_impl_register(GUESS_REGION_TW, guess_tw); guess_impl_register(GUESS_REGION_CN, guess_cn); guess_impl_register(GUESS_REGION_KR, guess_kr); guess_impl_register(GUESS_REGION_RU, guess_ru); guess_impl_register(GUESS_REGION_AR, guess_ar); guess_impl_register(GUESS_REGION_TR, guess_tr); guess_impl_register(GUESS_REGION_GR, guess_gr); guess_impl_register(GUESS_REGION_HW, guess_hw); guess_impl_register(GUESS_REGION_PL, guess_pl); guess_impl_register(GUESS_REGION_BL, guess_bl); }
mowgli_allocation_policy_t * mowgli_allocation_policy_create(const char *name, mowgli_allocation_func_t allocator, mowgli_deallocation_func_t deallocator) { mowgli_allocation_policy_t *policy; if (mowgli_allocation_policy_dict == NULL) mowgli_allocation_policy_dict = mowgli_patricia_create(_allocation_policy_key_canon); if ((policy = mowgli_patricia_retrieve(mowgli_allocation_policy_dict, name))) return policy; policy = mowgli_alloc(sizeof(mowgli_allocation_policy_t)); mowgli_object_init_from_class(mowgli_object(policy), name, &klass); policy->allocate = allocator; policy->deallocate = deallocator; mowgli_patricia_add(mowgli_allocation_policy_dict, name, policy); return policy; }
void initialise_sigyn(char *nick, char *ident, char *gecos, char *uplink, char * port, bool use_ssl, char *vhost) { me.client = mowgli_alloc(sizeof(irc_user_t)); me.stats.start = time(NULL); me.stats.inB = 0; me.stats.outB = 0; me.client->nick = nick; me.client->user = ident; me.client->gecos = gecos; me.uplink.port = port; me.uplink.hostname = uplink; me.uplink.ssl = use_ssl; me.uplink.vhost = vhost; me.uplink.connected = false; me.maxfd = 3; modules_init(); queue_init(); command_init(); channel_init(); isupport_table = mowgli_patricia_create(strcasecanon); }
void mowgli_global_storage_init(void) { mowgli_global_storage_dict = mowgli_patricia_create(_storage_key_canon); mowgli_global_storage_lock = mowgli_spinlock_create(); }
static mowgli_patricia_t *create_users_patricia(struct a_network *net) { return mowgli_patricia_create( irc_casemap_fn(irc_isupport_get_casemapping(net->nd.isupport)) ); }
// initialize the object. atheme_object_init(atheme_object(ext), entity(ext)->name, (atheme_object_destructor_fn) server_ext_delete); // add the object to the exttarget tree. mowgli_patricia_add(server_exttarget_tree, ext->server, ext); // return the object as initially unowned by sinking the reference count return atheme_object_sink_ref(ext); } static void mod_init(struct module *const restrict m) { MODULE_TRY_REQUEST_SYMBOL(m, exttarget_tree, "exttarget/main", "exttarget_tree"); mowgli_patricia_add(*exttarget_tree, "server", server_validate_f); server_exttarget_tree = mowgli_patricia_create(irccasecanon); server_ext_heap = mowgli_heap_create(sizeof(struct this_exttarget), 32, BH_LAZY); } static void mod_deinit(const enum module_unload_intent ATHEME_VATTR_UNUSED intent) { mowgli_heap_destroy(server_ext_heap); mowgli_patricia_delete(*exttarget_tree, "server"); mowgli_patricia_destroy(server_exttarget_tree, NULL, NULL); } SIMPLE_DECLARE_MODULE_V1("exttarget/server", MODULE_UNLOAD_CAPABILITY_OK)
void mowgli_interface_bootstrap(void) { mowgli_interface_dict = mowgli_patricia_create(NULL); mowgli_mutex_init(&mowgli_interface_lock); }
atheme_object_init(atheme_object(ext), entity(ext)->name, (atheme_object_destructor_fn) chanacs_ext_delete); // add the object to the exttarget tree mowgli_patricia_add(chanacs_exttarget_tree, ext->channel, ext); // return the object as initially unowned by sinking the reference count. return atheme_object_sink_ref(ext); } static void mod_init(struct module *const restrict m) { MODULE_TRY_REQUEST_SYMBOL(m, exttarget_tree, "exttarget/main", "exttarget_tree"); mowgli_patricia_add(*exttarget_tree, "chanacs", chanacs_validate_f); // since we are dealing with channel names, we use irccasecanon. chanacs_exttarget_tree = mowgli_patricia_create(irccasecanon); chanacs_ext_heap = mowgli_heap_create(sizeof(struct this_exttarget), 32, BH_LAZY); } static void mod_deinit(const enum module_unload_intent ATHEME_VATTR_UNUSED intent) { mowgli_heap_destroy(chanacs_ext_heap); mowgli_patricia_delete(*exttarget_tree, "chanacs"); mowgli_patricia_destroy(chanacs_exttarget_tree, NULL, NULL); } SIMPLE_DECLARE_MODULE_V1("exttarget/chanacs", MODULE_UNLOAD_CAPABILITY_OK)
command_t os_ignore = { "IGNORE", N_("Ignore a mask from services."), PRIV_ADMIN, 3, os_cmd_ignore, { .path = "oservice/ignore" } }; command_t os_ignore_add = { "ADD", N_("Add services ignore"), PRIV_ADMIN, 2, os_cmd_ignore_add, { .path = "" } }; command_t os_ignore_del = { "DEL", N_("Delete services ignore"), PRIV_ADMIN, 1, os_cmd_ignore_del, { .path = "" } }; command_t os_ignore_list = { "LIST", N_("List services ignores"), PRIV_ADMIN, 0, os_cmd_ignore_list, { .path = "" } }; command_t os_ignore_clear = { "CLEAR", N_("Clear all services ignores"), PRIV_ADMIN, 0, os_cmd_ignore_clear, { .path = "" } }; mowgli_patricia_t *os_ignore_cmds; mowgli_list_t svs_ignore_list; static void mod_init(module_t *const restrict m) { service_named_bind_command("operserv", &os_ignore); os_ignore_cmds = mowgli_patricia_create(strcasecanon); /* Sub-commands */ command_add(&os_ignore_add, os_ignore_cmds); command_add(&os_ignore_del, os_ignore_cmds); command_add(&os_ignore_clear, os_ignore_cmds); command_add(&os_ignore_list, os_ignore_cmds); use_svsignore++; } static void mod_deinit(const module_unload_intent_t intent) { service_named_unbind_command("operserv", &os_ignore);
void strshare_init(void) { strshare_dict = mowgli_patricia_create(noopcanon); }
void _modinit(module_t *m) { service_named_bind_command("botserv", &bs_set); bs_set_cmdtree = mowgli_patricia_create(strcasecanon); }