diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-12-06 10:15:50 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-12-06 10:15:50 +0000 |
commit | 36147c08e9224fadc5a713ebbc16ae644a986cf7 (patch) | |
tree | 1e31b332a89be0f61cab05691f5a6c3800c87bbc | |
parent | 00c16eca6dd79e0952f62c585892d1997e94c664 (diff) | |
download | radius-36147c08e9224fadc5a713ebbc16ae644a986cf7.tar.gz radius-36147c08e9224fadc5a713ebbc16ae644a986cf7.tar.bz2 |
Namespace normalization.
* include/radius/list.h: Rename struct list/iterator to grad_list/
grad_iterator
* include/radius/radius.h: Rename L_ log macros to GRAD_LOG_
All uses updated.
67 files changed, 719 insertions, 672 deletions
@@ -1,3 +1,12 @@ +2008-12-06 Sergey Poznyakoff <gray@gnu.org.ua> + + Namespace normalization. + + * include/radius/list.h: Rename struct list/iterator to grad_list/ + grad_iterator + * include/radius/radius.h: Rename L_ log macros to GRAD_LOG_ + All uses updated. + 2008-12-03 Sergey Poznyakoff <gray@gnu.org.ua> * bootstrap: Replace with the gnulib version. diff --git a/client/pam_radius/pam_radius.c b/client/pam_radius/pam_radius.c index 3b9263ac..4ffb6c4f 100644 --- a/client/pam_radius/pam_radius.c +++ b/client/pam_radius/pam_radius.c @@ -1,5 +1,6 @@ /* This file is part of GNU Radius. - Copyright (C) 2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc. + Copyright (C) 2001,2002,2003,2004,2005,2007, + 2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -154,9 +155,9 @@ vlog(int level, const char *fmt, va_list ap) { openlog("pam_radius", LOG_CONS|LOG_PID, LOG_AUTH); - vsyslog(priority[level & L_PRIMASK], fmt, ap); + vsyslog(priority[level & GRAD_LOG_PRIMASK], fmt, ap); if (en) - syslog(priority[level & L_PRIMASK], "syserr: %s (%d)", + syslog(priority[level & GRAD_LOG_PRIMASK], "syserr: %s (%d)", strerror(en), en); closelog(); } diff --git a/include/radius/debug.hin b/include/radius/debug.hin index b2439136..4195c9a8 100644 --- a/include/radius/debug.hin +++ b/include/radius/debug.hin @@ -1,5 +1,5 @@ /* This file is part of GNU Radius. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -31,10 +31,11 @@ #define __grad_debug(text) \ do { \ if (grad_source_info_option) \ - grad_log(L_DEBUG, "%s:%lu:%s: %s", __FILE__, __LINE__, __FUNCTION__, \ + grad_log(GRAD_LOG_DEBUG, "%s:%lu:%s: %s", \ + __FILE__, __LINE__, __FUNCTION__, \ text); \ else \ - grad_log(L_DEBUG, "%s", text); \ + grad_log(GRAD_LOG_DEBUG, "%s", text); \ } while (0) #define GRAD_DEBUG(lev,text) \ diff --git a/include/radius/list.h b/include/radius/list.h index 2286cf9d..12f3b465 100644 --- a/include/radius/list.h +++ b/include/radius/list.h @@ -1,5 +1,5 @@ /* This file is part of GNU Radius - Copyright (C) 2003,2004,2007 Free Software Foundation, Inc. + Copyright (C) 2003,2004,2007,2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -20,8 +20,8 @@ #ifndef _gnu_radius_list_h #define _gnu_radius_list_h -typedef struct list grad_list_t; -typedef struct iterator grad_iterator_t; +typedef struct grad_list grad_list_t; +typedef struct grad_iterator grad_iterator_t; typedef int (*list_iterator_t)(void *item, void *data); typedef int (*list_comp_t)(const void *, const void *); @@ -33,7 +33,7 @@ void *grad_list_item(grad_list_t *list, size_t n); size_t grad_list_count(grad_list_t *list); void grad_list_append(grad_list_t *list, void *data); void grad_list_prepend(grad_list_t *list, void *data); -int grad_list_insert_sorted(struct list *list, void *data, list_comp_t cmp); +int grad_list_insert_sorted(grad_list_t *list, void *data, list_comp_t cmp); void *grad_list_locate(grad_list_t *list, void *data, list_comp_t cmp); void *grad_list_remove(grad_list_t *list, void *data, list_comp_t cmp); diff --git a/include/radius/radius.h b/include/radius/radius.h index ce3cdca0..70e6c9ab 100644 --- a/include/radius/radius.h +++ b/include/radius/radius.h @@ -530,32 +530,32 @@ void grad_app_setup(); in <syslog.h> */ /* log categories */ -#define L_MKCAT(n) ((n)<<3) -#define L_MAIN L_MKCAT(1) /* Main server process */ -#define L_AUTH L_MKCAT(2) /* Authentication process */ -#define L_ACCT L_MKCAT(3) /* Accounting process */ -#define L_PROXY L_MKCAT(4) /* Proxy */ -#define L_SNMP L_MKCAT(5) /* SNMP process */ -#define L_NCAT 8 /* Number of categories */ -#define L_CATMASK 0x38 /* Mask to extract category part */ +#define GRAD_LOG_MKCAT(n) ((n)<<3) +#define GRAD_LOG_MAIN GRAD_LOG_MKCAT(1) /* Main server process */ +#define GRAD_LOG_AUTH GRAD_LOG_MKCAT(2) /* Authentication process */ +#define GRAD_LOG_ACCT GRAD_LOG_MKCAT(3) /* Accounting process */ +#define GRAD_LOG_PROXY GRAD_LOG_MKCAT(4) /* Proxy */ +#define GRAD_LOG_SNMP GRAD_LOG_MKCAT(5) /* SNMP process */ +#define GRAD_LOG_NCAT 8 /* Number of categories */ +#define GRAD_LOG_CATMASK 0x38 /* Mask to extract category part */ /* log priorities */ -#define L_EMERG 0 /* system is unusable */ -#define L_ALERT 1 /* action must be taken immediately */ -#define L_CRIT 2 /* critical conditions */ -#define L_ERR 3 /* error conditions */ -#define L_WARN 4 /* warning conditions */ -#define L_NOTICE 5 /* normal but signification condition */ -#define L_INFO 6 /* informational */ -#define L_DEBUG 7 /* debug-level messages */ -#define L_PRIMASK 0x0007 /* mask to extract priority part */ - -#define L_CAT(v) (((v)&L_CATMASK)>>3) -#define L_PRI(v) ((v)&L_PRIMASK) -#define L_MASK(pri) (1<<(pri)) -#define L_UPTO(pri) ((1<<((pri)+1))-1) +#define GRAD_LOG_EMERG 0 /* system is unusable */ +#define GRAD_LOG_ALERT 1 /* action must be taken immediately */ +#define GRAD_LOG_CRIT 2 /* critical conditions */ +#define GRAD_LOG_ERR 3 /* error conditions */ +#define GRAD_LOG_WARN 4 /* warning conditions */ +#define GRAD_LOG_NOTICE 5 /* normal but signification condition */ +#define GRAD_LOG_INFO 6 /* informational */ +#define GRAD_LOG_DEBUG 7 /* debug-level messages */ +#define GRAD_LOG_PRIMASK 0x0007 /* mask to extract priority part */ + +#define GRAD_LOG_CAT(v) (((v)&GRAD_LOG_CATMASK)>>3) +#define GRAD_LOG_PRI(v) ((v)&GRAD_LOG_PRIMASK) +#define GRAD_LOG_MASK(pri) (1<<(pri)) +#define GRAD_LOG_UPTO(pri) ((1<<((pri)+1))-1) /* Additional flags */ -#define L_PERROR 0x8000 +#define GRAD_LOG_PERROR 0x8000 #define GRAD_MKSTRING(x) #x #define grad_insist(cond) \ @@ -590,10 +590,10 @@ grad_uint32_t grad_first_ip(); /* Loadable Modules Suppert */ #define __s_cat3__(a,b,c) a ## b ## c -#define RDL_EXPORT(module,name) __s_cat3__(module,_LTX_,name) +#define GRAD_DL_EXPORT(module,name) __s_cat3__(module,_LTX_,name) -typedef int (*rdl_init_t) (void); -typedef void (*rdl_done_t) (void); +typedef int (*grad_dl_init_t) (void); +typedef void (*grad_dl_done_t) (void); /* slist.c */ #define GRAD_SLIST_BUCKET_SIZE 1024 diff --git a/include/radiusd.h b/include/radiusd.h index 2e4f69be..134832d0 100644 --- a/include/radiusd.h +++ b/include/radiusd.h @@ -1,6 +1,6 @@ /* This file is part of GNU Radius. Copyright (C) 2000,2001,2002,2003,2004,2005, - 2007 Free Software Foundation, Inc. + 2007,2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -699,7 +699,7 @@ typedef struct channel Channel; struct channel { char *name; - int pmask[L_NCAT]; + int pmask[GRAD_LOG_NCAT]; int mode; /* LM_ constant */ union { struct { diff --git a/include/radsql.h b/include/radsql.h index 4616b01f..5a86af97 100644 --- a/include/radsql.h +++ b/include/radsql.h @@ -1,5 +1,5 @@ /* This file is part of GNU Radius. - Copyright (C) 2000,2001,2002,2003,2007 Free Software Foundation, Inc. + Copyright (C) 2000,2001,2002,2003,2007,2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -22,7 +22,7 @@ #ifdef HAVE_LIBLTDL # define DECL_SQL_DISPATCH_TAB(mod) \ - SQL_DISPATCH_TAB RDL_EXPORT(mod,dispatch_tab) + SQL_DISPATCH_TAB GRAD_DL_EXPORT(mod,dispatch_tab) #else # define __s_cat2__(a,b) a ## b # define DECL_SQL_DISPATCH_TAB(mod) \ @@ -1,5 +1,6 @@ /* This file is part of GNU Radius. - Copyright (C) 2000,2001,2002,2003,2004,2007 Free Software Foundation, Inc. + Copyright (C) 2000,2001,2002,2003,2004,2007, + 2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -88,7 +89,7 @@ grad_avp_create(int attr) dict = grad_attr_number_to_dict(attr); if (!dict) { - grad_log(L_ERR, + grad_log(GRAD_LOG_ERR, _("make_pair(): attribute %d not found in dictionary"), attr); return NULL; diff --git a/lib/client.c b/lib/client.c index dd838918..6bb5c07a 100644 --- a/lib/client.c +++ b/lib/client.c @@ -124,7 +124,7 @@ grad_client_recv(grad_uint32_t host, u_short udp_port, char *secret, totallen = ntohs(auth->length); if (totallen != length) { - grad_log(L_ERR, + grad_log(GRAD_LOG_ERR, _("Actual request length does not match reported length (%d, %d)"), totallen, length); return NULL; @@ -139,7 +139,7 @@ grad_client_recv(grad_uint32_t host, u_short udp_port, char *secret, GRAD_DEBUG1(1, "received %s", grad_request_code_to_name(auth->code)); if (memcmp(reply_digest, calc_digest, GRAD_AUTHENTICATOR_LENGTH) != 0) { - grad_log(L_WARN, _("Received invalid reply digest from server")); + grad_log(GRAD_LOG_WARN, _("Received invalid reply digest from server")); } req = grad_decode_pdu(host, udp_port, buffer, length); @@ -219,7 +219,7 @@ wait_for_reply(int fd, unsigned timeout) "select interrupted. retrying."); continue; } - grad_log(L_NOTICE, _("select() interrupted")); + grad_log(GRAD_LOG_NOTICE, _("select() interrupted")); break; } @@ -248,12 +248,12 @@ grad_client_send0(grad_server_queue_t *config, int port_type, int code, int id; if (port_type < 0 || port_type > 2) { - grad_log(L_ERR, _("invalid port type")); + grad_log(GRAD_LOG_ERR, _("invalid port type")); return NULL; } sockfd = socket(PF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { - grad_log(L_ERR|L_PERROR, "socket"); + grad_log(GRAD_LOG_ERR|GRAD_LOG_PERROR, "socket"); return NULL; } @@ -264,7 +264,7 @@ grad_client_send0(grad_server_queue_t *config, int port_type, int code, htonl(config->source_ip) : INADDR_ANY; sin->sin_port = 0; if (bind(sockfd, &salocal, sizeof (struct sockaddr_in))) { - grad_log(L_ERR|L_PERROR, "bind"); + grad_log(GRAD_LOG_ERR|GRAD_LOG_PERROR, "bind"); close(sockfd); return NULL; } @@ -332,7 +332,7 @@ grad_client_send0(grad_server_queue_t *config, int port_type, int code, if (sendto(sockfd, pdu, size, 0, &saremote, sizeof(struct sockaddr_in)) == -1) { - grad_log(L_ERR|L_PERROR, "sendto"); + grad_log(GRAD_LOG_ERR|GRAD_LOG_PERROR, "sendto"); } salen = sizeof (saremote); @@ -352,7 +352,7 @@ grad_client_send0(grad_server_queue_t *config, int port_type, int code, recv_buf, result); else - grad_log(L_ERR|L_PERROR, + grad_log(GRAD_LOG_ERR|GRAD_LOG_PERROR, _("error receiving data from %s:%d"), grad_ip_iptostr(server->addr, ipbuf), server->port[port_type]); @@ -413,7 +413,7 @@ parse_client_config(void *closure, int argc, char **argv, grad_locus_t *loc) switch (grad_xlat_keyword(kwd, argv[0], TOK_INVALID)) { case TOK_INVALID: - grad_log_loc(L_ERR, loc, _("unknown keyword")); + grad_log_loc(GRAD_LOG_ERR, loc, _("unknown keyword")); break; case TOK_SOURCE_IP: @@ -422,7 +422,7 @@ parse_client_config(void *closure, int argc, char **argv, grad_locus_t *loc) case TOK_SERVER: if (argc != 6) { - grad_log_loc(L_ERR, loc, _("wrong number of fields")); + grad_log_loc(GRAD_LOG_ERR, loc, _("wrong number of fields")); break; } memset(&serv, 0, sizeof serv); @@ -430,7 +430,7 @@ parse_client_config(void *closure, int argc, char **argv, grad_locus_t *loc) serv.name = argv[1]; serv.addr = grad_ip_gethostaddr(argv[2]); if (!serv.addr) { - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, _("bad IP address or host name")); break; } @@ -439,14 +439,14 @@ parse_client_config(void *closure, int argc, char **argv, grad_locus_t *loc) serv.port[0] = strtol(argv[4], &p, 0); if (*p) { - grad_log_loc(L_ERR, loc, _("bad port number %s"), + grad_log_loc(GRAD_LOG_ERR, loc, _("bad port number %s"), argv[4]); break; } serv.port[1] = strtol(argv[5], &p, 0); if (*p) { - grad_log_loc(L_ERR, loc, _("bad port number %s"), + grad_log_loc(GRAD_LOG_ERR, loc, _("bad port number %s"), argv[4]); break; } @@ -458,13 +458,13 @@ parse_client_config(void *closure, int argc, char **argv, grad_locus_t *loc) case TOK_TIMEOUT: client->timeout = strtol(argv[1], &p, 0); if (*p) - grad_log_loc(L_ERR, loc, _("bad timeout value")); + grad_log_loc(GRAD_LOG_ERR, loc, _("bad timeout value")); break; case TOK_RETRY: client->retries = strtol(argv[1], &p, 0); if (*p) - grad_log_loc(L_ERR, loc, _("bad retry value")); + grad_log_loc(GRAD_LOG_ERR, loc, _("bad retry value")); break; case TOK_DEBUG: diff --git a/lib/debug.c b/lib/debug.c index 315a17f0..857a643f 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -1,5 +1,6 @@ /* This file is part of GNU Radius. - Copyright (C) 2000,2001,2002,2003,2004,2007 Free Software Foundation, Inc. + Copyright (C) 2000,2001,2002,2003,2004,2007, + 2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -207,14 +208,14 @@ grad_debug_p(char *name, int level) int grad_set_module_debug_level(char *name, int level) { - grad_log(L_ERR, _("compiled without debugging support")); + grad_log(GRAD_LOG_ERR, _("compiled without debugging support")); } /*ARGSUSED*/ void grad_set_debug_levels(char *str) { - grad_log(L_ERR, _("compiled without debugging support")); + grad_log(GRAD_LOG_ERR, _("compiled without debugging support")); } void diff --git a/lib/deflog.c b/lib/deflog.c index 5d0b4dc1..f8217784 100644 --- a/lib/deflog.c +++ b/lib/deflog.c @@ -1,5 +1,5 @@ /* This file is part of GNU Radius. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007,2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -49,7 +49,7 @@ grad_default_logger(int level, const char *fmt, va_list ap) { fprintf(stderr, "%s: %s: ", program_invocation_short_name, - priname[level & L_PRIMASK]); + priname[level & GRAD_LOG_PRIMASK]); if (loc) { fprintf(stderr, "%s:%lu:", loc->file, (unsigned long) loc->line); if (func_name) @@ -1,6 +1,6 @@ /* This file is part of GNU Radius. Copyright (C) 2000,2001,2002,2003,2004,2005, - 2006,2007 Free Software Foundation, Inc. + 2006,2007,2008 Free Software Foundation, Inc. Written by Sergey Poznyakoff @@ -120,10 +120,10 @@ static int nfields(int fc, int minf, int maxf, grad_locus_t *loc) { if (fc < minf) { - grad_log_loc(L_ERR, loc, "%s", _("too few fields")); + grad_log_loc(GRAD_LOG_ERR, loc, "%s", _("too few fields")); return -1; } else if (maxf != -1 && fc > maxf) { - grad_log_loc(L_ERR, loc, "%s", _("too many fields")); + grad_log_loc(GRAD_LOG_ERR, loc, "%s", _("too many fields")); return -1; } return 0; @@ -254,7 +254,7 @@ parse_flags(char **ptr, int *flags, grad_locus_t *loc) for (p = *ptr+1, i = 0; i < GRAD_CF_MAX; i++) { if (*p == 0) { - grad_log_loc(L_ERR, loc, _("missing ]"), *p); + grad_log_loc(GRAD_LOG_ERR, loc, _("missing ]"), *p); return 1; } switch (*p++) { @@ -269,7 +269,7 @@ parse_flags(char **ptr, int *flags, grad_locus_t *loc) p--; goto stop; default: - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, _("invalid syntax flag %c"), p[-1]); return 1; @@ -282,7 +282,7 @@ parse_flags(char **ptr, int *flags, grad_locus_t *loc) *flags &= ~GRAD_AF_RHS(i); break; default: - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, _("invalid syntax flag %c"), p[-1]); return 1; @@ -360,7 +360,7 @@ parse_attr_properties(grad_locus_t *loc, char *str, int *flags, int *prop) /* Retained for compatibility */ break; default: - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, _("invalid flag %c"), *p); errcnt++; @@ -416,7 +416,7 @@ _dict_attribute(struct parse_data *pd, int fc, char **fv, grad_locus_t *loc) value = strtol(ATTR_VALUE, &p, 0); if (*p) { - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, _("value not a number (near %s)"), p); pd->errcnt++; @@ -427,7 +427,7 @@ _dict_attribute(struct parse_data *pd, int fc, char **fv, grad_locus_t *loc) type = GRAD_TYPE_STRING; fp = dict_find_parser(value); if (!fp) { - grad_log_loc(L_WARN, loc, + grad_log_loc(GRAD_LOG_WARN, loc, _("no parser registered for this attribute")); return 0; } @@ -435,7 +435,7 @@ _dict_attribute(struct parse_data *pd, int fc, char **fv, grad_locus_t *loc) type = grad_xlat_keyword(type_kw, ATTR_TYPE, GRAD_TYPE_INVALID); if (type == GRAD_TYPE_INVALID) { - grad_log_loc(L_ERR, loc, + grad_log_loc(GRAD_LOG_ERR, loc, "%s", _("invalid type")); pd->errcnt++; @@ -444,7 +444,7 @@ _dict_attribute(struct parse_data *pd, int fc, char **fv, grad_locus_t *loc) if (HAS_VENDOR(fc, fv)) { if ((vendor = grad_vendor_name_to_id(ATTR_VENDOR)) == 0) { - |