0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 19:28:52 +02:00

Fix redundant/conflicting namespace labels.

This commit is contained in:
Jason Volk 2016-08-15 01:17:35 -07:00
parent 39eebde589
commit 60c044d78a
5 changed files with 49 additions and 43 deletions

View file

@ -387,9 +387,9 @@ void yyerror(const char *);
} // namespace ircd } // namespace ircd
inline inline
auto yyerror(const char *const c) void yyerror(const char *const c)
{ {
return ircd::yyerror(c); ircd::yyerror(c);
} }
#endif // __cplusplus #endif // __cplusplus

View file

@ -22,7 +22,7 @@
* USA * USA
*/ */
using namespace ircd; namespace ircd {
typedef void (*authd_cb_t)(int, char **); typedef void (*authd_cb_t)(int, char **);
@ -44,17 +44,17 @@ static void cmd_notice_client(int parc, char **parv);
static void cmd_oper_warn(int parc, char **parv); static void cmd_oper_warn(int parc, char **parv);
static void cmd_stats_results(int parc, char **parv); static void cmd_stats_results(int parc, char **parv);
rb_helper *ircd::authd_helper; rb_helper *authd_helper;
static char *authd_path; static char *authd_path;
uint32_t cid; uint32_t cid;
static rb_dictionary *cid_clients; static rb_dictionary *cid_clients;
static struct ev_entry *timeout_ev; static struct ev_entry *timeout_ev;
rb_dictionary *ircd::bl_stats; rb_dictionary *bl_stats;
rb_dlink_list ircd::opm_list; rb_dlink_list opm_list;
struct OPMListener ircd::opm_listeners[LISTEN_LAST]; struct OPMListener opm_listeners[LISTEN_LAST];
std::array<authd_cb, 256> authd_cmd_tab = std::array<authd_cb, 256> authd_cmd_tab =
[]{ []{
@ -298,7 +298,7 @@ parse_authd_reply(rb_helper * helper)
} }
void void
ircd::init_authd(void) init_authd(void)
{ {
if(start_authd()) if(start_authd())
{ {
@ -308,7 +308,7 @@ ircd::init_authd(void)
} }
void void
ircd::configure_authd(void) configure_authd(void)
{ {
/* Timeouts */ /* Timeouts */
set_authd_timeout("ident_timeout", GlobalSetOptions.ident_timeout); set_authd_timeout("ident_timeout", GlobalSetOptions.ident_timeout);
@ -371,7 +371,7 @@ authd_free_client_cb(rb_dictionary_element *delem, void *unused)
} }
void void
ircd::authd_abort_client(struct Client *client_p) authd_abort_client(struct Client *client_p)
{ {
rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->auth.cid)); rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->auth.cid));
authd_free_client(client_p); authd_free_client(client_p);
@ -400,20 +400,20 @@ restart_authd_cb(rb_helper * helper)
} }
void void
ircd::restart_authd(void) restart_authd(void)
{ {
ierror("authd restarting..."); ierror("authd restarting...");
restart_authd_cb(authd_helper); restart_authd_cb(authd_helper);
} }
void void
ircd::rehash_authd(void) rehash_authd(void)
{ {
rb_helper_write(authd_helper, "R"); rb_helper_write(authd_helper, "R");
} }
void void
ircd::check_authd(void) check_authd(void)
{ {
if(authd_helper == NULL) if(authd_helper == NULL)
restart_authd(); restart_authd();
@ -443,7 +443,7 @@ generate_cid(void)
* could then be processed too early by read_packet(). * could then be processed too early by read_packet().
*/ */
void void
ircd::authd_initiate_client(struct Client *client_p, bool defer) authd_initiate_client(struct Client *client_p, bool defer)
{ {
char client_ipaddr[HOSTIPLEN+1]; char client_ipaddr[HOSTIPLEN+1];
char listen_ipaddr[HOSTIPLEN+1]; char listen_ipaddr[HOSTIPLEN+1];
@ -528,7 +528,7 @@ authd_decide_client(struct Client *client_p, const char *ident, const char *host
} }
void void
ircd::authd_deferred_client(struct Client *client_p) authd_deferred_client(struct Client *client_p)
{ {
client_p->preClient->auth.flags &= ~AUTHC_F_DEFERRED; client_p->preClient->auth.flags &= ~AUTHC_F_DEFERRED;
if(client_p->preClient->auth.flags & AUTHC_F_COMPLETE) if(client_p->preClient->auth.flags & AUTHC_F_COMPLETE)
@ -537,14 +537,14 @@ ircd::authd_deferred_client(struct Client *client_p)
/* Convenience function to accept client */ /* Convenience function to accept client */
void void
ircd::authd_accept_client(struct Client *client_p, const char *ident, const char *host) authd_accept_client(struct Client *client_p, const char *ident, const char *host)
{ {
authd_decide_client(client_p, ident, host, true, '\0', NULL, NULL); authd_decide_client(client_p, ident, host, true, '\0', NULL, NULL);
} }
/* Convenience function to reject client */ /* Convenience function to reject client */
void void
ircd::authd_reject_client(struct Client *client_p, const char *ident, const char *host, char cause, const char *data, const char *reason) authd_reject_client(struct Client *client_p, const char *ident, const char *host, char cause, const char *data, const char *reason)
{ {
authd_decide_client(client_p, ident, host, false, cause, data, reason); authd_decide_client(client_p, ident, host, false, cause, data, reason);
} }
@ -578,7 +578,7 @@ timeout_dead_authd_clients(void *notused)
/* Send a new blacklist to authd */ /* Send a new blacklist to authd */
void void
ircd::add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters) add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters)
{ {
rb_dlink_node *ptr; rb_dlink_node *ptr;
struct BlacklistStats *stats = (BlacklistStats *)rb_malloc(sizeof(struct BlacklistStats)); struct BlacklistStats *stats = (BlacklistStats *)rb_malloc(sizeof(struct BlacklistStats));
@ -617,7 +617,7 @@ ircd::add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dli
/* Delete a blacklist */ /* Delete a blacklist */
void void
ircd::del_blacklist(const char *host) del_blacklist(const char *host)
{ {
struct BlacklistStats *stats = (BlacklistStats *)rb_dictionary_retrieve(bl_stats, host); struct BlacklistStats *stats = (BlacklistStats *)rb_dictionary_retrieve(bl_stats, host);
if(stats != NULL) if(stats != NULL)
@ -641,7 +641,7 @@ blacklist_delete(rb_dictionary_element *delem, void *unused)
/* Delete all the blacklists */ /* Delete all the blacklists */
void void
ircd::del_blacklist_all(void) del_blacklist_all(void)
{ {
if(bl_stats != NULL) if(bl_stats != NULL)
rb_dictionary_destroy(bl_stats, blacklist_delete, NULL); rb_dictionary_destroy(bl_stats, blacklist_delete, NULL);
@ -652,7 +652,7 @@ ircd::del_blacklist_all(void)
/* Adjust an authd timeout value */ /* Adjust an authd timeout value */
bool bool
ircd::set_authd_timeout(const char *key, int timeout) set_authd_timeout(const char *key, int timeout)
{ {
if(timeout <= 0) if(timeout <= 0)
return false; return false;
@ -663,7 +663,7 @@ ircd::set_authd_timeout(const char *key, int timeout)
/* Enable identd checks */ /* Enable identd checks */
void void
ircd::ident_check_enable(bool enabled) ident_check_enable(bool enabled)
{ {
rb_helper_write(authd_helper, "O ident_enabled %d", enabled ? 1 : 0); rb_helper_write(authd_helper, "O ident_enabled %d", enabled ? 1 : 0);
} }
@ -673,7 +673,7 @@ ircd::ident_check_enable(bool enabled)
* configure_authd() is called. * configure_authd() is called.
*/ */
void void
ircd::conf_create_opm_listener(const char *ip, uint16_t port) conf_create_opm_listener(const char *ip, uint16_t port)
{ {
char ipbuf[HOSTIPLEN]; char ipbuf[HOSTIPLEN];
struct OPMListener *listener; struct OPMListener *listener;
@ -692,7 +692,7 @@ ircd::conf_create_opm_listener(const char *ip, uint16_t port)
} }
void void
ircd::create_opm_listener(const char *ip, uint16_t port) create_opm_listener(const char *ip, uint16_t port)
{ {
char ipbuf[HOSTIPLEN]; char ipbuf[HOSTIPLEN];
@ -709,7 +709,7 @@ ircd::create_opm_listener(const char *ip, uint16_t port)
} }
void void
ircd::delete_opm_listener_all(void) delete_opm_listener_all(void)
{ {
memset(&opm_listeners, 0, sizeof(opm_listeners)); memset(&opm_listeners, 0, sizeof(opm_listeners));
rb_helper_write(authd_helper, "O opm_listener_del_all"); rb_helper_write(authd_helper, "O opm_listener_del_all");
@ -717,7 +717,7 @@ ircd::delete_opm_listener_all(void)
/* Disable all OPM scans */ /* Disable all OPM scans */
void void
ircd::opm_check_enable(bool enabled) opm_check_enable(bool enabled)
{ {
rb_helper_write(authd_helper, "O opm_enabled %d", enabled ? 1 : 0); rb_helper_write(authd_helper, "O opm_enabled %d", enabled ? 1 : 0);
} }
@ -727,7 +727,7 @@ ircd::opm_check_enable(bool enabled)
* configure_authd() is called. * configure_authd() is called.
*/ */
void void
ircd::conf_create_opm_proxy_scanner(const char *type, uint16_t port) conf_create_opm_proxy_scanner(const char *type, uint16_t port)
{ {
struct OPMScanner *scanner = (OPMScanner *)rb_malloc(sizeof(struct OPMScanner)); struct OPMScanner *scanner = (OPMScanner *)rb_malloc(sizeof(struct OPMScanner));
@ -737,14 +737,14 @@ ircd::conf_create_opm_proxy_scanner(const char *type, uint16_t port)
} }
void void
ircd::create_opm_proxy_scanner(const char *type, uint16_t port) create_opm_proxy_scanner(const char *type, uint16_t port)
{ {
conf_create_opm_proxy_scanner(type, port); conf_create_opm_proxy_scanner(type, port);
rb_helper_write(authd_helper, "O opm_scanner %s %hu", type, port); rb_helper_write(authd_helper, "O opm_scanner %s %hu", type, port);
} }
void void
ircd::delete_opm_proxy_scanner(const char *type, uint16_t port) delete_opm_proxy_scanner(const char *type, uint16_t port)
{ {
rb_dlink_node *ptr, *nptr; rb_dlink_node *ptr, *nptr;
@ -765,7 +765,7 @@ ircd::delete_opm_proxy_scanner(const char *type, uint16_t port)
} }
void void
ircd::delete_opm_proxy_scanner_all(void) delete_opm_proxy_scanner_all(void)
{ {
rb_dlink_node *ptr, *nptr; rb_dlink_node *ptr, *nptr;
@ -779,3 +779,5 @@ ircd::delete_opm_proxy_scanner_all(void)
rb_helper_write(authd_helper, "O opm_scanner_del_all"); rb_helper_write(authd_helper, "O opm_scanner_del_all");
} }
} // namespace ircd

View file

@ -26,19 +26,23 @@
#include "ircd_parser.hh" #include "ircd_parser.hh"
namespace ircd
{
char *current_file = conffilebuf;
int lineno = 1;
char conffilebuf[BUFSIZE+1];
}
using namespace ircd; using namespace ircd;
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr=0; int include_stack_ptr=0;
int ircd::lineno = 1;
void ccomment(void); void ccomment(void);
void cinclude(void); void cinclude(void);
void hashcomment(void); void hashcomment(void);
int ieof(void); int ieof(void);
int lineno_stack[MAX_INCLUDE_DEPTH]; int lineno_stack[MAX_INCLUDE_DEPTH];
char conffile_stack[MAX_INCLUDE_DEPTH][BUFSIZE]; char conffile_stack[MAX_INCLUDE_DEPTH][BUFSIZE];
char ircd::conffilebuf[BUFSIZE+1];
char *ircd::current_file = ircd::conffilebuf;
FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH]; FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH];
@ -49,7 +53,7 @@ char yy_linebuf[16384];
#define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg) #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg)
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
if (!(result = ircd::conf_fgets(buf, max_size, ircd::conf_fbfile_in))) \ if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \
YY_FATAL_ERROR("input in flex scanner failed"); YY_FATAL_ERROR("input in flex scanner failed");
%} %}
@ -195,7 +199,7 @@ void cinclude(void)
lineno = 1; lineno = 1;
inc_fbfile_in[include_stack_ptr] = conf_fbfile_in; inc_fbfile_in[include_stack_ptr] = conf_fbfile_in;
strcpy(conffile_stack[include_stack_ptr], c); strcpy(conffile_stack[include_stack_ptr], c);
ircd::current_file = conffile_stack[include_stack_ptr]; current_file = conffile_stack[include_stack_ptr];
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
conf_fbfile_in = tmp_fbfile_in; conf_fbfile_in = tmp_fbfile_in;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
@ -220,9 +224,9 @@ int ieof(void)
conf_fbfile_in = inc_fbfile_in[include_stack_ptr]; conf_fbfile_in = inc_fbfile_in[include_stack_ptr];
if(include_stack_ptr) if(include_stack_ptr)
ircd::current_file = conffile_stack[include_stack_ptr]; current_file = conffile_stack[include_stack_ptr];
else else
ircd::current_file = conffilebuf; current_file = conffilebuf;
yy_switch_to_buffer(include_stack[include_stack_ptr]); yy_switch_to_buffer(include_stack[include_stack_ptr]);
return 0; return 0;
@ -237,5 +241,5 @@ void hashcomment(void)
return; return;
if (!rb_strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1)) if (!rb_strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1))
ircd::yyerror("You probably meant '.include', skipping"); ::yyerror("You probably meant '.include', skipping");
} }

View file

@ -353,7 +353,7 @@ static
bool init_module__cap(struct module *const mod, bool init_module__cap(struct module *const mod,
mapi_cap_list_av2 *const m) mapi_cap_list_av2 *const m)
{ {
using ircd::capability::index; using capability::index;
index *idx; index *idx;
switch(m->cap_index) switch(m->cap_index)
@ -383,7 +383,7 @@ static
void fini_module__cap(struct module *const mod, void fini_module__cap(struct module *const mod,
mapi_cap_list_av2 *const m) mapi_cap_list_av2 *const m)
{ {
using ircd::capability::index; using capability::index;
index *idx; index *idx;
switch(m->cap_index) switch(m->cap_index)

View file

@ -51,7 +51,7 @@ DECLARE_MODULE_AV2(help, NULL, NULL, help_clist, NULL, NULL, NULL, NULL, help_de
static void static void
m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
using namespace ircd::cache::help; using namespace cache::help;
dohelp(source_p, USER, parc > 1 ? parv[1] : NULL); dohelp(source_p, USER, parc > 1 ? parv[1] : NULL);
} }
@ -62,7 +62,7 @@ m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
static void static void
mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
using namespace ircd::cache::help; using namespace cache::help;
dohelp(source_p, OPER, parc > 1 ? parv[1] : NULL); dohelp(source_p, OPER, parc > 1 ? parv[1] : NULL);
} }
@ -74,7 +74,7 @@ mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
static void static void
mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{ {
using namespace ircd::cache::help; using namespace cache::help;
dohelp(source_p, USER, parc > 1 ? parv[1] : NULL); dohelp(source_p, USER, parc > 1 ? parv[1] : NULL);
} }