More changes to make a common naming scheme. This breaks
authoraland <aland>
Fri, 23 Nov 2007 13:46:51 +0000 (13:46 +0000)
committeraland <aland>
Fri, 23 Nov 2007 13:46:51 +0000 (13:46 +0000)
patches from third party maintainers, but has to be done
before a final 2.0.

perl -pi -e 's/LRAD_/FR_/g;s/lrad_/fr_/g' `cat files`

74 files changed:
src/include/event.h
src/include/hash.h
src/include/libradius.h
src/include/md4.h
src/include/md5.h
src/include/packet.h
src/include/radiusd.h
src/include/realms.h
src/include/sha1.h
src/include/token.h
src/include/vqp.h
src/lib/dict.c
src/lib/event.c
src/lib/fifo.c
src/lib/filters.c
src/lib/getaddrinfo.c
src/lib/hash.c
src/lib/isaac.c
src/lib/misc.c
src/lib/packet.c
src/lib/print.c
src/lib/radius.c
src/lib/token.c
src/lib/valuepair.c
src/lib/vqp.c
src/main/auth.c
src/main/client.c
src/main/conffile.c
src/main/crypt.c
src/main/detail.c
src/main/evaluate.c
src/main/event.c
src/main/files.c
src/main/listen.c
src/main/log.c
src/main/mainconfig.c
src/main/modcall.c
src/main/modules.c
src/main/radclient.c
src/main/radsniff.c
src/main/realms.c
src/main/session.c
src/main/threads.c
src/main/vmps.c
src/modules/rlm_checkval/rlm_checkval.c
src/modules/rlm_dbm/rlm_dbm_parser.c
src/modules/rlm_detail/rlm_detail.c
src/modules/rlm_digest/rlm_digest.c
src/modules/rlm_eap/eap.h
src/modules/rlm_eap/radeapclient.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/state.c
src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c
src/modules/rlm_eap/types/rlm_eap_md5/rlm_eap_md5.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_files/rlm_files.c
src/modules/rlm_ippool/rlm_ippool.c
src/modules/rlm_ippool/rlm_ippool_tool.c
src/modules/rlm_jradius/rlm_jradius.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_otp/otp_mppe.c
src/modules/rlm_otp/otp_pwe.c
src/modules/rlm_otp/otp_radstate.c
src/modules/rlm_otp/otp_util.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_policy/evaluate.c
src/modules/rlm_policy/parse.c
src/modules/rlm_policy/rlm_policy.h
src/modules/rlm_realm/rlm_realm.c
src/modules/rlm_smb/rfcnb-util.c
src/modules/rlm_sql/sql.c
src/modules/rlm_sqlippool/rlm_sqlippool.c
src/modules/rlm_unix/rlm_unix.c

index 66a24ac..bc21ba0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LRAD_EVENT_H
-#define LRAD_EVENT_H
+#ifndef FR_EVENT_H
+#define FR_EVENT_H
 
 /*
  * event.h     Simple event queue
 #include <freeradius-devel/ident.h>
 RCSIDH(event_h, "$Id$")
 
-typedef struct lrad_event_list_t lrad_event_list_t;
-typedef struct lrad_event_t lrad_event_t;
+typedef struct fr_event_list_t fr_event_list_t;
+typedef struct fr_event_t fr_event_t;
 
-typedef        void (*lrad_event_callback_t)(void *);
-typedef        void (*lrad_event_status_t)(struct timeval *);
-typedef void (*lrad_event_fd_handler_t)(lrad_event_list_t *el, int sock, void *ctx);
+typedef        void (*fr_event_callback_t)(void *);
+typedef        void (*fr_event_status_t)(struct timeval *);
+typedef void (*fr_event_fd_handler_t)(fr_event_list_t *el, int sock, void *ctx);
 
-lrad_event_list_t *lrad_event_list_create(lrad_event_status_t status);
-void lrad_event_list_free(lrad_event_list_t *el);
+fr_event_list_t *fr_event_list_create(fr_event_status_t status);
+void fr_event_list_free(fr_event_list_t *el);
 
-int lrad_event_list_num_elements(lrad_event_list_t *el);
+int fr_event_list_num_elements(fr_event_list_t *el);
 
-int lrad_event_insert(lrad_event_list_t *el,
-                     lrad_event_callback_t callback,
-                     void *ctx, struct timeval *when, lrad_event_t **ev_p);
-int lrad_event_delete(lrad_event_list_t *el, lrad_event_t **ev_p);
+int fr_event_insert(fr_event_list_t *el,
+                     fr_event_callback_t callback,
+                     void *ctx, struct timeval *when, fr_event_t **ev_p);
+int fr_event_delete(fr_event_list_t *el, fr_event_t **ev_p);
 
-int lrad_event_run(lrad_event_list_t *el, struct timeval *when);
+int fr_event_run(fr_event_list_t *el, struct timeval *when);
 
-int lrad_event_now(lrad_event_list_t *el, struct timeval *when);
+int fr_event_now(fr_event_list_t *el, struct timeval *when);
 
-int lrad_event_fd_insert(lrad_event_list_t *el, int type, int fd,
-                        lrad_event_fd_handler_t handler, void *ctx);
-int lrad_event_fd_delete(lrad_event_list_t *el, int type, int fd);
-int lrad_event_loop(lrad_event_list_t *el);
-void lrad_event_loop_exit(lrad_event_list_t *el, int code);
+int fr_event_fd_insert(fr_event_list_t *el, int type, int fd,
+                        fr_event_fd_handler_t handler, void *ctx);
+int fr_event_fd_delete(fr_event_list_t *el, int type, int fd);
+int fr_event_loop(fr_event_list_t *el);
+void fr_event_loop_exit(fr_event_list_t *el, int code);
 
-#endif /* LRAD_HASH_H */
+#endif /* FR_HASH_H */
index 4f21954..847ff03 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LRAD_HASH_H
-#define LRAD_HASH_H
+#ifndef FR_HASH_H
+#define FR_HASH_H
 
 /*
  * hash.h      Structures and prototypes
@@ -31,34 +31,34 @@ RCSIDH(hash_h, "$Id$")
  *     Fast hash, which isn't too bad.  Don't use for cryptography,
  *     just for hashing internal data.
  */
-uint32_t lrad_hash(const void *, size_t);
-uint32_t lrad_hash_update(const void *data, size_t size, uint32_t hash);
-uint32_t lrad_hash_string(const char *p);
+uint32_t fr_hash(const void *, size_t);
+uint32_t fr_hash_update(const void *data, size_t size, uint32_t hash);
+uint32_t fr_hash_string(const char *p);
 
 /*
  *     If you need fewer than 32-bits of hash, use this macro to get
  *     the number of bits in the hash you need.  The upper bits of the
  *     hash will be set to zero.
  */
-uint32_t lrad_hash_fold(uint32_t hash, int bits);
+uint32_t fr_hash_fold(uint32_t hash, int bits);
 
-typedef struct lrad_hash_table_t lrad_hash_table_t;
-typedef void (*lrad_hash_table_free_t)(void *);
-typedef uint32_t (*lrad_hash_table_hash_t)(const void *);
-typedef int (*lrad_hash_table_cmp_t)(const void *, const void *);
-typedef int (*lrad_hash_table_walk_t)(void * /* ctx */, void * /* data */);
+typedef struct fr_hash_table_t fr_hash_table_t;
+typedef void (*fr_hash_table_free_t)(void *);
+typedef uint32_t (*fr_hash_table_hash_t)(const void *);
+typedef int (*fr_hash_table_cmp_t)(const void *, const void *);
+typedef int (*fr_hash_table_walk_t)(void * /* ctx */, void * /* data */);
 
-lrad_hash_table_t *lrad_hash_table_create(lrad_hash_table_hash_t hashNode,
-                                         lrad_hash_table_cmp_t cmpNode,
-                                         lrad_hash_table_free_t freeNode);
-void           lrad_hash_table_free(lrad_hash_table_t *ht);
-int            lrad_hash_table_insert(lrad_hash_table_t *ht, void *data);
-int            lrad_hash_table_delete(lrad_hash_table_t *ht, const void *data);
-void           *lrad_hash_table_yank(lrad_hash_table_t *ht, const void *data);
-int            lrad_hash_table_replace(lrad_hash_table_t *ht, void *data);
-void           *lrad_hash_table_finddata(lrad_hash_table_t *ht, const void *data);
-int            lrad_hash_table_num_elements(lrad_hash_table_t *ht);
-int            lrad_hash_table_walk(lrad_hash_table_t *ht,
-                                    lrad_hash_table_walk_t callback,
+fr_hash_table_t *fr_hash_table_create(fr_hash_table_hash_t hashNode,
+                                         fr_hash_table_cmp_t cmpNode,
+                                         fr_hash_table_free_t freeNode);
+void           fr_hash_table_free(fr_hash_table_t *ht);
+int            fr_hash_table_insert(fr_hash_table_t *ht, void *data);
+int            fr_hash_table_delete(fr_hash_table_t *ht, const void *data);
+void           *fr_hash_table_yank(fr_hash_table_t *ht, const void *data);
+int            fr_hash_table_replace(fr_hash_table_t *ht, void *data);
+void           *fr_hash_table_finddata(fr_hash_table_t *ht, const void *data);
+int            fr_hash_table_num_elements(fr_hash_table_t *ht);
+int            fr_hash_table_walk(fr_hash_table_t *ht,
+                                    fr_hash_table_walk_t callback,
                                     void *ctx);
-#endif /* LRAD_HASH_H */
+#endif /* FR_HASH_H */
index ad09f77..21f50ea 100644 (file)
@@ -151,7 +151,7 @@ typedef struct value_pair {
        int                     vendor;
        int                     type;
        int                     length; /* of data */
-       LRAD_TOKEN              operator;
+       FR_TOKEN                operator;
         ATTR_FLAGS              flags;
        struct value_pair       *next;
        uint32_t                lvalue;
@@ -180,13 +180,13 @@ typedef struct value_pair {
 #endif
 
 
-typedef struct lrad_ipaddr_t {
+typedef struct fr_ipaddr_t {
        int             af;     /* address family */
        union {
                struct in_addr  ip4addr;
                struct in6_addr ip6addr; /* maybe defined in missing.h */
        } ipaddr;
-} lrad_ipaddr_t;
+} fr_ipaddr_t;
 
 /*
  *     vector:         Request authenticator from access-request packet
@@ -199,8 +199,8 @@ typedef struct lrad_ipaddr_t {
  */
 typedef struct radius_packet {
        int                     sockfd;
-       lrad_ipaddr_t           src_ipaddr;
-        lrad_ipaddr_t          dst_ipaddr;
+       fr_ipaddr_t             src_ipaddr;
+        fr_ipaddr_t            dst_ipaddr;
        uint16_t                src_port;
        uint16_t                dst_port;
        int                     id;
@@ -277,7 +277,7 @@ void fr_hmac_sha1(const uint8_t *text, int text_len,
 int            rad_send(RADIUS_PACKET *, const RADIUS_PACKET *, const char *secret);
 int            rad_packet_ok(RADIUS_PACKET *packet);
 RADIUS_PACKET  *rad_recv(int fd);
-ssize_t rad_recv_header(int sockfd, lrad_ipaddr_t *src_ipaddr, int *src_port,
+ssize_t rad_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, int *src_port,
                        int *code);
 void           rad_recv_discard(int sockfd);
 int            rad_verify(RADIUS_PACKET *packet, RADIUS_PACKET *original,
@@ -323,8 +323,8 @@ void                pairmove(VALUE_PAIR **to, VALUE_PAIR **from);
 void           pairmove2(VALUE_PAIR **to, VALUE_PAIR **from, int attr);
 VALUE_PAIR     *pairparsevalue(VALUE_PAIR *vp, const char *value);
 VALUE_PAIR     *pairmake(const char *attribute, const char *value, int operator);
-VALUE_PAIR     *pairread(char **ptr, LRAD_TOKEN *eol);
-LRAD_TOKEN     userparse(char *buffer, VALUE_PAIR **first_pair);
+VALUE_PAIR     *pairread(char **ptr, FR_TOKEN *eol);
+FR_TOKEN       userparse(char *buffer, VALUE_PAIR **first_pair);
 VALUE_PAIR     *readvp2(FILE *fp, int *pfiledone, const char *errprefix);
 
 /*
@@ -356,8 +356,8 @@ uint8_t             *ifid_aton(const char *ifid_str, uint8_t *ifid);
 int            rad_lockfd(int fd, int lock_len);
 int            rad_lockfd_nonblock(int fd, int lock_len);
 int            rad_unlockfd(int fd, int lock_len);
-void           lrad_bin2hex(const uint8_t *bin, char *hex, int len);
-int            lrad_hex2bin(const char *hex, uint8_t *bin, int len);
+void           fr_bin2hex(const uint8_t *bin, char *hex, int len);
+int            fr_hex2bin(const char *hex, uint8_t *bin, int len);
 #ifndef HAVE_INET_PTON
 int            inet_pton(int af, const char *src, void *dst);
 #endif
@@ -367,10 +367,10 @@ const char        *inet_ntop(int af, const void *src, char *dst, size_t cnt);
 #ifndef HAVE_CLOSEFROM
 int            closefrom(int fd);
 #endif
-int lrad_ipaddr_cmp(const lrad_ipaddr_t *a, const lrad_ipaddr_t *b);
+int fr_ipaddr_cmp(const fr_ipaddr_t *a, const fr_ipaddr_t *b);
 
-int            ip_hton(const char *src, int af, lrad_ipaddr_t *dst);
-const char     *ip_ntoh(const lrad_ipaddr_t *src, char *dst, size_t cnt);
+int            ip_hton(const char *src, int af, fr_ipaddr_t *dst);
+const char     *ip_ntoh(const fr_ipaddr_t *src, char *dst, size_t cnt);
 
 
 
@@ -382,23 +382,23 @@ void              print_abinary(VALUE_PAIR *vp, char *buffer, int len);
 
 /* random numbers in isaac.c */
 /* context of random number generator */
-typedef struct lrad_randctx {
+typedef struct fr_randctx {
   uint32_t randcnt;
   uint32_t randrsl[256];
   uint32_t randmem[256];
   uint32_t randa;
   uint32_t randb;
   uint32_t randc;
-} lrad_randctx;
+} fr_randctx;
 
-void lrad_isaac(lrad_randctx *ctx);
-void lrad_randinit(lrad_randctx *ctx, int flag);
-uint32_t lrad_rand(void);      /* like rand(), but better. */
-void lrad_rand_seed(const void *, size_t ); /* seed the random pool */
+void fr_isaac(fr_randctx *ctx);
+void fr_randinit(fr_randctx *ctx, int flag);
+uint32_t fr_rand(void);        /* like rand(), but better. */
+void fr_rand_seed(const void *, size_t ); /* seed the random pool */
 
 
 /* crypt wrapper from crypt.c */
-int lrad_crypt_check(const char *key, const char *salt);
+int fr_crypt_check(const char *key, const char *salt);
 
 /* rbtree.c */
 typedef struct rbtree_t rbtree_t;
@@ -437,14 +437,14 @@ int rbtree_walk(rbtree_t *tree, RBTREE_ORDER order, int (*callback)(void *, void
 /*
  *     FIFOs
  */
-typedef struct lrad_fifo_t lrad_fifo_t;
-typedef void (*lrad_fifo_free_t)(void *);
-lrad_fifo_t *lrad_fifo_create(int max_entries, lrad_fifo_free_t freeNode);
-void lrad_fifo_free(lrad_fifo_t *fi);
-int lrad_fifo_push(lrad_fifo_t *fi, void *data);
-void *lrad_fifo_pop(lrad_fifo_t *fi);
-void *lrad_fifo_peek(lrad_fifo_t *fi);
-int lrad_fifo_num_elements(lrad_fifo_t *fi);
+typedef struct fr_fifo_t fr_fifo_t;
+typedef void (*fr_fifo_free_t)(void *);
+fr_fifo_t *fr_fifo_create(int max_entries, fr_fifo_free_t freeNode);
+void fr_fifo_free(fr_fifo_t *fi);
+int fr_fifo_push(fr_fifo_t *fi, void *data);
+void *fr_fifo_pop(fr_fifo_t *fi);
+void *fr_fifo_peek(fr_fifo_t *fi);
+int fr_fifo_num_elements(fr_fifo_t *fi);
 
 #include <freeradius-devel/packet.h>
 
index 5442ad6..0f8c269 100644 (file)
@@ -6,8 +6,8 @@
  *
  */
 
-#ifndef _LRAD_MD4_H
-#define _LRAD_MD4_H
+#ifndef _FR_MD4_H
+#define _FR_MD4_H
 
 #include <freeradius-devel/ident.h>
 RCSIDH(md4_h, "$Id$")
@@ -78,4 +78,4 @@ void   fr_MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
                __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
 /*__END_DECLS*/
 
-#endif /* _LRAD_MD4_H */
+#endif /* _FR_MD4_H */
index 071b03a..4a20c93 100644 (file)
@@ -6,8 +6,8 @@
  *
  */
 
-#ifndef _LRAD_MD5_H
-#define _LRAD_MD5_H
+#ifndef _FR_MD5_H
+#define _FR_MD5_H
 
 #include <freeradius-devel/ident.h>
 RCSIDH(md5_h, "$Id$")
@@ -67,4 +67,4 @@ void   fr_MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH])
 /*             __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)))*/;
 /* __END_DECLS */
 
-#endif /* _LRAD_MD5_H */
+#endif /* _FR_MD5_H */
index 120dd68..f49d5cb 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LRAD_PACKET_H
-#define LRAD_PACKET_H
+#ifndef FR_PACKET_H
+#define FR_PACKET_H
 
 /*
  * packet.h    Structures and prototypes
 #include <freeradius-devel/ident.h>
 RCSIDH(packet_h, "$Id$")
 
-uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet);
-uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet);
-int lrad_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b);
-void lrad_request_from_reply(RADIUS_PACKET *request,
+uint32_t fr_request_packet_hash(const RADIUS_PACKET *packet);
+uint32_t fr_reply_packet_hash(const RADIUS_PACKET *packet);
+int fr_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b);
+void fr_request_from_reply(RADIUS_PACKET *request,
                             const RADIUS_PACKET *reply);
-int lrad_socket(lrad_ipaddr_t *ipaddr, int port);
+int fr_socket(fr_ipaddr_t *ipaddr, int port);
 
-typedef struct lrad_packet_list_t lrad_packet_list_t;
+typedef struct fr_packet_list_t fr_packet_list_t;
 
-lrad_packet_list_t *lrad_packet_list_create(int alloc_id);
-void lrad_packet_list_free(lrad_packet_list_t *pl);
-int lrad_packet_list_insert(lrad_packet_list_t *pl,
+fr_packet_list_t *fr_packet_list_create(int alloc_id);
+void fr_packet_list_free(fr_packet_list_t *pl);
+int fr_packet_list_insert(fr_packet_list_t *pl,
                            RADIUS_PACKET **request_p);
 
-RADIUS_PACKET **lrad_packet_list_find(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_find(fr_packet_list_t *pl,
                                      RADIUS_PACKET *request);
-RADIUS_PACKET **lrad_packet_list_find_byreply(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_find_byreply(fr_packet_list_t *pl,
                                              RADIUS_PACKET *reply);
-RADIUS_PACKET **lrad_packet_list_yank(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_yank(fr_packet_list_t *pl,
                                      RADIUS_PACKET *request);
-int lrad_packet_list_num_elements(lrad_packet_list_t *pl);
-int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
+int fr_packet_list_num_elements(fr_packet_list_t *pl);
+int fr_packet_list_id_alloc(fr_packet_list_t *pl,
                              RADIUS_PACKET *request);
-int lrad_packet_list_id_free(lrad_packet_list_t *pl,
+int fr_packet_list_id_free(fr_packet_list_t *pl,
                             RADIUS_PACKET *request);
-int lrad_packet_list_socket_add(lrad_packet_list_t *pl, int sockfd);
-int lrad_packet_list_socket_remove(lrad_packet_list_t *pl, int sockfd);
-int lrad_packet_list_walk(lrad_packet_list_t *pl, void *ctx,
-                         lrad_hash_table_walk_t callback);
-int lrad_packet_list_fd_set(lrad_packet_list_t *pl, fd_set *set);
-RADIUS_PACKET *lrad_packet_list_recv(lrad_packet_list_t *pl, fd_set *set);
+int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd);
+int fr_packet_list_socket_remove(fr_packet_list_t *pl, int sockfd);
+int fr_packet_list_walk(fr_packet_list_t *pl, void *ctx,
+                         fr_hash_table_walk_t callback);
+int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set);
+RADIUS_PACKET *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set);
 
-int lrad_packet_list_num_incoming(lrad_packet_list_t *pl);
-int lrad_packet_list_num_outgoing(lrad_packet_list_t *pl);
+int fr_packet_list_num_incoming(fr_packet_list_t *pl);
+int fr_packet_list_num_outgoing(fr_packet_list_t *pl);
 
 
 #ifndef offsetof
@@ -74,5 +74,5 @@ int lrad_packet_list_num_outgoing(lrad_packet_list_t *pl);
  *     the member from the returned pointer, and cast it to the
  *     required type.
  */
-# define lrad_packet2myptr(TYPE, MEMBER, PTR) (TYPE *) (((char *)PTR) - offsetof(TYPE, MEMBER))
-#endif /* LRAD_PACKET_H */
+# define fr_packet2myptr(TYPE, MEMBER, PTR) (TYPE *) (((char *)PTR) - offsetof(TYPE, MEMBER))
+#endif /* FR_PACKET_H */
index 4c00583..0fa2c33 100644 (file)
@@ -44,7 +44,7 @@ typedef struct request_data_t request_data_t;
 typedef struct rad_snmp_client_entry_t rad_snmp_client_entry_t;
 
 typedef struct radclient {
-       lrad_ipaddr_t           ipaddr;
+       fr_ipaddr_t             ipaddr;
        int                     prefix;
        char                    *longname;
        char                    *secret;
@@ -124,9 +124,9 @@ struct auth_req {
        int                     child_state;
        RAD_LISTEN_TYPE         priority;
 
-       lrad_event_t            *ev;
+       fr_event_t              *ev;
        struct timeval          next_when;
-       lrad_event_callback_t   next_callback;
+       fr_event_callback_t     next_callback;
 
        int                     in_request_hash;
        int                     in_proxy_hash;
@@ -212,7 +212,7 @@ typedef enum radlog_dest_t {
 typedef struct main_config_t {
        struct main_config *next;
        int             refcount;
-       lrad_ipaddr_t   myip;   /* from the command-line only */
+       fr_ipaddr_t     myip;   /* from the command-line only */
        int             port;   /* from the command-line only */
        int             log_auth;
        int             log_auth_badpass;
@@ -364,13 +364,13 @@ RADCLIENT_LIST    *clients_parse_section(CONF_SECTION *section);
 void           client_free(RADCLIENT *client);
 int            client_add(RADCLIENT_LIST *clients, RADCLIENT *client);
 RADCLIENT      *client_find(const RADCLIENT_LIST *clients,
-                            const lrad_ipaddr_t *ipaddr);
+                            const fr_ipaddr_t *ipaddr);
 const char     *client_name(const RADCLIENT_LIST *clients,
-                            const lrad_ipaddr_t *ipaddr);
+                            const fr_ipaddr_t *ipaddr);
 RADCLIENT      *client_findbynumber(const RADCLIENT_LIST *clients,
                                     int number);
-RADCLIENT      *client_find_old(const lrad_ipaddr_t *ipaddr);
-const char     *client_name_old(const lrad_ipaddr_t *ipaddr);
+RADCLIENT      *client_find_old(const fr_ipaddr_t *ipaddr);
+const char     *client_name_old(const fr_ipaddr_t *ipaddr);
 
 /* files.c */
 int            pairlist_read(const char *file, PAIR_LIST **list, int complain);
index c94f3ef..71b7edf 100644 (file)
@@ -29,7 +29,7 @@ typedef struct home_server {
 
        const char      *hostname;
 
-       lrad_ipaddr_t   ipaddr;
+       fr_ipaddr_t     ipaddr;
 
 
        int             port;
@@ -41,7 +41,7 @@ typedef struct home_server {
 
        const char      *secret;
 
-       lrad_event_t    *ev;
+       fr_event_t      *ev;
        struct timeval  when;
 
        int             response_window;
@@ -106,6 +106,6 @@ void realms_free(void);
 REALM *realm_find(const char *name);
 
 home_server *home_server_ldb(const char *realmname, home_pool_t *pool, REQUEST *request);
-home_server *home_server_find(lrad_ipaddr_t *ipaddr, int port);
+home_server *home_server_find(fr_ipaddr_t *ipaddr, int port);
 
 #endif /* REALMS_H */
index 97cd55b..c3cec0c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LRAD_SHA1_H
-#define _LRAD_SHA1_H
+#ifndef _FR_SHA1_H
+#define _FR_SHA1_H
 
 /*
  *  FreeRADIUS defines to ensure globally unique SHA1 function names,
@@ -34,4 +34,4 @@ void fr_fr_SHA1FinalNoLen(uint8_t digest[20], fr_SHA1_CTX* context);
 extern void fips186_2prf(uint8_t mk[20], uint8_t finalkey[160]);
 
 
-#endif /* _LRAD_SHA1_H */
+#endif /* _FR_SHA1_H */
index 4628c63..52d5da3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LRAD_TOKEN_H
-#define LRAD_TOKEN_H
+#ifndef FR_TOKEN_H
+#define FR_TOKEN_H
 
 /*
  * token.h     Special tokens.
@@ -26,7 +26,7 @@
 #include <freeradius-devel/ident.h>
 RCSIDH(token_h, "$Id$")
 
-typedef enum lrad_token_t {
+typedef enum fr_token_t {
   T_OP_INVALID = 0,            /* invalid token */
   T_EOL,                       /* end of line */
   T_LCBRACE,                   /* { */
@@ -56,24 +56,24 @@ typedef enum lrad_token_t {
   T_SINGLE_QUOTED_STRING,      /* 'foo'        25 */
   T_BACK_QUOTED_STRING,                /* `foo` */
   T_TOKEN_LAST
-} LRAD_TOKEN;
+} FR_TOKEN;
 
 #define T_EQSTART      T_OP_ADD
 #define        T_EQEND         (T_OP_CMP_EQ + 1)
 
-typedef struct LRAD_NAME_NUMBER {
+typedef struct FR_NAME_NUMBER {
        const char      *name;
        int             number;
-} LRAD_NAME_NUMBER;
+} FR_NAME_NUMBER;
 
-int lrad_str2int(const LRAD_NAME_NUMBER *table, const char *name, int def);
-const char *lrad_int2str(const LRAD_NAME_NUMBER *table, int number,
+int fr_str2int(const FR_NAME_NUMBER *table, const char *name, int def);
+const char *fr_int2str(const FR_NAME_NUMBER *table, int number,
                         const char *def);
 
 
 int            getword (char **ptr, char *buf, int buflen);
 int            getbareword (char **ptr, char *buf, int buflen);
-LRAD_TOKEN     gettoken(char **ptr, char *buf, int buflen);
-LRAD_TOKEN     getstring(char **ptr, char *buf, int buflen);
+FR_TOKEN       gettoken(char **ptr, char *buf, int buflen);
+FR_TOKEN       getstring(char **ptr, char *buf, int buflen);
 
-#endif /* LRAD_TOKEN_H */
+#endif /* FR_TOKEN_H */
index 4b16941..7ff5552 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LRAD_VQP_H
-#define LRAD_VQP_H
+#ifndef FR_VQP_H
+#define FR_VQP_H
 
 /*
  * vqp.h       Structures and prototypes for Cisco's VLAN Query Protocol
@@ -32,4 +32,4 @@ int vqp_send(RADIUS_PACKET *packet);
 int vqp_decode(RADIUS_PACKET *packet);
 int vqp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original);
 
-#endif /* LRAD_VQP_H */
+#endif /* FR_VQP_H */
index 439f96f..300a916 100644 (file)
@@ -38,14 +38,14 @@ RCSID("$Id$")
 #define DICT_VALUE_MAX_NAME_LEN (128)
 #define DICT_VENDOR_MAX_NAME_LEN (128)
 
-static lrad_hash_table_t *vendors_byname = NULL;
-static lrad_hash_table_t *vendors_byvalue = NULL;
+static fr_hash_table_t *vendors_byname = NULL;
+static fr_hash_table_t *vendors_byvalue = NULL;
 
-static lrad_hash_table_t *attributes_byname = NULL;
-static lrad_hash_table_t *attributes_byvalue = NULL;
+static fr_hash_table_t *attributes_byname = NULL;
+static fr_hash_table_t *attributes_byvalue = NULL;
 
-static lrad_hash_table_t *values_byvalue = NULL;
-static lrad_hash_table_t *values_byname = NULL;
+static fr_hash_table_t *values_byvalue = NULL;
+static fr_hash_table_t *values_byname = NULL;
 
 static DICT_ATTR *dict_base_attrs[256];
 
@@ -77,7 +77,7 @@ typedef struct value_fixup_t {
  */
 static value_fixup_t *value_fixup = NULL;
 
-static const LRAD_NAME_NUMBER type_table[] = {
+static const FR_NAME_NUMBER type_table[] = {
        { "integer",    PW_TYPE_INTEGER },
        { "string",     PW_TYPE_STRING },
        { "ipaddr",     PW_TYPE_IPADDR },
@@ -140,8 +140,8 @@ static uint32_t dict_attr_value_hash(const void *data)
        uint32_t hash;
        const DICT_ATTR *attr = data;
 
-       hash = lrad_hash(&attr->vendor, sizeof(attr->vendor));
-       return lrad_hash_update(&attr->attr, sizeof(attr->attr), hash);
+       hash = fr_hash(&attr->vendor, sizeof(attr->vendor));
+       return fr_hash_update(&attr->attr, sizeof(attr->attr), hash);
 }
 
 static int dict_attr_value_cmp(const void *one, const void *two)
@@ -170,7 +170,7 @@ static int dict_vendor_name_cmp(const void *one, const void *two)
 
 static uint32_t dict_vendor_value_hash(const void *data)
 {
-       return lrad_hash(&(((const DICT_VENDOR *)data)->vendorpec),
+       return fr_hash(&(((const DICT_VENDOR *)data)->vendorpec),
                         sizeof(((const DICT_VENDOR *)data)->vendorpec));
 }
 
@@ -188,7 +188,7 @@ static uint32_t dict_value_name_hash(const void *data)
        const DICT_VALUE *dval = data;
 
        hash = dict_hashname(dval->name);
-       return lrad_hash_update(&dval->attr, sizeof(dval->attr), hash);
+       return fr_hash_update(&dval->attr, sizeof(dval->attr), hash);
 }
 
 static int dict_value_name_cmp(const void *one, const void *two)
@@ -208,8 +208,8 @@ static uint32_t dict_value_value_hash(const void *data)
        uint32_t hash;
        const DICT_VALUE *dval = data;
 
-       hash = lrad_hash(&dval->attr, sizeof(dval->attr));
-       return lrad_hash_update(&dval->value, sizeof(dval->value), hash);
+       hash = fr_hash(&dval->attr, sizeof(dval->attr));
+       return fr_hash_update(&dval->value, sizeof(dval->value), hash);
 }
 
 static int dict_value_value_cmp(const void *one, const void *two)
@@ -384,18 +384,18 @@ void dict_free(void)
        /*
         *      Free the tables
         */
-       lrad_hash_table_free(vendors_byname);
-       lrad_hash_table_free(vendors_byvalue);
+       fr_hash_table_free(vendors_byname);
+       fr_hash_table_free(vendors_byvalue);
        vendors_byname = NULL;
        vendors_byvalue = NULL;
 
-       lrad_hash_table_free(attributes_byname);
-       lrad_hash_table_free(attributes_byvalue);
+       fr_hash_table_free(attributes_byname);
+       fr_hash_table_free(attributes_byvalue);
        attributes_byname = NULL;
        attributes_byvalue = NULL;
 
-       lrad_hash_table_free(values_byname);
-       lrad_hash_table_free(values_byvalue);
+       fr_hash_table_free(values_byname);
+       fr_hash_table_free(values_byvalue);
        values_byname = NULL;
        values_byvalue = NULL;
 
@@ -434,10 +434,10 @@ int dict_addvendor(const char *name, int value)
        dv->vendorpec  = value;
        dv->type = dv->length = 1; /* defaults */
 
-       if (!lrad_hash_table_insert(vendors_byname, dv)) {
+       if (!fr_hash_table_insert(vendors_byname, dv)) {
                DICT_VENDOR *old_dv;
 
-               old_dv = lrad_hash_table_finddata(vendors_byname, dv);
+               old_dv = fr_hash_table_finddata(vendors_byname, dv);
                if (!old_dv) {
                        librad_log("dict_addvendor: Failed inserting vendor name %s", name);
                        return -1;
@@ -463,7 +463,7 @@ int dict_addvendor(const char *name, int value)
         *      files, but when we're printing them, (and looking up
         *      by value) we want to use the NEW name.
         */
-       if (!lrad_hash_table_replace(vendors_byvalue, dv)) {
+       if (!fr_hash_table_replace(vendors_byvalue, dv)) {
                librad_log("dict_addvendor: Failed inserting vendor %s",
                           name);
                return -1;
@@ -572,14 +572,14 @@ int dict_addattr(const char *name, int vendor, int type, int value,
        /*
         *      Insert the attribute, only if it's not a duplicate.
         */
-       if (!lrad_hash_table_insert(attributes_byname, attr)) {
+       if (!fr_hash_table_insert(attributes_byname, attr)) {
                DICT_ATTR       *a;
 
                /*
                 *      If the attribute has identical number, then
                 *      ignore the duplicate.
                 */
-               a = lrad_hash_table_finddata(attributes_byname, attr);
+               a = fr_hash_table_finddata(attributes_byname, attr);
                if (a && (strcasecmp(a->name, attr->name) == 0)) {
                        if (a->attr != attr->attr) {
                                librad_log("dict_addattr: Duplicate attribute name %s", name);
@@ -596,9 +596,9 @@ int dict_addattr(const char *name, int vendor, int type, int value,
                }
 
 
-               lrad_hash_table_delete(attributes_byvalue, a);
+               fr_hash_table_delete(attributes_byvalue, a);
 
-               if (!lrad_hash_table_replace(attributes_byname, attr)) {
+               if (!fr_hash_table_replace(attributes_byname, attr)) {
                        librad_log("dict_addattr: Internal error storing attribute %s", name);
                        fr_pool_free(attr);
                        return -1;
@@ -614,7 +614,7 @@ int dict_addattr(const char *name, int vendor, int type, int value,
         *      files, but when we're printing them, (and looking up
         *      by value) we want to use the NEW name.
         */
-       if (!lrad_hash_table_replace(attributes_byvalue, attr)) {
+       if (!fr_hash_table_replace(attributes_byvalue, attr)) {
                librad_log("dict_addattr: Failed inserting attribute name %s", name);
                return -1;
        }
@@ -714,7 +714,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
                        default:
                                fr_pool_free(dval);
                                librad_log("dict_addvalue: VALUEs cannot be defined for attributes of type '%s'",
-                                          lrad_int2str(type_table, dattr->type, "?Unknown?"));
+                                          fr_int2str(type_table, dattr->type, "?Unknown?"));
                                return -1;
                }
 
@@ -745,7 +745,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
        /*
         *      Add the value into the dictionary.
         */
-       if (!lrad_hash_table_insert(values_byname, dval)) {
+       if (!fr_hash_table_insert(values_byname, dval)) {
                if (dattr) {
                        DICT_VALUE *old;
 
@@ -770,7 +770,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
         *      There are multiple VALUE's, keyed by attribute, so we
         *      take care of that here.
         */
-       if (!lrad_hash_table_replace(values_byvalue, dval)) {
+       if (!fr_hash_table_replace(values_byvalue, dval)) {
                librad_log("dict_addvalue: Failed inserting value %s",
                           namestr);
                return -1;
@@ -838,7 +838,7 @@ static int process_attribute(const char* fn, const int line,
        /*
         *      find the type of the attribute.
         */
-       type = lrad_str2int(type_table, argv[2], -1);
+       type = fr_str2int(type_table, argv[2], -1);
        if (type < 0) {
                librad_log("dict_init: %s[%d]: invalid type \"%s\"",
                        fn, line, argv[2]);
@@ -942,7 +942,7 @@ static int process_attribute(const char* fn, const int line,
                default:
                        librad_log("dict_init: %s[%d]: Attributes of type %s cannot be tagged.",
                                   fn, line,
-                                  lrad_int2str(type_table, type, "?Unknown?"));
+                                  fr_int2str(type_table, type, "?Unknown?"));
                        return -1;
 
                }
@@ -1071,7 +1071,7 @@ static int process_value_alias(const char* fn, const int line, char **argv,
        dval->attr = my_da->attr;
        dval->value = da->attr;
 
-       if (!lrad_hash_table_insert(values_byname, dval)) {
+       if (!fr_hash_table_insert(values_byname, dval)) {
                librad_log("dict_init: %s[%d]: Error create alias",
                           fn, line);
                fr_pool_free(dval);
@@ -1295,7 +1295,7 @@ static int my_dict_init(const char *dir, const char *fn,
        /*
         *      Seed the random pool with data.
         */
-       lrad_rand_seed(&statbuf, sizeof(statbuf));
+       fr_rand_seed(&statbuf, sizeof(statbuf));
 
        block_vendor = 0;
 
@@ -1480,7 +1480,7 @@ int dict_init(const char *dir, const char *fn)
         *
         *      Each vendor is malloc'd, so the free function is free.
         */
-       vendors_byname = lrad_hash_table_create(dict_vendor_name_hash,
+       vendors_byname = fr_hash_table_create(dict_vendor_name_hash,
                                                dict_vendor_name_cmp,
                                                fr_pool_free);
        if (!vendors_byname) {
@@ -1492,7 +1492,7 @@ int dict_init(const char *dir, const char *fn)
         *      be vendors of the same value.  If there are, we
         *      pick the latest one.
         */
-       vendors_byvalue = lrad_hash_table_create(dict_vendor_value_hash,
+       vendors_byvalue = fr_hash_table_create(dict_vendor_value_hash,
                                                 dict_vendor_value_cmp,
                                                 fr_pool_free);
        if (!vendors_byvalue) {
@@ -1505,7 +1505,7 @@ int dict_init(const char *dir, const char *fn)
         *
         *      Each attribute is malloc'd, so the free function is free.
         */
-       attributes_byname = lrad_hash_table_create(dict_attr_name_hash,
+       attributes_byname = fr_hash_table_create(dict_attr_name_hash,
                                                   dict_attr_name_cmp,
                                                   fr_pool_free);
        if (!attributes_byname) {
@@ -1517,21 +1517,21 @@ int dict_init(const char *dir, const char *fn)
         *      be attributes of the same value.  If there are, we
         *      pick the latest one.
         */
-       attributes_byvalue = lrad_hash_table_create(dict_attr_value_hash,
+       attributes_byvalue = fr_hash_table_create(dict_attr_value_hash,
                                                    dict_attr_value_cmp,
                                                    fr_pool_free);
        if (!attributes_byvalue) {
                return -1;
        }
 
-       values_byname = lrad_hash_table_create(dict_value_name_hash,
+       values_byname = fr_hash_table_create(dict_value_name_hash,
                                               dict_value_name_cmp,
                                               fr_pool_free);
        if (!values_byname) {
                return -1;
        }
 
-       values_byvalue = lrad_hash_table_create(dict_value_value_hash,
+       values_byvalue = fr_hash_table_create(dict_value_value_hash,
                                                dict_value_value_cmp,
                                                fr_pool_free);
        if (!values_byvalue) {
@@ -1563,7 +1563,7 @@ int dict_init(const char *dir, const char *fn)
                        /*
                         *      Add the value into the dictionary.
                         */
-                       if (!lrad_hash_table_replace(values_byname,
+                       if (!fr_hash_table_replace(values_byname,
                                                     this->dval)) {
                                librad_log("dict_addvalue: Duplicate value name %s for attribute %s", this->dval->name, a->name);
                                return -1;
@@ -1574,8 +1574,8 @@ int dict_init(const char *dir, const char *fn)
                         *      prefer the new name when printing
                         *      values.
                         */
-                       if (!lrad_hash_table_finddata(values_byvalue, this->dval)) {
-                               lrad_hash_table_replace(values_byvalue,
+                       if (!fr_hash_table_finddata(values_byvalue, this->dval)) {
+                               fr_hash_table_replace(values_byvalue,
                                                        this->dval);
                        }
                        free(this);
@@ -1593,14 +1593,14 @@ int dict_init(const char *dir, const char *fn)
         *      lookups, and we don't want multi-threaded re-ordering
         *      of the table entries.  That would be bad.
         */
-       lrad_hash_table_walk(vendors_byname, null_callback, NULL);
-       lrad_hash_table_walk(vendors_byvalue, null_callback, NULL);
+       fr_hash_table_walk(vendors_byname, null_callback, NULL);
+       fr_hash_table_walk(vendors_byvalue, null_callback, NULL);
 
-       lrad_hash_table_walk(attributes_byname, null_callback, NULL);
-       lrad_hash_table_walk(attributes_byvalue, null_callback, NULL);
+       fr_hash_table_walk(attributes_byname, null_callback, NULL);
+       fr_hash_table_walk(attributes_byvalue, null_callback, NULL);
 
-       lrad_hash_table_walk(values_byvalue, null_callback, NULL);
-       lrad_hash_table_walk(values_byname, null_callback, NULL);
+       fr_hash_table_walk(values_byvalue, null_callback, NULL);
+       fr_hash_table_walk(values_byname, null_callback, NULL);
 
        return 0;
 }
@@ -1617,7 +1617,7 @@ DICT_ATTR *dict_attrbyvalue(int attr)
        dattr.attr = attr;
        dattr.vendor = VENDOR(attr) & 0x7fff;
 
-       return lrad_hash_table_finddata(attributes_byvalue, &dattr);
+       return fr_hash_table_finddata(attributes_byvalue, &dattr);
 }
 
 /*
@@ -1631,7 +1631,7 @@ DICT_ATTR *dict_attrbyname(const char *name)
 
        strlcpy(dattr.name, name, sizeof(dattr.name));
 
-       return lrad_hash_table_finddata(attributes_byname, &dattr);
+       return fr_hash_table_finddata(attributes_byname, &dattr);
 }
 
 /*
@@ -1651,12 +1651,12 @@ DICT_VALUE *dict_valbyattr(int attr, int value)
         *      Look up the attribute alias target, and use
         *      the correct attribute number if found.
         */
-       dv = lrad_hash_table_finddata(values_byname, &dval);
+       dv = fr_hash_table_finddata(values_byname, &dval);
        if (dv) dval.attr = dv->value;
 
        dval.value = value;
 
-       return lrad_hash_table_finddata(values_byvalue, &dval);
+       return fr_hash_table_finddata(values_byvalue, &dval);
 }
 
 /*
@@ -1677,12 +1677,12 @@ DICT_VALUE *dict_valbyname(int attr, const char *name)
         *      Look up the attribute alias target, and use
         *      the correct attribute number if found.
         */
-       dv = lrad_hash_table_finddata(values_byname, my_dv);
+       dv = fr_hash_table_finddata(values_byname, my_dv);
        if (dv) my_dv->attr = dv->value;
 
        strlcpy(my_dv->name, name, DICT_VALUE_MAX_NAME_LEN);
 
-       return lrad_hash_table_finddata(values_byname, my_dv);
+       return fr_hash_table_finddata(values_byname, my_dv);
 }
 
 /*
@@ -1700,7 +1700,7 @@ int dict_vendorbyname(const char *name)
        dv = (DICT_VENDOR *) buffer;
        strlcpy(dv->name, name, DICT_VENDOR_MAX_NAME_LEN);
 
-       dv = lrad_hash_table_finddata(vendors_byname, dv);
+       dv = fr_hash_table_finddata(vendors_byname, dv);
        if (!dv) return 0;
 
        return dv->vendorpec;
@@ -1715,5 +1715,5 @@ DICT_VENDOR *dict_vendorbyvalue(int vendorpec)
 
        dv.vendorpec = vendorpec;
 
-       return lrad_hash_table_finddata(vendors_byvalue, &dv);
+       return fr_hash_table_finddata(vendors_byvalue, &dv);
 }
index 4dea6b1..406a850 100644 (file)
@@ -28,14 +28,14 @@ RCSID("$Id$")
 #include <freeradius-devel/libradius.h>
 #include <freeradius-devel/event.h>
 
-typedef struct lrad_event_fd_t {
+typedef struct fr_event_fd_t {
        int                     fd;
-       lrad_event_fd_handler_t handler;
+       fr_event_fd_handler_t   handler;
        void                    *ctx;
-} lrad_event_fd_t;
+} fr_event_fd_t;
 
 
-struct lrad_event_list_t {
+struct fr_event_list_t {
        rbtree_t        *times;
 
        rbtree_t        *readers;
@@ -45,7 +45,7 @@ struct lrad_event_list_t {
 
        int             exit;
 
-       lrad_event_status_t status;
+       fr_event_status_t status;
 
        struct timeval  now;
        int             dispatch;
@@ -54,19 +54,19 @@ struct lrad_event_list_t {
 /*
  *     Internal structure for managing events.
  */
-struct lrad_event_t {
-       lrad_event_callback_t   callback;
+struct fr_event_t {
+       fr_event_callback_t     callback;
        void                    *ctx;
        struct timeval          when;
-       lrad_event_t            **ev_p;
+       fr_event_t              **ev_p;
        rbnode_t                *node;
 };
 
 
-static int lrad_event_list_time_cmp(const void *one, const void *two)
+static int fr_event_list_time_cmp(const void *one, const void *two)
 {
-       const lrad_event_t *a = one;
-       const lrad_event_t *b = two;
+       const fr_event_t *a = one;
+       const fr_event_t *b = two;
 
        if (a->when.tv_sec < b->when.tv_sec) return -1;
        if (a->when.tv_sec > b->when.tv_sec) return +1;
@@ -78,16 +78,16 @@ static int lrad_event_list_time_cmp(const void *one, const void *two)
 }
 
 
-static int lrad_event_list_fd_cmp(const void *one, const void *two)
+static int fr_event_list_fd_cmp(const void *one, const void *two)
 {
-       const lrad_event_fd_t *a = one;
-       const lrad_event_fd_t *b = two;
+       const fr_event_fd_t *a = one;
+       const fr_event_fd_t *b = two;
 
        return a->fd - b->fd;
 }
 
 
-void lrad_event_list_free(lrad_event_list_t *el)
+void fr_event_list_free(fr_event_list_t *el)
 {
        if (!el) return;
 
@@ -97,25 +97,25 @@ void lrad_event_list_free(lrad_event_list_t *el)
 }
 
 
-lrad_event_list_t *lrad_event_list_create(lrad_event_status_t status)
+fr_event_list_t *fr_event_list_create(fr_event_status_t status)
 {
-       lrad_event_list_t *el;
+       fr_event_list_t *el;
 
        el = malloc(sizeof(*el));
        if (!el) return NULL;
        memset(el, 0, sizeof(*el));
 
-       el->times = rbtree_create(lrad_event_list_time_cmp,
+       el->times = rbtree_create(fr_event_list_time_cmp,
                                  free, 0);
        if (!el->times) {
-               lrad_event_list_free(el);
+               fr_event_list_free(el);
                return NULL;
        }
 
-       el->readers = rbtree_create(lrad_event_list_fd_cmp,
+       el->readers = rbtree_create(fr_event_list_fd_cmp,
                                  free, 0);
        if (!el->readers) {
-               lrad_event_list_free(el);
+               fr_event_list_free(el);
                return NULL;
        }
 
@@ -124,7 +124,7 @@ lrad_event_list_t *lrad_event_list_create(lrad_event_status_t status)
        return el;
 }
 
-int lrad_event_list_num_elements(lrad_event_list_t *el)
+int fr_event_list_num_elements(fr_event_list_t *el)
 {
        if (!el) return 0;
 
@@ -132,9 +132,9 @@ int lrad_event_list_num_elements(lrad_event_list_t *el)
 }
 
 
-int lrad_event_delete(lrad_event_list_t *el, lrad_event_t **ev_p)
+int fr_event_delete(fr_event_list_t *el, fr_event_t **ev_p)
 {
-       lrad_event_t *ev;
+       fr_event_t *ev;
 
        if (!el || !ev_p || !*ev_p) return 0;
 
@@ -147,16 +147,16 @@ int lrad_event_delete(lrad_event_list_t *el, lrad_event_t **ev_p)
 }
 
 
-int lrad_event_insert(lrad_event_list_t *el,
-                     lrad_event_callback_t callback,
+int fr_event_insert(fr_event_list_t *el,
+                     fr_event_callback_t callback,
                      void *ctx, struct timeval *when,
-                     lrad_event_t **ev_p)
+                     fr_event_t **ev_p)
 {
-       lrad_event_t *ev;
+       fr_event_t *ev;
 
        if (!el || !callback | !when) return 0;
 
-       if (ev_p && *ev_p) lrad_event_delete(el, ev_p);
+       if (ev_p && *ev_p) fr_event_delete(el, ev_p);
 
        ev = malloc(sizeof(*ev));
        if (!ev) return 0;
@@ -208,11 +208,11 @@ int lrad_event_insert(lrad_event_list_t *el,
 }
 
 
-int lrad_event_run(lrad_event_list_t *el, struct timeval *when)
+int fr_event_run(fr_event_list_t *el, struct timeval *when)
 {
-       lrad_event_callback_t callback;
+       fr_event_callback_t callback;
        void *ctx;
-       lrad_event_t *ev;
+       fr_event_t *ev;
 
        if (!el) return 0;
 
@@ -245,14 +245,14 @@ int lrad_event_run(lrad_event_list_t *el, struct timeval *when)
        /*
         *      Delete the event before calling it.
         */
-       lrad_event_delete(el, &ev);
+       fr_event_delete(el, &ev);
 
        callback(ctx);
        return 1;
 }
 
 
-int lrad_event_now(lrad_event_list_t *el, struct timeval *when)
+int fr_event_now(fr_event_list_t *el, struct timeval *when)
 {
        if (!el || !when || !el->dispatch) return 0;
 
@@ -261,10 +261,10 @@ int lrad_event_now(lrad_event_list_t *el, struct timeval *when)
 }
 
 
-int lrad_event_fd_insert(lrad_event_list_t *el, int type, int fd,
-                        lrad_event_fd_handler_t handler, void *ctx)
+int fr_event_fd_insert(fr_event_list_t *el, int type, int fd,
+                        fr_event_fd_handler_t handler, void *ctx)
 {
-       lrad_event_fd_t *ef;
+       fr_event_fd_t *ef;
 
        if (!el || (fd < 0) || !handler || !ctx) return 0;
 
@@ -288,9 +288,9 @@ int lrad_event_fd_insert(lrad_event_list_t *el, int type, int fd,
        return 1;
 }
 
-int lrad_event_fd_delete(lrad_event_list_t *el, int type, int fd)
+int fr_event_fd_delete(fr_event_list_t *el, int type, int fd)
 {
-       lrad_event_fd_t my_ef;
+       fr_event_fd_t my_ef;
 
        if (!el || (fd < 0)) return 0;
 
@@ -305,7 +305,7 @@ int lrad_event_fd_delete(lrad_event_list_t *el, int type, int fd)
 }                       
 
 
-void lrad_event_loop_exit(lrad_event_list_t *el, int code)
+void fr_event_loop_exit(fr_event_list_t *el, int code)
 {
        if (!el) return;
 
@@ -313,10 +313,10 @@ void lrad_event_loop_exit(lrad_event_list_t *el, int code)
 }
 
 
-static int lrad_event_fd_set(void *ctx, void *data)
+static int fr_event_fd_set(void *ctx, void *data)
 {
        fd_set *fds = ctx;
-       lrad_event_fd_t *ef = data;
+       fr_event_fd_t *ef = data;
 
        if (ef->fd < 0) return 0; /* ignore it */
 
@@ -325,16 +325,16 @@ static int lrad_event_fd_set(void *ctx, void *data)
        return 0;               /* continue walking */
 }
 
-typedef struct lrad_fd_walk_t {
-       lrad_event_list_t *el;
+typedef struct fr_fd_walk_t {
+       fr_event_list_t *el;
        fd_set            *fds;
-} lrad_fd_walk_t;
+} fr_fd_walk_t;
 
 
-static int lrad_event_fd_dispatch(void *ctx, void *data)
+static int fr_event_fd_dispatch(void *ctx, void *data)
 {
-       lrad_fd_walk_t *ew = ctx;
-       lrad_event_fd_t *ef = data;
+       fr_fd_walk_t *ew = ctx;
+       fr_event_fd_t *ef = data;
 
        if (ef->fd < 0) return 0;
 
@@ -348,12 +348,12 @@ static int lrad_event_fd_dispatch(void *ctx, void *data)
 }
 
 
-int lrad_event_loop(lrad_event_list_t *el)
+int fr_event_loop(fr_event_list_t *el)
 {
        int rcode;
        fd_set read_fds;
        struct timeval when, *wake;
-       lrad_fd_walk_t ew;
+       fr_fd_walk_t ew;
 
        /*
         *      Cache the list of FD's to watch.
@@ -361,7 +361,7 @@ int lrad_event_loop(lrad_event_list_t *el)
        if (el->changed) {
                FD_ZERO(&el->read_fds);
 
-               rbtree_walk(el->readers, InOrder, lrad_event_fd_set,
+               rbtree_walk(el->readers, InOrder, fr_event_fd_set,
                            &el->read_fds);
                el->changed = 0;
        }
@@ -379,7 +379,7 @@ int lrad_event_loop(lrad_event_list_t *el)
                when.tv_usec = 0;
 
                if (rbtree_num_elements(el->times) > 0) {
-                       lrad_event_t *ev;
+                       fr_event_t *ev;
 
                        ev = rbtree_min(el->times);
                        if (!ev) _exit(42);
@@ -421,7 +421,7 @@ int lrad_event_loop(lrad_event_list_t *el)
                        do {
                                gettimeofday(&el->now, NULL);
                                when = el->now;
-                       } while (lrad_event_run(el, &when) == 1);
+                       } while (fr_event_run(el, &when) == 1);
                }
                
                if (rcode <= 0) continue;
@@ -430,7 +430,7 @@ int lrad_event_loop(lrad_event_list_t *el)
                ew.el = el;
 
                el->changed = 0;
-               rbtree_walk(el->readers, InOrder, lrad_event_fd_dispatch, &ew);
+               rbtree_walk(el->readers, InOrder, fr_event_fd_dispatch, &ew);
        }
 
        el->dispatch = 0;
@@ -463,7 +463,7 @@ static void print_time(void *ctx)
        fflush(stdout);
 }
 
-static lrad_randctx rand_pool;
+static fr_randctx rand_pool;
 
 static uint32_t event_rand(void)
 {
@@ -471,7 +471,7 @@ static uint32_t event_rand(void)
 
        num = rand_pool.randrsl[rand_pool.randcnt++];
        if (rand_pool.randcnt == 256) {
-               lrad_isaac(&rand_pool);
+               fr_isaac(&rand_pool);
                rand_pool.randcnt = 0;
        }
 
@@ -485,15 +485,15 @@ int main(int argc, char **argv)
        int i, rcode;
        struct timeval array[MAX];
        struct timeval now, when;
-       lrad_event_list_t *el;
+       fr_event_list_t *el;
 
-       el = lrad_event_list_create();
+       el = fr_event_list_create();
        if (!el) exit(1);
 
        memset(&rand_pool, 0, sizeof(rand_pool));
        rand_pool.randrsl[1] = time(NULL);
 
-       lrad_randinit(&rand_pool, 1);
+       fr_randinit(&rand_pool, 1);
        rand_pool.randcnt = 0;
 
        gettimeofday(&array[0], NULL);
@@ -505,13 +505,13 @@ int main(int argc, char **argv)
                        array[i].tv_usec -= 1000000;
                        array[i].tv_sec++;
                }
-               lrad_event_insert(el, print_time, &array[i], &array[i]);
+               fr_event_insert(el, print_time, &array[i], &array[i]);
        }
 
-       while (lrad_event_list_num_elements(el)) {
+       while (fr_event_list_num_elements(el)) {
                gettimeofday(&now, NULL);
                when = now;
-               if (!lrad_event_run(el, &when)) {
+               if (!fr_event_run(el, &when)) {
                        int delay = (when.tv_sec - now.tv_sec) * 1000000;
                        delay += when.tv_usec;
                        delay -= now.tv_usec;
@@ -522,7 +522,7 @@ int main(int argc, char **argv)
                }
        }
 
-       lrad_event_list_free(el);
+       fr_event_list_free(el);
 
        return 0;
 }
index d77a3c3..1614da4 100644 (file)
@@ -27,24 +27,24 @@ RCSID("$Id$")
 
 #include <freeradius-devel/libradius.h>
 
-typedef struct lrad_fifo_entry_t {
-       struct lrad_fifo_entry_t *next;
+typedef struct fr_fifo_entry_t {
+       struct fr_fifo_entry_t *next;
        void                    *data;
-} lrad_fifo_entry_t;
+} fr_fifo_entry_t;
 
-struct lrad_fifo_t {
-       lrad_fifo_entry_t *head, **tail;
-       lrad_fifo_entry_t *freelist;
+struct fr_fifo_t {
+       fr_fifo_entry_t *head, **tail;
+       fr_fifo_entry_t *freelist;
 
        int num_elements;
        int max_entries;
-       lrad_fifo_free_t freeNode;
+       fr_fifo_free_t freeNode;
 };
 
 
-lrad_fifo_t *lrad_fifo_create(int max_entries, lrad_fifo_free_t freeNode)
+fr_fifo_t *fr_fifo_create(int max_entries, fr_fifo_free_t freeNode)
 {
-       lrad_fifo_t *fi;
+       fr_fifo_t *fi;
 
        if ((max_entries < 2) || (max_entries > (1024 * 1024))) return NULL;
 
@@ -59,9 +59,9 @@ lrad_fifo_t *lrad_fifo_create(int max_entries, lrad_fifo_free_t freeNode)
        return fi;
 }
 
-static void lrad_fifo_free_entries(lrad_fifo_t *fi, lrad_fifo_entry_t *head)
+static void fr_fifo_free_entries(fr_fifo_t *fi, fr_fifo_entry_t *head)
 {
-       lrad_fifo_entry_t *next;
+       fr_fifo_entry_t *next;
 
        while (head) {
                next = head->next;
@@ -73,19 +73,19 @@ static void lrad_fifo_free_entries(lrad_fifo_t *fi, lrad_fifo_entry_t *head)
        }
 }
 
-void lrad_fifo_free(lrad_fifo_t *fi)
+void fr_fifo_free(fr_fifo_t *fi)
 {
        if (!fi) return;
 
-       lrad_fifo_free_entries(fi, fi->head);
-       lrad_fifo_free_entries(fi, fi->freelist);
+       fr_fifo_free_entries(fi, fi->head);
+       fr_fifo_free_entries(fi, fi->freelist);
 
        free(fi);
 }
 
-static lrad_fifo_entry_t *lrad_fifo_alloc_entry(lrad_fifo_t *fi)
+static fr_fifo_entry_t *fr_fifo_alloc_entry(fr_fifo_t *fi)
 {
-       lrad_fifo_entry_t *entry;
+       fr_fifo_entry_t *entry;
 
        if (fi->freelist) {
                entry = fi->freelist;
@@ -99,15 +99,15 @@ static lrad_fifo_entry_t *lrad_fifo_alloc_entry(lrad_fifo_t *fi)
        return entry;
 }
 
-int lrad_fifo_push(lrad_fifo_t *fi, void *data)
+int fr_fifo_push(fr_fifo_t *fi, void *data)
 {
-       lrad_fifo_entry_t *entry;
+       fr_fifo_entry_t *entry;
 
        if (!fi || !data) return 0;
 
        if (fi->num_elements >= fi->max_entries) return 0;
 
-       entry = lrad_fifo_alloc_entry(fi);
+       entry = fr_fifo_alloc_entry(fi);
        if (!entry) return 0;
        entry->data = data;
 
@@ -123,7 +123,7 @@ int lrad_fifo_push(lrad_fifo_t *fi, void *data)
        return 1;
 }
 
-static void lrad_fifo_free_entry(lrad_fifo_t *fi, lrad_fifo_entry_t *entry)
+static void fr_fifo_free_entry(fr_fifo_t *fi, fr_fifo_entry_t *entry)
 {
        entry->data = NULL;
        entry->next = fi->freelist;
@@ -131,10 +131,10 @@ static void lrad_fifo_free_entry(lrad_fifo_t *fi, lrad_fifo_entry_t *entry)
 }
 
 
-void *lrad_fifo_pop(lrad_fifo_t *fi)
+void *fr_fifo_pop(fr_fifo_t *fi)
 {
        void *data;
-       lrad_fifo_entry_t *entry;
+       fr_fifo_entry_t *entry;
 
        if (!fi || !fi->head) return NULL;
 
@@ -142,7 +142,7 @@ void *lrad_fifo_pop(lrad_fifo_t *fi)
        fi->head = entry->next;
 
        data = entry->data;
-       lrad_fifo_free_entry(fi, entry);
+       fr_fifo_free_entry(fi, entry);
 
        fi->num_elements--;
 
@@ -154,14 +154,14 @@ void *lrad_fifo_pop(lrad_fifo_t *fi)
        return data;
 }
 
-void *lrad_fifo_peek(lrad_fifo_t *fi)
+void *fr_fifo_peek(fr_fifo_t *fi)
 {
        if (!fi || !fi->head) return NULL;
 
        return fi->head->data;
 }
 
-int lrad_fifo_num_elements(lrad_fifo_t *fi)
+int fr_fifo_num_elements(fr_fifo_t *fi)
 {
        if (!fi) return 0;
 
@@ -180,21 +180,21 @@ int lrad_fifo_num_elements(lrad_fifo_t *fi)
 int main(int argc, char **argv)
 {
        int i, array[MAX];
-       lrad_fifo_t *fi;
+       fr_fifo_t *fi;
 
-       fi = lrad_fifo_create(MAX, NULL);
+       fi = fr_fifo_create(MAX, NULL);
        if (!fi) exit(1);
 
        for (i = 0; i < MAX; i++) {
                array[i] = i;
 
-               if (!lrad_fifo_push(fi, &array[i])) exit(2);
+               if (!fr_fifo_push(fi, &array[i])) exit(2);
        }
 
        for (i = 0; i < MAX; i++) {
                int *p;
 
-               p = lrad_fifo_pop(fi);
+               p = fr_fifo_pop(fi);
                if (!p) {
                        fprintf(stderr, "No pop at %d\n", i);
                        exit(3);
index ab984bb..8d5bd64 100644 (file)
@@ -227,7 +227,7 @@ typedef struct _cpp_hack {
  *
  * ??? What the heck is wrong with getservbyname?
  */
-static const LRAD_NAME_NUMBER filterPortType[] = {
+static const FR_NAME_NUMBER filterPortType[] = {
        { "ftp-data",   20 },
        { "ftp",        21 },
        { "telnet",     23 },
@@ -249,7 +249,7 @@ static const LRAD_NAME_NUMBER filterPortType[] = {
        {  NULL ,       0},
 };
 
-static const LRAD_NAME_NUMBER filterType[] = {
+static const FR_NAME_NUMBER filterType[] = {
        { "generic",    RAD_FILTER_GENERIC},
        { "ip",         RAD_FILTER_IP},
        { "ipx",        RAD_FILTER_IPX},
@@ -285,7 +285,7 @@ typedef enum {
 } FilterTokens;
 
 
-static const LRAD_NAME_NUMBER filterKeywords[] = {
+static const FR_NAME_NUMBER filterKeywords[] = {
        { "ip",         FILTER_IP_TYPE },
        { "generic",    FILTER_GENERIC_TYPE },
        { "in",         FILTER_IN },
@@ -317,7 +317,7 @@ static const LRAD_NAME_NUMBER filterKeywords[] = {
  *
  *  ??? What the heck is wrong with getprotobyname?
  */
-static const LRAD_NAME_NUMBER filterProtoName[] = {
+static const FR_NAME_NUMBER filterProtoName[] = {
        { "tcp",  6 },
        { "udp",  17 },
        { "ospf", 89 },
@@ -340,7 +340,7 @@ typedef enum {
        RAD_COMPARE_NOT_EQUAL
 } RadFilterComparison;
 
-static const LRAD_NAME_NUMBER filterCompare[] = {
+static const FR_NAME_NUMBER filterCompare[] = {
        { "<",  RAD_COMPARE_LESS },
        { "=",  RAD_COMPARE_EQUAL },
        { ">",  RAD_COMPARE_GREATER },
@@ -395,7 +395,7 @@ static int ascend_parse_ipx_net(int argc, char **argv,
        /*
         *      Parse the node.
         */
-       token = lrad_str2int(filterKeywords, argv[1], -1);
+       token = fr_str2int(filterKeywords, argv[1], -1);
        switch (token) {
        case FILTER_IPX_SRC_IPXNODE:
        case FILTER_IPX_DST_IPXNODE:
@@ -415,7 +415,7 @@ static int ascend_parse_ipx_net(int argc, char **argv,
        /*
         *      Node must be 6 octets long.
         */
-       token = lrad_hex2bin(p, net->node, IPX_NODE_ADDR_LEN);
+       token = fr_hex2bin(p, net->node, IPX_NODE_ADDR_LEN);
        if (token != IPX_NODE_ADDR_LEN) return -1;
 
        /*
@@ -431,7 +431,7 @@ static int ascend_parse_ipx_net(int argc, char **argv,
        /*
         *      Parse the socket.
         */
-       token = lrad_str2int(filterKeywords, argv[3], -1);
+       token = fr_str2int(filterKeywords, argv[3], -1);
        switch (token) {
        case FILTER_IPX_SRC_IPXSOCK:
        case FILTER_IPX_DST_IPXSOCK:
@@ -444,7 +444,7 @@ static int ascend_parse_ipx_net(int argc, char **argv,
        /*
         *      Parse the command "<", ">", "=" or "!="
         */
-       token = lrad_str2int(filterCompare, argv[4], -1);
+       token = fr_str2int(filterCompare, argv[4], -1);
        switch (token) {
        case RAD_COMPARE_LESS:
        case RAD_COMPARE_EQUAL:
@@ -528,7 +528,7 @@ static int ascend_parse_ipx(int argc, char **argv, ascend_ipx_filter_t *filter)
        if (argc < 4) return -1;
 
        while ((argc > 0) && (flags != 0x03)) {
-               token = lrad_str2int(filterKeywords, argv[0], -1);
+               token = fr_str2int(filterKeywords, argv[0], -1);
                switch (token) {
                case FILTER_IPX_SRC_IPXNET:
                        if (flags & 0x01) return -1;
@@ -684,13 +684,13 @@ static int ascend_parse_port(uint16_t *port, char *compare, char *str)
        /*
         *      There MUST be a comparison string.
         */
-       rcode = lrad_str2int(filterCompare, compare, -1);
+       rcode = fr_str2int(filterCompare, compare, -1);
        if (rcode < 0) return rcode;
 
        if (strspn(str, "0123456789") == strlen(str)) {
                token = atoi(str);
        } else {
-               token = lrad_str2int(filterPortType, str, -1);
+               token = fr_str2int(filterPortType, str, -1);
        }
 
        if ((token < 0) || (token > 65535)) return -1;
@@ -760,7 +760,7 @@ static int ascend_parse_ip(int argc, char **argv, ascend_ip_filter_t *filter)
         */
        flags = 0;
        while ((argc > 0) && (flags != DONE_FLAGS)) {
-               token = lrad_str2int(filterKeywords, argv[0], -1);
+               token = fr_str2int(filterKeywords, argv[0], -1);
                switch (token) {
                case FILTER_IP_SRC:
                        if (flags & IP_SRC_ADDR_FLAG) return -1;
@@ -829,7 +829,7 @@ static int ascend_parse_ip(int argc, char **argv, ascend_ip_filter_t *filter)
                        if (strspn(argv[0], "0123456789") == strlen(argv[0])) {
                                token = atoi(argv[0]);
                        } else {
-                               token = lrad_str2int(filterProtoName, argv[0], -1);
+                               token = fr_str2int(filterProtoName, argv[0], -1);
                                if (token == -1) {
                                        librad_log("Unknown IP protocol \"%s\" in IP data filter",
                                                   argv[0]);
@@ -914,10 +914,10 @@ static int ascend_parse_generic(int argc, char **argv,
        filter->offset = rcode;
        filter->offset = htons(filter->offset);
 
-       rcode = lrad_hex2bin(argv[1], filter->mask, sizeof(filter->mask));
+       rcode = fr_hex2bin(argv[1], filter->mask, sizeof(filter->mask));
        if (rcode != sizeof(filter->mask)) return -1;
 
-       token = lrad_hex2bin(argv[2], filter->value, sizeof(filter->value));
+       token = fr_hex2bin(argv[2], filter->value, sizeof(filter->value));
        if (token != sizeof(filter->value)) return -1;
 
        /*
@@ -938,7 +938,7 @@ static int ascend_parse_generic(int argc, char **argv,
        flags = 0;
 
        while (argc >= 1) {
-               token = lrad_str2int(filterKeywords, argv[0], -1);
+               token = fr_str2int(filterKeywords, argv[0], -1);
                switch (token) {
                case FILTER_GENERIC_COMPNEQ:
                        if (flags & 0x01) return -1;
@@ -1013,7 +1013,7 @@ ascend_parse_filter(VALUE_PAIR *pair)
        /*
         *      Decide which filter type it is: ip, ipx, or generic
         */
-       type = lrad_str2int(filterType, argv[0], -1);
+       type = fr_str2int(filterType, argv[0], -1);
        memset(&filter, 0, sizeof(filter));
 
        /*
@@ -1035,7 +1035,7 @@ ascend_parse_filter(VALUE_PAIR *pair)
        /*
         *      Parse direction
         */
-       token = lrad_str2int(filterKeywords, argv[1], -1);
+       token = fr_str2int(filterKeywords, argv[1], -1);
        switch (token) {
        case FILTER_IN:
                filter.direction = 1;
@@ -1054,7 +1054,7 @@ ascend_parse_filter(VALUE_PAIR *pair)
        /*
         *      Parse action
         */
-       token = lrad_str2int(filterKeywords, argv[2], -1);
+       token = fr_str2int(filterKeywords, argv[2], -1);
        switch (token) {
        case FILTER_FORWARD:
                filter.forward = 1;
@@ -1172,7 +1172,7 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
 
   filter = (ascend_filter_t *) &(vp->vp_filter);
   i = snprintf(p, len, "%s %s %s",
-              lrad_int2str(filterType, filter->type, "??"),
+              fr_int2str(filterType, filter->type, "??"),
               direction[filter->direction & 0x01],
               action[filter->forward & 0x01]);
 
@@ -1207,13 +1207,13 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
     }
 
     i =  snprintf(p, len, " %s",
-                 lrad_int2str(filterProtoName, filter->u.ip.proto, "??"));
+                 fr_int2str(filterProtoName, filter->u.ip.proto, "??"));
     p += i;
     len -= i;
 
     if (filter->u.ip.srcPortComp > RAD_NO_COMPARE) {
       i = snprintf(p, len, " srcport %s %d",
-                  lrad_int2str(filterCompare, filter->u.ip.srcPortComp, "??"),
+                  fr_int2str(filterCompare, filter->u.ip.srcPortComp, "??"),
                   ntohs(filter->u.ip.srcport));
       p += i;
       len -= i;
@@ -1221,7 +1221,7 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
 
     if (filter->u.ip.dstPortComp > RAD_NO_COMPARE) {
       i = snprintf(p, len, " dstport %s %d",
-                  lrad_int2str(filterCompare, filter->u.ip.dstPortComp, "??"),
+                  fr_int2str(filterCompare, filter->u.ip.dstPortComp, "??"),
                   ntohs(filter->u.ip.dstport));
       p += i;
       len -= i;
@@ -1249,7 +1249,7 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
 
       if (filter->u.ipx.srcSocComp > RAD_NO_COMPARE) {
        i = snprintf(p, len, " srcipxsock %s 0x%04x",
-                    lrad_int2str(filterCompare, filter->u.ipx.srcSocComp, "??"),
+                    fr_int2str(filterCompare, filter->u.ipx.srcSocComp, "??"),
                     ntohs(filter->u.ipx.src.socket));
        p += i;
        len -= i;
@@ -1268,7 +1268,7 @@ void print_abinary(VALUE_PAIR *vp, char *buffer, int len)
 
       if (filter->u.ipx.dstSocComp > RAD_NO_COMPARE) {
        i = snprintf(p, len, " dstipxsock %s 0x%04x",
-                    lrad_int2str(filterCompare, filter->u.ipx.dstSocComp, "??"),
+                    fr_int2str(filterCompare, filter->u.ipx.dstSocComp, "??"),
                     ntohs(filter->u.ipx.dst.socket));
        p += i;
        len -= i;
index 9171bb7..029ebe2 100644 (file)
@@ -23,10 +23,10 @@ RCSID("$Id$")
     to return for gethostbyname() & gethostbyaddr(), if that is the
     case then use only one mutex instead of seperate mutexes
  */
-static int lrad_hostbyname = 0;
-static int lrad_hodtbyaddr = 0;
-static pthread_mutex_t lrad_hostbyname_mutex;
-static pthread_mutex_t lrad_hodtbyaddr_mutex;
+static int fr_hostbyname = 0;
+static int fr_hodtbyaddr = 0;
+static pthread_mutex_t fr_hostbyname_mutex;
+static pthread_mutex_t fr_hodtbyaddr_mutex;
 #endif
 
 #undef LOCAL_GETHOSTBYNAMERSTYLE
@@ -127,11 +127,11 @@ gethostbyname_r(const char *hostname, struct hostent *result,
     struct hostent *hp;
 
 #ifdef HAVE_PTHREAD_H
-    if (lrad_hostbyname == 0) {
-       pthread_mutex_init(&lrad_hostbyname_mutex, NULL);
-       lrad_hostbyname = 1;
+    if (fr_hostbyname == 0) {
+       pthread_mutex_init(&fr_hostbyname_mutex, NULL);
+       fr_hostbyname = 1;
     }
-    pthread_mutex_lock(&lrad_hostbyname_mutex);
+    pthread_mutex_lock(&fr_hostbyname_mutex);
 #endif
 
     hp = gethostbyname(hostname);
@@ -144,7 +144,7 @@ gethostbyname_r(const char *hostname, struct hostent *result,
     }
 
 #ifdef HAVE_PTHREAD_H
-    pthread_mutex_unlock(&lrad_hostbyname_mutex);
+    pthread_mutex_unlock(&fr_hostbyname_mutex);
 #endif
 
     return hp;
@@ -160,11 +160,11 @@ gethostbyaddr_r(const char *addr, int len, int type, struct hostent *result,
     struct hostent *hp;
 
 #ifdef HAVE_PTHREAD_H
-    if (lrad_hodtbyaddr == 0) {
-       pthread_mutex_init(&lrad_hodtbyaddr_mutex, NULL);
-       lrad_hodtbyaddr = 1;
+    if (fr_hodtbyaddr == 0) {
+       pthread_mutex_init(&fr_hodtbyaddr_mutex, NULL);
+       fr_hodtbyaddr = 1;
     }
-    pthread_mutex_lock(&lrad_hodtbyaddr_mutex);
+    pthread_mutex_lock(&fr_hodtbyaddr_mutex);
 #endif
 
     hp = gethostbyaddr(addr, len, type);
@@ -177,7 +177,7 @@ gethostbyaddr_r(const char *addr, int len, int type, struct hostent *result,
     }
 
 #ifdef HAVE_PTHREAD_H
-    pthread_mutex_unlock(&lrad_hodtbyaddr_mutex);
+    pthread_mutex_unlock(&fr_hodtbyaddr_mutex);
 #endif
 
     return hp;
index 71aeeca..0780259 100644 (file)
@@ -40,29 +40,29 @@ RCSID("$Id$")
  *     A reasonable number of buckets to start off with.
  *     Should be a power of two.
  */
-#define LRAD_HASH_NUM_BUCKETS (64)
+#define FR_HASH_NUM_BUCKETS (64)
 
-typedef struct lrad_hash_entry_t {
-       struct lrad_hash_entry_t *next;
+typedef struct fr_hash_entry_t {
+       struct fr_hash_entry_t *next;
        uint32_t        reversed;
        uint32_t        key;
        void            *data;
-} lrad_hash_entry_t;
+} fr_hash_entry_t;
 
 
-struct lrad_hash_table_t {
+struct fr_hash_table_t {
        int                     num_elements;
        int                     num_buckets; /* power of 2 */
        int                     next_grow;
        int                     mask;
 
-       lrad_hash_table_free_t  free;
-       lrad_hash_table_hash_t  hash;
-       lrad_hash_table_cmp_t   cmp;
+       fr_hash_table_free_t    free;
+       fr_hash_table_hash_t    hash;
+       fr_hash_table_cmp_t     cmp;
 
-       lrad_hash_entry_t       null;
+       fr_hash_entry_t null;
 
-       lrad_hash_entry_t       **buckets;
+       fr_hash_entry_t **buckets;
 };
 
 #ifdef TESTING
@@ -178,12 +178,12 @@ static uint32_t parent_of(uint32_t key)
 }
 
 
-static lrad_hash_entry_t *list_find(lrad_hash_table_t *ht,
-                                   lrad_hash_entry_t *head,
+static fr_hash_entry_t *list_find(fr_hash_table_t *ht,
+                                   fr_hash_entry_t *head,
                                    uint32_t reversed,
                                    const void *data)
 {
-       lrad_hash_entry_t *cur;
+       fr_hash_entry_t *cur;
 
        for (cur = head; cur != &ht->null; cur = cur->next) {
                if (cur->reversed == reversed) {
@@ -204,10 +204,10 @@ static lrad_hash_entry_t *list_find(lrad_hash_table_t *ht,
 /*
  *     Inserts a new entry into the list, in order.
  */
-static int list_insert(lrad_hash_table_t *ht,
-                      lrad_hash_entry_t **head, lrad_hash_entry_t *node)
+static int list_insert(fr_hash_table_t *ht,
+                      fr_hash_entry_t **head, fr_hash_entry_t *node)
 {
-       lrad_hash_entry_t **last, *cur;
+       fr_hash_entry_t **last, *cur;
 
        last = head;
 
@@ -235,10 +235,10 @@ static int list_insert(lrad_hash_table_t *ht,
 /*
  *     Delete an entry from the list.
  */
-static int list_delete(lrad_hash_table_t *ht,
-                      lrad_hash_entry_t **head, lrad_hash_entry_t *node)
+static int list_delete(fr_hash_table_t *ht,
+                      fr_hash_entry_t **head, fr_hash_entry_t *node)
 {
-       lrad_hash_entry_t **last, *cur;
+       fr_hash_entry_t **last, *cur;
 
        last = head;
 
@@ -264,11 +264,11 @@ static int list_delete(lrad_hash_table_t *ht,
  *
  *     Memory usage in bytes is (20/3) * number of entries.
  */
-lrad_hash_table_t *lrad_hash_table_create(lrad_hash_table_hash_t hashNode,
-                                         lrad_hash_table_cmp_t cmpNode,
-                                         lrad_hash_table_free_t freeNode)
+fr_hash_table_t *fr_hash_table_create(fr_hash_table_hash_t hashNode,
+                                         fr_hash_table_cmp_t cmpNode,
+                                         fr_hash_table_free_t freeNode)
 {
-       lrad_hash_table_t *ht;
+       fr_hash_table_t *ht;
 
        if (!hashNode) return NULL;
 
@@ -279,7 +279,7 @@ lrad_hash_table_t *lrad_hash_table_create(lrad_hash_table_hash_t hashNode,
        ht->free = freeNode;
        ht->hash = hashNode;
        ht->cmp = cmpNode;
-       ht->num_buckets = LRAD_HASH_NUM_BUCKETS;
+       ht->num_buckets = FR_HASH_NUM_BUCKETS;
        ht->mask = ht->num_buckets - 1;
 
        /*
@@ -316,10 +316,10 @@ lrad_hash_table_t *lrad_hash_table_create(lrad_hash_table_hash_t hashNode,
  *     wrong.  To solve that problem, we walk down the whole chain,
  *     inserting the elements into the correct place.
  */
-static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
+static void fr_hash_table_fixup(fr_hash_table_t *ht, uint32_t entry)
 {
        uint32_t parent_entry = parent_of(entry);
-       lrad_hash_entry_t **last, *cur;
+       fr_hash_entry_t **last, *cur;
        uint32_t this;
 
        parent_entry = parent_of(entry);
@@ -327,7 +327,7 @@ static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
        /* parent_entry == entry if and only if entry == 0 */
 
        if (!ht->buckets[parent_entry]) {
-               lrad_hash_table_fixup(ht, parent_entry);
+               fr_hash_table_fixup(ht, parent_entry);
        }
 
        /*
@@ -366,9 +366,9 @@ static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
 /*
  *     Grow the hash table.
  */
-static void lrad_hash_table_grow(lrad_hash_table_t *ht)
+static void fr_hash_table_grow(fr_hash_table_t *ht)
 {
-       lrad_hash_entry_t **buckets;
+       fr_hash_entry_t **buckets;
 
        buckets = malloc(sizeof(*buckets) * GROW_FACTOR * ht->num_buckets);
        if (!buckets) return;
@@ -393,12 +393,12 @@ static void lrad_hash_table_grow(lrad_hash_table_t *ht)
 /*
  *     Insert data.
  */
-int lrad_hash_table_insert(lrad_hash_table_t *ht, void *data)
+int fr_hash_table_insert(fr_hash_table_t *ht, void *data)
 {
        uint32_t key;
        uint32_t entry;
        uint32_t reversed;
-       lrad_hash_entry_t *node;
+       fr_hash_entry_t *node;
 
        if (!ht || !data) return 0;
 
@@ -406,7 +406,7 @@ int lrad_hash_table_insert(lrad_hash_table_t *ht, void *data)
        entry = key & ht->mask;
        reversed = reverse(key);
 
-       if (!ht->buckets[entry]) lrad_hash_table_fixup(ht, entry);
+       if (!ht->buckets[entry]) fr_hash_table_fixup(ht, entry);
 
        /*
         *      If we try to do our own memory allocation here, the
@@ -433,7 +433,7 @@ int lrad_hash_table_insert(lrad_hash_table_t *ht, void *data)
         */
        ht->num_elements++;
        if (ht->num_elements >= ht->next_grow) {
-               lrad_hash_table_grow(ht);
+               fr_hash_table_grow(ht);
        }
 
        return 1;
@@ -443,7 +443,7 @@ int lrad_hash_table_insert(lrad_hash_table_t *ht, void *data)
 /*
  *     Internal find a node routine.
  */
-static lrad_hash_entry_t *lrad_hash_table_find(lrad_hash_table_t *ht,
+static fr_hash_entry_t *fr_hash_table_find(fr_hash_table_t *ht,
                                               const void *data)
 {
        uint32_t key;
@@ -456,7 +456,7 @@ static lrad_hash_entry_t *lrad_hash_table_find(lrad_hash_table_t *ht,
        entry = key & ht->mask;
        reversed = reverse(key);
 
-       if (!ht->buckets[entry]) lrad_hash_table_fixup(ht, entry);
+       if (!ht->buckets[entry]) fr_hash_table_fixup(ht, entry);
 
        return list_find(ht, ht->buckets[entry], reversed, data);
 }
@@ -465,14 +465,14 @@ static lrad_hash_entry_t *lrad_hash_table_find(lrad_hash_table_t *ht,
 /*
  *     Replace old data with new data, OR insert if there is no old.
  */
-int lrad_hash_table_replace(lrad_hash_table_t *ht, void *data)
+int fr_hash_table_replace(fr_hash_table_t *ht, void *data)
 {
-       lrad_hash_entry_t *node;
+       fr_hash_entry_t *node;
 
        if (!ht || !data) return 0;
 
-       node = lrad_hash_table_find(ht, data);
-       if (!node) return lrad_hash_table_insert(ht, data);
+       node = fr_hash_table_find(ht, data);
+       if (!node) return fr_hash_table_insert(ht, data);
 
        if (ht->free) ht->free(node->data);
        node->data = data;
@@ -484,11 +484,11 @@ int lrad_hash_table_replace(lrad_hash_table_t *ht, void *data)
 /*
  *     Find data from a template
  */
-void *lrad_hash_table_finddata(lrad_hash_table_t *ht, const void *data)
+void *fr_hash_table_finddata(fr_hash_table_t *ht, const void *data)
 {
-       lrad_hash_entry_t *node;
+       fr_hash_entry_t *node;
 
-       node = lrad_hash_table_find(ht, data);
+       node = fr_hash_table_find(ht, data);
        if (!node) return NULL;
 
        return node->data;
@@ -499,13 +499,13 @@ void *lrad_hash_table_finddata(lrad_hash_table_t *ht, const void *data)
 /*
  *     Yank an entry from the hash table, without freeing the data.
  */
-void *lrad_hash_table_yank(lrad_hash_table_t *ht, const void *data)
+void *fr_hash_table_yank(fr_hash_table_t *ht, const void *data)
 {
        uint32_t key;
        uint32_t entry;
        uint32_t reversed;
        void *old;
-       lrad_hash_entry_t *node;
+       fr_hash_entry_t *node;
 
        if (!ht) return NULL;
 
@@ -513,7 +513,7 @@ void *lrad_hash_table_yank(lrad_hash_table_t *ht, const void *data)
        entry = key & ht->mask;
        reversed = reverse(key);
 
-       if (!ht->buckets[entry]) lrad_hash_table_fixup(ht, entry);
+       if (!ht->buckets[entry]) fr_hash_table_fixup(ht, entry);
 
        node = list_find(ht, ht->buckets[entry], reversed, data);
        if (!node) return NULL;
@@ -531,11 +531,11 @@ void *lrad_hash_table_yank(lrad_hash_table_t *ht, const void *data)
 /*
  *     Delete a piece of data from the hash table.
  */
-int lrad_hash_table_delete(lrad_hash_table_t *ht, const void *data)
+int fr_hash_table_delete(fr_hash_table_t *ht, const void *data)
 {
        void *old;
 
-       old = lrad_hash_table_yank(ht, data);
+       old = fr_hash_table_yank(ht, data);
        if (!old) return 0;
 
        if (ht->free) ht->free(old);
@@ -547,10 +547,10 @@ int lrad_hash_table_delete(lrad_hash_table_t *ht, const void *data)
 /*
  *     Free a hash table
  */
-void lrad_hash_table_free(lrad_hash_table_t *ht)
+void fr_hash_table_free(fr_hash_table_t *ht)
 {
        int i;
-       lrad_hash_entry_t *node, *next;
+       fr_hash_entry_t *node, *next;
 
        if (!ht) return;
 
@@ -578,7 +578,7 @@ void lrad_hash_table_free(lrad_hash_table_t *ht)
 /*
  *     Count number of elements
  */
-int lrad_hash_table_num_elements(lrad_hash_table_t *ht)
+int fr_hash_table_num_elements(fr_hash_table_t *ht)
 {
        if (!ht) return 0;
 
@@ -589,8 +589,8 @@ int lrad_hash_table_num_elements(lrad_hash_table_t *ht)
 /*
  *     Walk over the nodes, allowing deletes & inserts to happen.
  */
-int lrad_hash_table_walk(lrad_hash_table_t *ht,
-                        lrad_hash_table_walk_t callback,
+int fr_hash_table_walk(fr_hash_table_t *ht,
+                        fr_hash_table_walk_t callback,
                         void *context)
 {
        int i, rcode;;
@@ -598,12 +598,12 @@ int lrad_hash_table_walk(lrad_hash_table_t *ht,
        if (!ht || !callback) return 0;
 
        for (i = ht->num_buckets - 1; i >= 0; i--) {
-               lrad_hash_entry_t *node, *next;
+               fr_hash_entry_t *node, *next;
 
                /*
                 *      Ensure that the current bucket is filled.
                 */
-               if (!ht->buckets[i]) lrad_hash_table_fixup(ht, i);
+               if (!ht->buckets[i]) fr_hash_table_fixup(ht, i);
 
                for (node = ht->buckets[i]; node != &ht->null; node = next) {
                        next = node->next;
@@ -621,7 +621,7 @@ int lrad_hash_table_walk(lrad_hash_table_t *ht,
 /*
  *     Show what the hash table is doing.
  */
-int lrad_hash_table_info(lrad_hash_table_t *ht)
+int fr_hash_table_info(fr_hash_table_t *ht)
 {
        int i, a, collisions, uninitialized;
        int array[256];
@@ -634,7 +634,7 @@ int lrad_hash_table_info(lrad_hash_table_t *ht)
        for (i = 0; i < ht->num_buckets; i++) {
                uint32_t key;
                int load;
-               lrad_hash_entry_t *node, *next;
+               fr_hash_entry_t *node, *next;
 
                /*
                 *      If we haven't inserted or looked up an entry
@@ -703,7 +703,7 @@ int lrad_hash_table_info(lrad_hash_table_t *ht)
  *     Which also includes public domain source.  We've re-written
  *     it here for our purposes.
  */
-uint32_t lrad_hash(const void *data, size_t size)
+uint32_t fr_hash(const void *data, size_t size)
 {
        const uint8_t *p = data;
        const uint8_t *q = p + size;
@@ -736,7 +736,7 @@ uint32_t lrad_hash(const void *data, size_t size)
 /*
  *     Continue hashing data.
  */
-uint32_t lrad_hash_update(const void *data, size_t size, uint32_t hash)
+uint32_t fr_hash_update(const void *data, size_t size, uint32_t hash)
 {
        const uint8_t *p = data;
        const uint8_t *q = p + size;
@@ -756,7 +756,7 @@ uint32_t lrad_hash_update(const void *data, size_t size, uint32_t hash)
  *
  *     If you need a non-power-of-two hash, cope.
  */
-uint32_t lrad_hash_fold(uint32_t hash, int bits)
+uint32_t fr_hash_fold(uint32_t hash, int bits)
 {
        int count;
        uint32_t result;
@@ -780,7 +780,7 @@ uint32_t lrad_hash_fold(uint32_t hash, int bits)
 /*
  *     Hash a C string, so we loop over it once.
  */
-uint32_t lrad_hash_string(const char *p)
+uint32_t fr_hash_string(const char *p)
 {
        uint32_t      hash = FNV_MAGIC_INIT;
 
@@ -805,17 +805,17 @@ uint32_t lrad_hash_string(const char *p)
 
 static uint32_t hash_int(const void *data)
 {
-       return lrad_hash((int *) data, sizeof(int));
+       return fr_hash((int *) data, sizeof(int));
 }
 
 #define MAX 1024*1024
 int main(int argc, char **argv)
 {
        int i, *p, *q, k;
-       lrad_hash_table_t *ht;
+       fr_hash_table_t *ht;
        int *array;
 
-       ht = lrad_hash_table_create(hash_int, NULL, NULL);
+       ht = fr_hash_table_create(hash_int, NULL, NULL);
        if (!ht) {
                fprintf(stderr, "Hash create failed\n");
                exit(1);
@@ -828,12 +828,12 @@ int main(int argc, char **argv)
                p = array + i;
                *p = i;
 
-               if (!lrad_hash_table_insert(ht, p)) {
+               if (!fr_hash_table_insert(ht, p)) {
                        fprintf(stderr, "Failed insert %08x\n", i);
                        exit(1);
                }
 #ifdef TEST_INSERT
-               q = lrad_hash_table_finddata(ht, p);
+               q = fr_hash_table_finddata(ht, p);
                if (q != p) {
                        fprintf(stderr, "Bad data %d\n", i);
                        exit(1);
@@ -841,7 +841,7 @@ int main(int argc, char **argv)
 #endif
        }
 
-       lrad_hash_table_info(ht);
+       fr_hash_table_info(ht);
 
        /*
         *      Build this to see how lookups result in shortening
@@ -849,18 +849,18 @@ int main(int argc, char **argv)
         */
        if (1) {
                for (i = 0; i < MAX ; i++) {
-                       q = lrad_hash_table_finddata(ht, &i);
+                       q = fr_hash_table_finddata(ht, &i);
                        if (!q || *q != i) {
                                fprintf(stderr, "Failed finding %d\n", i);
                                exit(1);
                        }
 
 #if 0
-                       if (!lrad_hash_table_delete(ht, &i)) {
+                       if (!fr_hash_table_delete(ht, &i)) {
                                fprintf(stderr, "Failed deleting %d\n", i);
                                exit(1);
                        }
-                       q = lrad_hash_table_finddata(ht, &i);
+                       q = fr_hash_table_finddata(ht, &i);
                        if (q) {
                                fprintf(stderr, "Failed to delete %08x\n", i);
                                exit(1);
@@ -868,10 +868,10 @@ int main(int argc, char **argv)
 #endif
                }
 
-               lrad_hash_table_info(ht);
+               fr_hash_table_info(ht);
        }
 
-       lrad_hash_table_free(ht);
+       fr_hash_table_free(ht);
        free(array);
 
        exit(0);
index ac92135..9d73c82 100644 (file)
@@ -27,7 +27,7 @@ RCSID("$Id$")
   *(r++) = b = (ind(mm,y>>RANDSIZL) + x) & 0xffffffff; \
 }
 
-void lrad_isaac(lrad_randctx *ctx)
+void fr_isaac(fr_randctx *ctx)
 {
    register uint32_t a,b,x,y,*m,*mm,*m2,*r,*mend;
    mm=ctx->randmem; r=ctx->randrsl;
@@ -63,7 +63,7 @@ void lrad_isaac(lrad_randctx *ctx)
 }
 
 /* if (flag==1), then use the contents of randrsl[] to initialize mm[]. */
-void lrad_randinit(lrad_randctx *ctx, int flag)
+void fr_randinit(fr_randctx *ctx, int flag)
 {
   int i;
   uint32_t a,b,c,d,e,f,g,h;
@@ -103,7 +103,7 @@ void lrad_randinit(lrad_randctx *ctx, int flag)
     }
   }
 
-  lrad_isaac(ctx);       /* fill in the first set of results */
+  fr_isaac(ctx);       /* fill in the first set of results */
   ctx->randcnt=RANDSIZ;  /* prepare to use the first set of results */
 }
 
@@ -117,14 +117,14 @@ void lrad_randinit(lrad_randctx *ctx, int flag)
 int main()
 {
   uint32_t i,j;
-  lrad_randctx ctx;
+  fr_randctx ctx;
 
   ctx.randa = ctx.randb = ctx.randc = (uint32_t)0;
 
   for (i=0; i<256; ++i) ctx.randrsl[i]=(uint32_t)0;
-  lrad_randinit(&ctx, 1);
+  fr_randinit(&ctx, 1);
   for (i=0; i<2; ++i) {
-    lrad_isaac(&ctx);
+    fr_isaac(&ctx);
     for (j=0; j<256; ++j) {
       printf("%.8lx",ctx.randrsl[j]);
       if ((j&7)==7) printf("\n");
index f494a43..d76c30f 100644 (file)
@@ -398,7 +398,7 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t cnt)
  *     address family, or the first address (of whatever family),
  *     if AF_UNSPEC is used.
  */
-int ip_hton(const char *src, int af, lrad_ipaddr_t *dst)
+int ip_hton(const char *src, int af, fr_ipaddr_t *dst)
 {
        int error;
        struct addrinfo hints, *ai = NULL, *res = NULL;
@@ -454,7 +454,7 @@ int ip_hton(const char *src, int af, lrad_ipaddr_t *dst)
 /*
  *     Look IP addreses up, and print names (depending on DNS config)
  */
-const char *ip_ntoh(const lrad_ipaddr_t *src, char *dst, size_t cnt)
+const char *ip_ntoh(const fr_ipaddr_t *src, char *dst, size_t cnt)
 {
        struct sockaddr_storage ss;
        struct sockaddr_in  *s4;
@@ -513,7 +513,7 @@ static const char *hextab = "0123456789abcdef";
  *
  *     We allow: hex == bin
  */
-int lrad_hex2bin(const char *hex, uint8_t *bin, int len)
+int fr_hex2bin(const char *hex, uint8_t *bin, int len)
 {
        int i;
        char *c1, *c2;
@@ -534,7 +534,7 @@ int lrad_hex2bin(const char *hex, uint8_t *bin, int len)
  *
  *     If the output buffer isn't long enough, we have a buffer overflow.
  */
-void lrad_bin2hex(const uint8_t *bin, char *hex, int len)
+void fr_bin2hex(const uint8_t *bin, char *hex, int len)
 {
        int i;
 
@@ -580,7 +580,7 @@ int closefrom(int fd)
 }
 #endif
 
-int lrad_ipaddr_cmp(const lrad_ipaddr_t *a, const lrad_ipaddr_t *b)
+int fr_ipaddr_cmp(const fr_ipaddr_t *a, const fr_ipaddr_t *b)
 {
        if (a->af < b->af) return -1;
        if (a->af > b->af) return +1;
index fca143a..eb9b955 100644 (file)
@@ -33,18 +33,18 @@ RCSID("$Id$")
  *     Take the key fields of a request packet, and convert it to a
  *     hash.
  */
-uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet)
+uint32_t fr_request_packet_hash(const RADIUS_PACKET *packet)
 {
        uint32_t hash;
 
        if (packet->hash) return packet->hash;
 
-       hash = lrad_hash(&packet->sockfd, sizeof(packet->sockfd));
-       hash = lrad_hash_update(&packet->src_port, sizeof(packet->src_port),
+       hash = fr_hash(&packet->sockfd, sizeof(packet->sockfd));
+       hash = fr_hash_update(&packet->src_port, sizeof(packet->src_port),
                                hash);
-       hash = lrad_hash_update(&packet->dst_port,
+       hash = fr_hash_update(&packet->dst_port,
                                sizeof(packet->dst_port), hash);
-       hash = lrad_hash_update(&packet->src_ipaddr.af,
+       hash = fr_hash_update(&packet->src_ipaddr.af,
                                sizeof(packet->src_ipaddr.af), hash);
 
        /*
@@ -52,18 +52,18 @@ uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet)
         */
        switch (packet->src_ipaddr.af) {
        case AF_INET:
-               hash = lrad_hash_update(&packet->src_ipaddr.ipaddr.ip4addr,
+               hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip4addr,
                                        sizeof(packet->src_ipaddr.ipaddr.ip4addr),
                                        hash);
-               hash = lrad_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr,
+               hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr,
                                        sizeof(packet->dst_ipaddr.ipaddr.ip4addr),
                                        hash);
                break;
        case AF_INET6:
-               hash = lrad_hash_update(&packet->src_ipaddr.ipaddr.ip6addr,
+               hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip6addr,
                                        sizeof(packet->src_ipaddr.ipaddr.ip6addr),
                                        hash);
-               hash = lrad_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr,
+               hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr,
                                        sizeof(packet->dst_ipaddr.ipaddr.ip6addr),
                                        hash);
                break;
@@ -71,7 +71,7 @@ uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet)
                break;
        }
 
-       return lrad_hash_update(&packet->id, sizeof(packet->id), hash);
+       return fr_hash_update(&packet->id, sizeof(packet->id), hash);
 }
 
 
@@ -84,17 +84,17 @@ uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet)
  *     of the request.  e.g. where the request does (src, dst), we do
  *     (dst, src)
  */
-uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet)
+uint32_t fr_reply_packet_hash(const RADIUS_PACKET *packet)
 {
        uint32_t hash;
 
-       hash = lrad_hash(&packet->sockfd, sizeof(packet->sockfd));
-       hash = lrad_hash_update(&packet->id, sizeof(packet->id), hash);
-       hash = lrad_hash_update(&packet->src_port, sizeof(packet->src_port),
+       hash = fr_hash(&packet->sockfd, sizeof(packet->sockfd));
+       hash = fr_hash_update(&packet->id, sizeof(packet->id), hash);
+       hash = fr_hash_update(&packet->src_port, sizeof(packet->src_port),
                                hash);
-       hash = lrad_hash_update(&packet->dst_port,
+       hash = fr_hash_update(&packet->dst_port,
                                sizeof(packet->dst_port), hash);
-       hash = lrad_hash_update(&packet->src_ipaddr.af,
+       hash = fr_hash_update(&packet->src_ipaddr.af,
                                sizeof(packet->src_ipaddr.af), hash);
 
        /*
@@ -102,18 +102,18 @@ uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet)
         */
        switch (packet->src_ipaddr.af) {
        case AF_INET:
-               hash = lrad_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr,
+               hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip4addr,
                                        sizeof(packet->dst_ipaddr.ipaddr.ip4addr),
                                        hash);
-               hash = lrad_hash_update(&packet->src_ipaddr.ipaddr.ip4addr,
+               hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip4addr,
                                        sizeof(packet->src_ipaddr.ipaddr.ip4addr),
                                        hash);
                break;
        case AF_INET6:
-               hash = lrad_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr,
+               hash = fr_hash_update(&packet->dst_ipaddr.ipaddr.ip6addr,
                                        sizeof(packet->dst_ipaddr.ipaddr.ip6addr),
                                        hash);
-               hash = lrad_hash_update(&packet->src_ipaddr.ipaddr.ip6addr,
+               hash = fr_hash_update(&packet->src_ipaddr.ipaddr.ip6addr,
                                        sizeof(packet->src_ipaddr.ipaddr.ip6addr),
                                        hash);
                break;
@@ -121,7 +121,7 @@ uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet)
                break;
        }
 
-       return lrad_hash_update(&packet->id, sizeof(packet->id), hash);
+       return fr_hash_update(&packet->id, sizeof(packet->id), hash);
 }
 
 
@@ -132,7 +132,7 @@ uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet)
  *     That's because if the authentication vector is different,
  *     it means that the NAS has given up on the earlier request.
  */
-int lrad_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b)
+int fr_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b)
 {
        int rcode;
 
@@ -148,16 +148,16 @@ int lrad_packet_cmp(const RADIUS_PACKET *a, const RADIUS_PACKET *b)
        if (a->dst_port < b->dst_port) return -1;
        if (a->dst_port > b->dst_port) return +1;
 
-       rcode = lrad_ipaddr_cmp(&a->dst_ipaddr, &b->dst_ipaddr);
+       rcode = fr_ipaddr_cmp(&a->dst_ipaddr, &b->dst_ipaddr);
        if (rcode != 0) return rcode;
-       return lrad_ipaddr_cmp(&a->src_ipaddr, &b->src_ipaddr);
+       return fr_ipaddr_cmp(&a->src_ipaddr, &b->src_ipaddr);
 }
 
 
 /*
  *     Create a fake "request" from a reply, for later lookup.
  */
-void lrad_request_from_reply(RADIUS_PACKET *request,
+void fr_request_from_reply(RADIUS_PACKET *request,
                             const RADIUS_PACKET *reply)
 {
        request->sockfd = reply->sockfd;
@@ -172,7 +172,7 @@ void lrad_request_from_reply(RADIUS_PACKET *request,
 /*
  *     Open a socket on the given IP and port.
  */
-int lrad_socket(lrad_ipaddr_t *ipaddr, int port)
+int fr_socket(fr_ipaddr_t *ipaddr, int port)
 {
        int sockfd;
        struct sockaddr_storage salocal;
@@ -252,16 +252,16 @@ int lrad_socket(lrad_ipaddr_t *ipaddr, int port)
 /*
  *     We need to keep track of the socket & it's IP/port.
  */
-typedef struct lrad_packet_socket_t {
+typedef struct fr_packet_socket_t {
        int             sockfd;
 
        int             num_outgoing;
 
        int             offset; /* 0..31 */
        int             inaddr_any;
-       lrad_ipaddr_t   ipaddr;
+       fr_ipaddr_t     ipaddr;
        int             port;
-} lrad_packet_socket_t;
+} fr_packet_socket_t;
 
 
 #define FNV_MAGIC_PRIME (0x01000193)
@@ -275,24 +275,24 @@ typedef struct lrad_packet_socket_t {
  *     Structure defining a list of packets (incoming or outgoing)
  *     that should be managed.
  */
-struct lrad_packet_list_t {
-       lrad_hash_table_t *ht;
+struct fr_packet_list_t {
+       fr_hash_table_t *ht;
 
-       lrad_hash_table_t *dst2id_ht;
+       fr_hash_table_t *dst2id_ht;
 
        int             alloc_id;
        int             num_outgoing;
 
        uint32_t mask;
        int last_recv;
-       lrad_packet_socket_t sockets[MAX_SOCKETS];
+       fr_packet_socket_t sockets[MAX_SOCKETS];
 };
 
 
 /*
  *     Ugh.  Doing this on every sent/received packet is not nice.
  */
-static lrad_packet_socket_t *lrad_socket_find(lrad_packet_list_t *pl,
+static fr_packet_socket_t *fr_socket_find(fr_packet_list_t *pl,
                                             int sockfd)
 {
        int i, start;
@@ -308,13 +308,13 @@ static lrad_packet_socket_t *lrad_socket_find(lrad_packet_list_t *pl,
        return NULL;
 }
 
-int lrad_packet_list_socket_remove(lrad_packet_list_t *pl, int sockfd)
+int fr_packet_list_socket_remove(fr_packet_list_t *pl, int sockfd)
 {
-       lrad_packet_socket_t *ps;
+       fr_packet_socket_t *ps;
 
        if (!pl) return 0;
 
-       ps = lrad_socket_find(pl, sockfd);
+       ps = fr_socket_find(pl, sockfd);
        if (!ps) return 0;
 
        /*
@@ -329,12 +329,12 @@ int lrad_packet_list_socket_remove(lrad_packet_list_t *pl, int sockfd)
        return 1;
 }
 
-int lrad_packet_list_socket_add(lrad_packet_list_t *pl, int sockfd)
+int fr_packet_list_socket_add(fr_packet_list_t *pl, int sockfd)
 {
        int i, start;
        struct sockaddr_storage src;
        socklen_t               sizeof_src = sizeof(src);
-       lrad_packet_socket_t    *ps;
+       fr_packet_socket_t      *ps;
 
        if (!pl) return 0;
 
@@ -409,7 +409,7 @@ int lrad_packet_list_socket_add(lrad_packet_list_t *pl, int sockfd)
 
 static uint32_t packet_entry_hash(const void *data)
 {
-       return lrad_request_packet_hash(*(const RADIUS_PACKET * const *) data);
+       return fr_request_packet_hash(*(const RADIUS_PACKET * const *) data);
 }
 
 static int packet_entry_cmp(const void *one, const void *two)
@@ -417,7 +417,7 @@ static int packet_entry_cmp(const void *one, const void *two)
        const RADIUS_PACKET * const *a = one;
        const RADIUS_PACKET * const *b = two;
 
-       return lrad_packet_cmp(*a, *b);
+       return fr_packet_cmp(*a, *b);
 }
 
 /*
@@ -435,28 +435,28 @@ static int packet_entry_cmp(const void *one, const void *two)
  *     This means that if destinations are added and removed, they
  *     won't be removed from this tree.
  */
-typedef struct lrad_packet_dst2id_t {
-       lrad_ipaddr_t   dst_ipaddr;
+typedef struct fr_packet_dst2id_t {
+       fr_ipaddr_t     dst_ipaddr;
        int             dst_port;
        uint32_t        id[1];  /* really id[256] */
-} lrad_packet_dst2id_t;
+} fr_packet_dst2id_t;
 
 
 static uint32_t packet_dst2id_hash(const void *data)
 {
        uint32_t hash;
-       const lrad_packet_dst2id_t *pd = data;
+       const fr_packet_dst2id_t *pd = data;
 
-       hash = lrad_hash(&pd->dst_port, sizeof(pd->dst_port));
+       hash = fr_hash(&pd->dst_port, sizeof(pd->dst_port));
 
        switch (pd->dst_ipaddr.af) {
        case AF_INET:
-               hash = lrad_hash_update(&pd->dst_ipaddr.ipaddr.ip4addr,
+               hash = fr_hash_update(&pd->dst_ipaddr.ipaddr.ip4addr,
                                        sizeof(pd->dst_ipaddr.ipaddr.ip4addr),
                                        hash);
                break;
        case AF_INET6:
-               hash = lrad_hash_update(&pd->dst_ipaddr.ipaddr.ip6addr,
+               hash = fr_hash_update(&pd->dst_ipaddr.ipaddr.ip6addr,
                                        sizeof(pd->dst_ipaddr.ipaddr.ip6addr),
                                        hash);
                break;
@@ -469,13 +469,13 @@ static uint32_t packet_dst2id_hash(const void *data)
 
 static int packet_dst2id_cmp(const void *one, const void *two)
 {
-       const lrad_packet_dst2id_t *a = one;
-       const lrad_packet_dst2id_t *b = two;
+       const fr_packet_dst2id_t *a = one;
+       const fr_packet_dst2id_t *b = two;
 
        if (a->dst_port < b->dst_port) return -1;
        if (a->dst_port > b->dst_port) return +1;
 
-       return lrad_ipaddr_cmp(&a->dst_ipaddr, &b->dst_ipaddr);
+       return fr_ipaddr_cmp(&a->dst_ipaddr, &b->dst_ipaddr);
 }
 
 static void packet_dst2id_free(void *data)
@@ -484,12 +484,12 @@ static void packet_dst2id_free(void *data)
 }
 
 
-void lrad_packet_list_free(lrad_packet_list_t *pl)
+void fr_packet_list_free(fr_packet_list_t *pl)
 {
        if (!pl) return;
 
-       lrad_hash_table_free(pl->ht);
-       lrad_hash_table_free(pl->dst2id_ht);
+       fr_hash_table_free(pl->ht);
+       fr_hash_table_free(pl->dst2id_ht);
        free(pl);
 }
 
@@ -497,20 +497,20 @@ void lrad_packet_list_free(lrad_packet_list_t *pl)
 /*
  *     Caller is responsible for managing the packet entries.
  */
-lrad_packet_list_t *lrad_packet_list_create(int alloc_id)
+fr_packet_list_t *fr_packet_list_create(int alloc_id)
 {
        int i;
-       lrad_packet_list_t      *pl;
+       fr_packet_list_t        *pl;
 
        pl = malloc(sizeof(*pl));
        if (!pl) return NULL;
        memset(pl, 0, sizeof(*pl));
 
-       pl->ht = lrad_hash_table_create(packet_entry_hash,
+       pl->ht = fr_hash_table_create(packet_entry_hash,
                                        packet_entry_cmp,
                                        NULL);
        if (!pl->ht) {
-               lrad_packet_list_free(pl);
+               fr_packet_list_free(pl);
                return NULL;
        }
 
@@ -521,11 +521,11 @@ lrad_packet_list_t *lrad_packet_list_create(int alloc_id)
        if (alloc_id) {
                pl->alloc_id = 1;
 
-               pl->dst2id_ht = lrad_hash_table_create(packet_dst2id_hash,
+               pl->dst2id_ht = fr_hash_table_create(packet_dst2id_hash,
                                                       packet_dst2id_cmp,
                                                       packet_dst2id_free);
                if (!pl->dst2id_ht) {
-                       lrad_packet_list_free(pl);
+                       fr_packet_list_free(pl);
                        return NULL;
                }
        }
@@ -535,25 +535,25 @@ lrad_packet_list_t *lrad_packet_list_create(int alloc_id)
 
 
 /*
- *     If pl->alloc_id is set, then lrad_packet_list_id_alloc() MUST
+ *     If pl->alloc_id is set, then fr_packet_list_id_alloc() MUST
  *     be called before inserting the packet into the list!
  */
-int lrad_packet_list_insert(lrad_packet_list_t *pl,
+int fr_packet_list_insert(fr_packet_list_t *pl,
                            RADIUS_PACKET **request_p)
 {
        if (!pl || !request_p || !*request_p) return 0;
 
-       (*request_p)->hash = lrad_request_packet_hash(*request_p);
+       (*request_p)->hash = fr_request_packet_hash(*request_p);
 
-       return lrad_hash_table_insert(pl->ht, request_p);
+       return fr_hash_table_insert(pl->ht, request_p);
 }
 
-RADIUS_PACKET **lrad_packet_list_find(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_find(fr_packet_list_t *pl,
                                      RADIUS_PACKET *request)
 {
        if (!pl || !request) return 0;
 
-       return lrad_hash_table_finddata(pl->ht, &request);
+       return fr_hash_table_finddata(pl->ht, &request);
 }
 
 
@@ -561,15 +561,15 @@ RADIUS_PACKET **lrad_packet_list_find(lrad_packet_list_t *pl,
  *     This presumes that the reply has dst_ipaddr && dst_port set up
  *     correctly (i.e. real IP, or "*").
  */
-RADIUS_PACKET **lrad_packet_list_find_byreply(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_find_byreply(fr_packet_list_t *pl,
                                              RADIUS_PACKET *reply)
 {
        RADIUS_PACKET my_request, *request;
-       lrad_packet_socket_t *ps;
+       fr_packet_socket_t *ps;
 
        if (!pl || !reply) return NULL;
 
-       ps = lrad_socket_find(pl, reply->sockfd);
+       ps = fr_socket_find(pl, reply->sockfd);
        if (!ps) return NULL;
 
        /*
@@ -594,23 +594,23 @@ RADIUS_PACKET **lrad_packet_list_find_byreply(lrad_packet_list_t *pl,
 
        request = &my_request;
 
-       return lrad_hash_table_finddata(pl->ht, &request);
+       return fr_hash_table_finddata(pl->ht, &request);
 }
 
 
-RADIUS_PACKET **lrad_packet_list_yank(lrad_packet_list_t *pl,
+RADIUS_PACKET **fr_packet_list_yank(fr_packet_list_t *pl,
                                      RADIUS_PACKET *request)
 {
        if (!pl || !request) return NULL;
 
-       return lrad_hash_table_yank(pl->ht, &request);
+       return fr_hash_table_yank(pl->ht, &request);
 }
 
-int lrad_packet_list_num_elements(lrad_packet_list_t *pl)
+int fr_packet_list_num_elements(fr_packet_list_t *pl)
 {
        if (!pl) return 0;
 
-       return lrad_hash_table_num_elements(pl->ht);
+       return fr_hash_table_num_elements(pl->ht);
 }
 
 
@@ -627,20 +627,20 @@ int lrad_packet_list_num_elements(lrad_packet_list_t *pl)
  *     the same mutex as the one protecting the insert/find/yank
  *     calls!
  */
-int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
+int fr_packet_list_id_alloc(fr_packet_list_t *pl,
                              RADIUS_PACKET *request)
 {
        int i, id, start;
        uint32_t free_mask;
-       lrad_packet_dst2id_t my_pd, *pd;
-       lrad_packet_socket_t *ps;
+       fr_packet_dst2id_t my_pd, *pd;
+       fr_packet_socket_t *ps;
 
        if (!pl || !pl->alloc_id || !request) return 0;
 
        my_pd.dst_ipaddr = request->dst_ipaddr;
        my_pd.dst_port = request->dst_port;
 
-       pd = lrad_hash_table_finddata(pl->dst2id_ht, &my_pd);
+       pd = fr_hash_table_finddata(pl->dst2id_ht, &my_pd);
        if (!pd) {
                pd = malloc(sizeof(*pd) + 255 * sizeof(pd->id[0]));
                if (!pd) return 0;
@@ -650,7 +650,7 @@ int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
                pd->dst_ipaddr = request->dst_ipaddr;
                pd->dst_port = request->dst_port;
 
-               if (!lrad_hash_table_insert(pl->dst2id_ht, pd)) {
+               if (!fr_hash_table_insert(pl->dst2id_ht, pd)) {
                        free(pd);
                        return 0;
                }
@@ -667,7 +667,7 @@ int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
         *      Id's only when all responses have been received, OR after
         *      a timeout.
         */
-       id = start = (int) lrad_rand() & 0xff;
+       id = start = (int) fr_rand() & 0xff;
 
        while (pd->id[id] == pl->mask) { /* all sockets are using this ID */
                id++;
@@ -711,21 +711,21 @@ int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
  *     Should be called AFTER yanking it from the list, so that
  *     any newly inserted entries don't collide with this one.
  */
-int lrad_packet_list_id_free(lrad_packet_list_t *pl,
+int fr_packet_list_id_free(fr_packet_list_t *pl,
                             RADIUS_PACKET *request)
 {
-       lrad_packet_socket_t *ps;
-       lrad_packet_dst2id_t my_pd, *pd;
+       fr_packet_socket_t *ps;
+       fr_packet_dst2id_t my_pd, *pd;
 
        if (!pl || !request) return 0;
 
-       ps = lrad_socket_find(pl, request->sockfd);
+       ps = fr_socket_find(pl, request->sockfd);
        if (!ps) return 0;
 
        my_pd.dst_ipaddr = request->dst_ipaddr;
        my_pd.dst_port = request->dst_port;
 
-       pd = lrad_hash_table_finddata(pl->dst2id_ht, &my_pd);
+       pd = fr_hash_table_finddata(pl->dst2id_ht, &my_pd);
        if (!pd) return 0;
 
        pd->id[request->id] &= ~(1 << ps->offset);
@@ -737,15 +737,15 @@ int lrad_packet_list_id_free(lrad_packet_list_t *pl,
        return 1;
 }
 
-int lrad_packet_list_walk(lrad_packet_list_t *pl, void *ctx,
-                         lrad_hash_table_walk_t callback)
+int fr_packet_list_walk(fr_packet_list_t *pl, void *ctx,
+                         fr_hash_table_walk_t callback)
 {
        if (!pl || !callback) return 0;
 
-       return lrad_hash_table_walk(pl->ht, callback, ctx);
+       return fr_hash_table_walk(pl->ht, callback, ctx);
 }
 
-int lrad_packet_list_fd_set(lrad_packet_list_t *pl, fd_set *set)
+int fr_packet_list_fd_set(fr_packet_list_t *pl, fd_set *set)
 {
        int i, maxfd;
 
@@ -772,7 +772,7 @@ int lrad_packet_list_fd_set(lrad_packet_list_t *pl, fd_set *set)
  *     FIXME: Add sockfd, if -1, do round-robin, else do sockfd
  *             IF in fdset.
  */
-RADIUS_PACKET *lrad_packet_list_recv(lrad_packet_list_t *pl, fd_set *set)
+RADIUS_PACKET *fr_packet_list_recv(fr_packet_list_t *pl, fd_set *set)
 {
        int start;
        RADIUS_PACKET *packet;
@@ -792,7 +792,7 @@ RADIUS_PACKET *lrad_packet_list_recv(lrad_packet_list_t *pl, fd_set *set)
                if (!packet) continue;
 
                /*
-                *      Call lrad_packet_list_find_byreply().  If it
+                *      Call fr_packet_list_find_byreply().  If it
                 *      doesn't find anything, discard the reply.
                 */
 
@@ -803,19 +803,19 @@ RADIUS_PACKET *lrad_packet_list_recv(lrad_packet_list_t *pl, fd_set *set)
        return NULL;
 }
 
-int lrad_packet_list_num_incoming(lrad_packet_list_t *pl)
+int fr_packet_list_num_incoming(fr_packet_list_t *pl)
 {
        int num_elements;
 
        if (!pl) return 0;
 
-       num_elements = lrad_hash_table_num_elements(pl->ht);
+       num_elements = fr_hash_table_num_elements(pl->ht);
        if (num_elements < pl->num_outgoing) return 0; /* panic! */
 
        return num_elements - pl->num_outgoing;
 }
 
-int lrad_packet_list_num_outgoing(lrad_packet_list_t *pl)
+int fr_packet_list_num_outgoing(fr_packet_list_t *pl)
 {
        if (!pl) return 0;
 
index abebd27..ac9ccf8 100644 (file)
@@ -289,7 +289,7 @@ int vp_prints_value(char * out, int outlen, VALUE_PAIR *vp, int delimitst)
 
                        strcpy(buf, "0x");
 
-                       lrad_bin2hex(vp->vp_octets, buf + 2, vp->length);
+                       fr_bin2hex(vp->vp_octets, buf + 2, vp->length);
                        a = buf;
                  break;
 
index 1ca6ce6..a461173 100644 (file)
@@ -63,8 +63,8 @@ typedef struct radius_packet_t {
   uint8_t      data[1];
 } radius_packet_t;
 
-static lrad_randctx lrad_rand_pool;    /* across multiple calls */
-static int lrad_rand_initialized = 0;
+static fr_randctx fr_rand_pool;        /* across multiple calls */
+static int fr_rand_initialized = 0;
 static unsigned int salt_offset = 0;
 
 
@@ -130,8 +130,8 @@ static const char *packet_codes[] = {
  *     possible combinations.
  */
 static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
-                     lrad_ipaddr_t *src_ipaddr, int src_port,
-                     lrad_ipaddr_t *dst_ipaddr, int dst_port)
+                     fr_ipaddr_t *src_ipaddr, int src_port,
+                     fr_ipaddr_t *dst_ipaddr, int dst_port)
 {
        struct sockaddr_storage dst;
        socklen_t               sizeof_dst = sizeof(dst);
@@ -229,7 +229,7 @@ void rad_recv_discard(int sockfd)
 }
 
 
-ssize_t rad_recv_header(int sockfd, lrad_ipaddr_t *src_ipaddr, int *src_port,
+ssize_t rad_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, int *src_port,
                        int *code)
 {
        ssize_t                 data_len, packet_len;
@@ -317,8 +317,8 @@ ssize_t rad_recv_header(int sockfd, lrad_ipaddr_t *src_ipaddr, int *src_port,
  *     possible combinations.
  */
 static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
-                           lrad_ipaddr_t *src_ipaddr, uint16_t *src_port,
-                           lrad_ipaddr_t *dst_ipaddr, uint16_t *dst_port)
+                           fr_ipaddr_t *src_ipaddr, uint16_t *src_port,
+                           fr_ipaddr_t *dst_ipaddr, uint16_t *dst_port)
 {
        struct sockaddr_storage src;
        struct sockaddr_storage dst;
@@ -611,8 +611,8 @@ static void make_tunnel_passwd(uint8_t *output, int *outlen,
         *      add in some CSPRNG data.  should be OK..
         */
        passwd[0] = (0x80 | ( ((salt_offset++) & 0x0f) << 3) |
-                    (lrad_rand() & 0x07));
-       passwd[1] = lrad_rand();
+                    (fr_rand() & 0x07));
+       passwd[1] = fr_rand();
        passwd[2] = inlen;      /* length of the password string */
 
        fr_MD5Init(&context);
@@ -2404,7 +2404,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
         *      Merge information from the outside world into our
         *      random pool.
         */
-       lrad_rand_seed(packet->data, AUTH_HDR_LEN);
+       fr_rand_seed(packet->data, AUTH_HDR_LEN);
 
        return 0;
 }
@@ -2588,8 +2588,8 @@ int rad_tunnel_pwencode(char *passwd, int *pwlen, const char *secret,
         *      add in some CSPRNG data.  should be OK..
         */
        salt[0] = (0x80 | ( ((salt_offset++) & 0x0f) << 3) |
-                  (lrad_rand() & 0x07));
-       salt[1] = lrad_rand();
+                  (fr_rand() & 0x07));
+       salt[1] = fr_rand();
 
        /*
         *      Padd password to multiple of AUTH_PASS_LEN bytes.
@@ -2796,17 +2796,17 @@ int rad_chap_encode(RADIUS_PACKET *packet, uint8_t *output, int id,
  *
  *     May be called any number of times.
  */
-void lrad_rand_seed(const void *data, size_t size)
+void fr_rand_seed(const void *data, size_t size)
 {
        uint32_t hash;
 
        /*
         *      Ensure that the pool is initialized.
         */
-       if (!lrad_rand_initialized) {
+       if (!fr_rand_initialized) {
                int fd;
 
-               memset(&lrad_rand_pool, 0, sizeof(lrad_rand_pool));
+               memset(&fr_rand_pool, 0, sizeof(fr_rand_pool));
 
                fd = open("/dev/urandom", O_RDONLY);
                if (fd >= 0) {
@@ -2814,22 +2814,22 @@ void lrad_rand_seed(const void *data, size_t size)
                        ssize_t this;
 
                        total = this = 0;
-                       while (total < sizeof(lrad_rand_pool.randrsl)) {
-                               this = read(fd, lrad_rand_pool.randrsl,
-                                           sizeof(lrad_rand_pool.randrsl) - total);
+                       while (total < sizeof(fr_rand_pool.randrsl)) {
+                               this = read(fd, fr_rand_pool.randrsl,
+                                           sizeof(fr_rand_pool.randrsl) - total);
                                if ((this < 0) && (errno != EINTR)) break;
                                if (this > 0) total += this;
                        }
                        close(fd);
                } else {
-                       lrad_rand_pool.randrsl[0] = fd;
-                       lrad_rand_pool.randrsl[1] = time(NULL);
-                       lrad_rand_pool.randrsl[2] = errno;
+                       fr_rand_pool.randrsl[0] = fd;
+                       fr_rand_pool.randrsl[1] = time(NULL);
+                       fr_rand_pool.randrsl[2] = errno;
                }
 
-               lrad_randinit(&lrad_rand_pool, 1);
-               lrad_rand_pool.randcnt = 0;
-               lrad_rand_initialized = 1;
+               fr_randinit(&fr_rand_pool, 1);
+               fr_rand_pool.randcnt = 0;
+               fr_rand_initialized = 1;
        }
 
        if (!data) return;
@@ -2837,32 +2837,32 @@ void lrad_rand_seed(const void *data, size_t size)
        /*
         *      Hash the user data
         */
-       hash = lrad_rand();
-       if (!hash) hash = lrad_rand();
-       hash = lrad_hash_update(data, size, hash);
+       hash = fr_rand();
+       if (!hash) hash = fr_rand();
+       hash = fr_hash_update(data, size, hash);
 
-       lrad_rand_pool.randmem[lrad_rand_pool.randcnt] ^= hash;
+       fr_rand_pool.randmem[fr_rand_pool.randcnt] ^= hash;
 }
 
 
 /*
  *     Return a 32-bit random number.
  */
-uint32_t lrad_rand(void)
+uint32_t fr_rand(void)
 {
        uint32_t num;
 
        /*
         *      Ensure that the pool is initialized.
         */
-       if (!lrad_rand_initialized) {
-               lrad_rand_seed(NULL, 0);
+       if (!fr_rand_initialized) {
+               fr_rand_seed(NULL, 0);
        }
 
-       num = lrad_rand_pool.randrsl[lrad_rand_pool.randcnt++];
-       if (lrad_rand_pool.randcnt == 256) {
-               lrad_rand_pool.randcnt = 0;
-               lrad_isaac(&lrad_rand_pool);
+       num = fr_rand_pool.randrsl[fr_rand_pool.randcnt++];
+       if (fr_rand_pool.randcnt == 256) {
+               fr_rand_pool.randcnt = 0;
+               fr_isaac(&fr_rand_pool);
        }
 
        return num;
@@ -2892,13 +2892,13 @@ RADIUS_PACKET *rad_alloc(int newvector)
                 *      Don't expose the actual contents of the random
                 *      pool.
                 */
-               base = lrad_rand();
+               base = fr_rand();
                for (i = 0; i < AUTH_VECTOR_LEN; i += sizeof(uint32_t)) {
-                       hash = lrad_rand() ^ base;
+                       hash = fr_rand() ^ base;
                        memcpy(rp->vector + i, &hash, sizeof(hash));
                }
        }
-       lrad_rand();            /* stir the pool again */
+       fr_rand();              /* stir the pool again */
 
        return rp;
 }
index c57a5a0..3fba251 100644 (file)
@@ -29,7 +29,7 @@ RCSID("$Id$")
 
 #include <ctype.h>
 
-static const LRAD_NAME_NUMBER tokens[] = {
+static const FR_NAME_NUMBER tokens[] = {
        { "=~", T_OP_REG_EQ,    }, /* order is important! */
        { "!~", T_OP_REG_NE,    },
        { "{",  T_LCBRACE,      },
@@ -69,15 +69,15 @@ static const LRAD_NAME_NUMBER tokens[] = {
  *     At end-of-line, buf[0] is set to '\0'.
  *     Returns 0 or special token value.
  */
-static LRAD_TOKEN getthing(char **ptr, char *buf, int buflen, int tok,
-                          const LRAD_NAME_NUMBER *tokenlist)
+static FR_TOKEN getthing(char **ptr, char *buf, int buflen, int tok,
+                          const FR_NAME_NUMBER *tokenlist)
 {
        char    *s, *p;
        int     quote;
        int     escape;
        unsigned int    x;
-       const LRAD_NAME_NUMBER*t;
-       LRAD_TOKEN rcode;
+       const FR_NAME_NUMBER*t;
+       FR_TOKEN rcode;
 
        buf[0] = 0;
 
@@ -101,7 +101,7 @@ static LRAD_TOKEN getthing(char **ptr, char *buf, int buflen, int tok,
                        while (isspace((int) *p))
                                p++;
                        *ptr = p;
-                       return (LRAD_TOKEN) t->number;
+                       return (FR_TOKEN) t->number;
                }
        }
 
@@ -207,7 +207,7 @@ int getword(char **ptr, char *buf, int buflen)
  */
 int getbareword(char **ptr, char *buf, int buflen)
 {
-       LRAD_TOKEN token;
+       FR_TOKEN token;
 
        token = getthing(ptr, buf, buflen, 0, NULL);
        if (token != T_BARE_WORD) {
@@ -220,7 +220,7 @@ int getbareword(char **ptr, char *buf, int buflen)
 /*
  *     Read the next word, use tokens as delimiters.
  */
-LRAD_TOKEN gettoken(char **ptr, char *buf, int buflen)
+FR_TOKEN gettoken(char **ptr, char *buf, int buflen)
 {
        return getthing(ptr, buf, buflen, 1, tokens);
 }
@@ -228,7 +228,7 @@ LRAD_TOKEN gettoken(char **ptr, char *buf, int buflen)
 /*
  *     Expect a string.
  */
-LRAD_TOKEN getstring(char **ptr, char *buf, int buflen)
+FR_TOKEN getstring(char **ptr, char *buf, int buflen)
 {
        char *p = *ptr;
 
@@ -246,9 +246,9 @@ LRAD_TOKEN getstring(char **ptr, char *buf, int buflen)
 /*
  *     Convert a string to an integer
  */
-int lrad_str2int(const LRAD_NAME_NUMBER *table, const char *name, int def)
+int fr_str2int(const FR_NAME_NUMBER *table, const char *name, int def)
 {
-       const LRAD_NAME_NUMBER *this;
+       const FR_NAME_NUMBER *this;
 
        for (this = table; this->name != NULL; this++) {
                if (strcasecmp(this->name, name) == 0) {
@@ -262,10 +262,10 @@ int lrad_str2int(const LRAD_NAME_NUMBER *table, const char *name, int def)
 /*
  *     Convert an integer to a string.
  */
-const char *lrad_int2str(const LRAD_NAME_NUMBER *table, int number,
+const char *fr_int2str(const FR_NAME_NUMBER *table, int number,
                         const char *def)
 {
-       const LRAD_NAME_NUMBER *this;
+       const FR_NAME_NUMBER *this;
 
        for (this = table; this->name != NULL; this++) {
                if (this->number == number) {
index 56cb386..12f66ff 100644 (file)
@@ -865,7 +865,7 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
                        }
 
                        {
-                               lrad_ipaddr_t ipaddr;
+                               fr_ipaddr_t ipaddr;
 
                                if (ip_hton(cs, AF_INET, &ipaddr) < 0) {
                                        librad_log("Failed to find IP address for %s", cs);
@@ -1431,13 +1431,13 @@ static const int valid_attr_name[256] = {
  *     Read a valuepair from a buffer, and advance pointer.
  *     Sets *eol to T_EOL if end of line was encountered.
  */
-VALUE_PAIR *pairread(char **ptr, LRAD_TOKEN *eol)
+VALUE_PAIR *pairread(char **ptr, FR_TOKEN *eol)
 {
        char            buf[64];
        char            attr[64];
        char            value[512];
        char            *p, *q;
-       LRAD_TOKEN      token, t, xlat;
+       FR_TOKEN        token, t, xlat;
        VALUE_PAIR      *vp;
        size_t          len;
 
@@ -1583,12 +1583,12 @@ VALUE_PAIR *pairread(char **ptr, LRAD_TOKEN *eol)
  *     Read one line of attribute/value pairs. This might contain
  *     multiple pairs seperated by comma's.
  */
-LRAD_TOKEN userparse(char *buffer, VALUE_PAIR **first_pair)
+FR_TOKEN userparse(char *buffer, VALUE_PAIR **first_pair)
 {
        VALUE_PAIR      *vp;
        char            *p;
-       LRAD_TOKEN      last_token = T_OP_INVALID;
-       LRAD_TOKEN      previous_token;
+       FR_TOKEN        last_token = T_OP_INVALID;
+       FR_TOKEN        previous_token;
 
        /*
         *      We allow an empty line.
@@ -1626,7 +1626,7 @@ LRAD_TOKEN userparse(char *buffer, VALUE_PAIR **first_pair)
 VALUE_PAIR *readvp2(FILE *fp, int *pfiledone, const char *errprefix)
 {
        char buf[8192];
-       LRAD_TOKEN last_token = T_EOL;
+       FR_TOKEN last_token = T_EOL;
        VALUE_PAIR *vp;
        VALUE_PAIR *list;
        int error = 0;
index 7601eb9..95497f6 100644 (file)
@@ -73,7 +73,7 @@ RCSID("$Id$");
  *     Duplicate code is bad.
  */
 static int vqp_sendto(int sockfd, void *data, size_t data_len, int flags,
-                     lrad_ipaddr_t *src_ipaddr, lrad_ipaddr_t *dst_ipaddr,
+                     fr_ipaddr_t *src_ipaddr, fr_ipaddr_t *dst_ipaddr,
                      int dst_port)
 {
        struct sockaddr_storage dst;
@@ -166,8 +166,8 @@ static int vqp_sendto(int sockfd, void *data, size_t data_len, int flags,
  *     FIXME:  This is copied from rad_recvfrom, with minor edits.
  */
 static ssize_t vqp_recvfrom(int sockfd, uint8_t **pbuf, int flags,
-                           lrad_ipaddr_t *src_ipaddr, uint16_t *src_port,
-                           lrad_ipaddr_t *dst_ipaddr, uint16_t *dst_port)
+                           fr_ipaddr_t *src_ipaddr, uint16_t *src_port,
+                           fr_ipaddr_t *dst_ipaddr, uint16_t *dst_port)
 {
        struct sockaddr_storage src;
        struct sockaddr_storage dst;
index 0f0c7d9..626d186 100644 (file)
@@ -266,7 +266,7 @@ static int rad_check_password(REQUEST *request)
                                return -1;
                        }
 
-                       switch (lrad_crypt_check((char *)auth_item->vp_strvalue,
+                       switch (fr_crypt_check((char *)auth_item->vp_strvalue,
                                                                         (char *)password_pair->vp_strvalue)) {
                        case -1:
                          rad_authlog("Login incorrect "
index 4d568fc..9984b4e 100644 (file)
@@ -78,7 +78,7 @@ static int client_ipaddr_cmp(const void *one, const void *two)
        const RADCLIENT *a = one;
        const RADCLIENT *b = two;
 
-       return lrad_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
+       return fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
 }
 
 #ifdef WITH_SNMP
@@ -292,7 +292,7 @@ RADCLIENT *client_findbynumber(const RADCLIENT_LIST *clients,
  *     Find a client in the RADCLIENTS list.
  */
 RADCLIENT *client_find(const RADCLIENT_LIST *clients,
-                      const lrad_ipaddr_t *ipaddr)
+                      const fr_ipaddr_t *ipaddr)
 {
        int i, max_prefix;
        RADCLIENT myclient;
@@ -336,7 +336,7 @@ RADCLIENT *client_find(const RADCLIENT_LIST *clients,
 /*
  *     Old wrapper for client_find
  */
-RADCLIENT *client_find_old(const lrad_ipaddr_t *ipaddr)
+RADCLIENT *client_find_old(const fr_ipaddr_t *ipaddr)
 {
        return client_find(root_clients, ipaddr);
 }
@@ -346,7 +346,7 @@ RADCLIENT *client_find_old(const lrad_ipaddr_t *ipaddr)
  *     Find the name of a client (prefer short name).
  */
 const char *client_name(const RADCLIENT_LIST *clients,
-                       const lrad_ipaddr_t *ipaddr)
+                       const fr_ipaddr_t *ipaddr)
 {
        /* We don't call this unless we should know about the client. */
        RADCLIENT *cl;
@@ -372,7 +372,7 @@ const char *client_name(const RADCLIENT_LIST *clients,
        return "UNKNOWN-CLIENT";
 }
 
-const char *client_name_old(const lrad_ipaddr_t *ipaddr)
+const char *client_name_old(const fr_ipaddr_t *ipaddr)
 {
        return client_name(root_clients, ipaddr);
 }
index 3b90987..9d39795 100644 (file)
@@ -60,8 +60,8 @@ struct conf_pair {
        CONF_ITEM item;
        char *attr;
        char *value;
-       LRAD_TOKEN operator;
-       LRAD_TOKEN value_type;
+       FR_TOKEN operator;
+       FR_TOKEN value_type;
 };
 struct conf_part {
        CONF_ITEM item;
@@ -147,7 +147,7 @@ static CONF_ITEM *cf_datatoitem(CONF_DATA *cd)
  *     Create a new CONF_PAIR
  */
 static CONF_PAIR *cf_pair_alloc(const char *attr, const char *value,
-                               LRAD_TOKEN operator, LRAD_TOKEN value_type,
+                               FR_TOKEN operator, FR_TOKEN value_type,
                                CONF_SECTION *parent)
 {
        CONF_PAIR *cp;
@@ -781,7 +781,7 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
        int rcode = 0;
        char **q;
        const char *value;
-       lrad_ipaddr_t ipaddr;
+       fr_ipaddr_t ipaddr;
        const CONF_PAIR *cp;
        char ipbuf[128];
 
index 38c6a08..608b827 100644 (file)
@@ -33,8 +33,8 @@ RCSID("$Id$")
 /*
  *  No pthreads, no mutex.
  */
-static int lrad_crypt_init = 0;
-static pthread_mutex_t lrad_crypt_mutex;
+static int fr_crypt_init = 0;
+static pthread_mutex_t fr_crypt_mutex;
 #endif
 
 
@@ -45,7 +45,7 @@ static pthread_mutex_t lrad_crypt_mutex;
  *          -1 -- failed to crypt
  *           1 -- check failed
  */
-int lrad_crypt_check(const char *key, const char *crypted)
+int fr_crypt_check(const char *key, const char *crypted)
 {
        char *passwd;
        int cmp = 0;
@@ -54,12 +54,12 @@ int lrad_crypt_check(const char *key, const char *crypted)
        /*
         *      Ensure we're thread-safe, as crypt() isn't.
         */
-       if (lrad_crypt_init == 0) {
-               pthread_mutex_init(&lrad_crypt_mutex, NULL);
-               lrad_crypt_init = 1;
+       if (fr_crypt_init == 0) {
+               pthread_mutex_init(&fr_crypt_mutex, NULL);
+               fr_crypt_init = 1;
        }
 
-       pthread_mutex_lock(&lrad_crypt_mutex);
+       pthread_mutex_lock(&fr_crypt_mutex);
 #endif
 
        passwd = crypt(key, crypted);
@@ -74,7 +74,7 @@ int lrad_crypt_check(const char *key, const char *crypted)
        }
 
 #ifdef HAVE_PTHREAD_H
-       pthread_mutex_unlock(&lrad_crypt_mutex);
+       pthread_mutex_unlock(&fr_crypt_mutex);
 #endif
 
        /*
index 0b92103..42479b0 100644 (file)
@@ -44,7 +44,7 @@ typedef struct listen_detail_t {
        FILE            *fp;
        int             state;
        time_t          timestamp;
-       lrad_ipaddr_t   client_ip;
+       fr_ipaddr_t     client_ip;
        int             load_factor; /* 1..100 */
 
        int             has_rtt;
@@ -546,12 +546,12 @@ int detail_recv(rad_listen_t *listener,
         *      packets before having a collision, which means it's
         *      effectively impossible.
         */
-       packet->id = lrad_rand() & 0xffff;
-       packet->src_port = 1024 + (lrad_rand() & 0x7fff);
-       packet->dst_port = 1024 + (lrad_rand() & 0x7fff);
+       packet->id = fr_rand() & 0xffff;
+       packet->src_port = 1024 + (fr_rand() & 0x7fff);
+       packet->dst_port = 1024 + (fr_rand() & 0x7fff);
 
        packet->dst_ipaddr.af = AF_INET;
-       packet->dst_ipaddr.ipaddr.ip4addr.s_addr = htonl((INADDR_LOOPBACK & ~0xffffff) | (lrad_rand() & 0xffffff));
+       packet->dst_ipaddr.ipaddr.ip4addr.s_addr = htonl((INADDR_LOOPBACK & ~0xffffff) | (fr_rand() & 0xffffff));
 
        /*
         *      If everything's OK, this is a waste of memory.
index 8451b7a..ebd25d6 100644 (file)
@@ -71,7 +71,7 @@ static const char *filler = "???????????????????????????????????????????????????
 
 static const char *expand_string(char *buffer, size_t sizeof_buffer,
                                 REQUEST *request,
-                                LRAD_TOKEN value_type, const char *value)
+                                FR_TOKEN value_type, const char *value)
 {
        int result;
        char *p;
@@ -112,7 +112,7 @@ static const char *expand_string(char *buffer, size_t sizeof_buffer,
 }
 
 #ifdef HAVE_REGEX_H
-static LRAD_TOKEN getregex(char **ptr, char *buffer, size_t buflen, int *pcflags)
+static FR_TOKEN getregex(char **ptr, char *buffer, size_t buflen, int *pcflags)
 {
        char *p = *ptr;
        char *q = buffer;
@@ -191,7 +191,7 @@ static LRAD_TOKEN getregex(char **ptr, char *buffer, size_t buflen, int *pcflags
 }
 #endif
 
-static const LRAD_NAME_NUMBER modreturn_table[] = {
+static const FR_NAME_NUMBER modreturn_table[] = {
        { "reject",     RLM_MODULE_REJECT       },
        { "fail",       RLM_MODULE_FAIL         },
        { "ok",         RLM_MODULE_OK           },
@@ -213,7 +213,7 @@ int radius_evaluate_condition(REQUEST *request, int modreturn, int depth,
        int evaluate_next_condition = evaluate_it;
        const char *p = *ptr;
        const char *q, *start;
-       LRAD_TOKEN token, lt, rt;
+       FR_TOKEN token, lt, rt;
        char left[1024], right[1024], comp[4];
        const char *pleft, *pright;
        char  xleft[1024], xright[1024];
@@ -396,7 +396,7 @@ int radius_evaluate_condition(REQUEST *request, int modreturn, int depth,
                                result = (lint != 0);
 
                        } else if (lt == T_BARE_WORD) {
-                               result = (modreturn == lrad_str2int(modreturn_table, pleft, -1));
+                               result = (modreturn == fr_str2int(modreturn_table, pleft, -1));
                        } else {
                                result = (*pleft != '\0');
                        }
@@ -951,8 +951,8 @@ struct conf_pair {
        CONF_ITEM item;
        char *attr;
        char *value;
-       LRAD_TOKEN operator;
-       LRAD_TOKEN value_type;
+       FR_TOKEN operator;
+       FR_TOKEN value_type;
 };
 
 /*
index aed7f47..ebdfe2f 100644 (file)
@@ -47,8 +47,8 @@ extern int check_config;
 /*
  *     Ridiculous amounts of local state.
  */
-static lrad_event_list_t       *el = NULL;
-static lrad_packet_list_t      *pl = NULL;
+static fr_event_list_t *el = NULL;
+static fr_packet_list_t        *pl = NULL;
 static int                     request_num_counter = 0;
 static struct timeval          now;
 static time_t                  start_time;
@@ -74,9 +74,9 @@ static pthread_mutex_t        proxy_mutex;
 #define PTHREAD_MUTEX_UNLOCK(_x)
 #endif
 
-#define INSERT_EVENT(_function, _ctx) if (!lrad_event_insert(el, _function, _ctx, &((_ctx)->when), &((_ctx)->ev))) { _rad_panic(__FILE__, __LINE__, "Failed to insert event"); }
+#define INSERT_EVENT(_function, _ctx) if (!fr_event_insert(el, _function, _ctx, &((_ctx)->when), &((_ctx)->ev))) { _rad_panic(__FILE__, __LINE__, "Failed to insert event"); }
 
-static lrad_packet_list_t *proxy_list = NULL;
+static fr_packet_list_t *proxy_list = NULL;
 
 /*
  *     We keep the proxy FD's here.  The RADIUS Id's are marked
@@ -191,7 +191,7 @@ static void remove_from_request_hash(REQUEST *request)
 {
        if (!request->in_request_hash) return;
 
-       lrad_packet_list_yank(pl, request->packet);
+       fr_packet_list_yank(pl, request->packet);
        request->in_request_hash = FALSE;
 
        snmp_inc_counters(request);
@@ -204,14 +204,14 @@ static REQUEST *lookup_in_proxy_hash(RADIUS_PACKET *reply)
        REQUEST *request;
 
        PTHREAD_MUTEX_LOCK(&proxy_mutex);
-       proxy_p = lrad_packet_list_find_byreply(proxy_list, reply);
+       proxy_p = fr_packet_list_find_byreply(proxy_list, reply);
 
        if (!proxy_p) {
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                return NULL;
        }
 
-       request = lrad_packet2myptr(REQUEST, proxy, proxy_p);
+       request = fr_packet2myptr(REQUEST, proxy, proxy_p);
 
        if (!request) {
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
@@ -225,8 +225,8 @@ static REQUEST *lookup_in_proxy_hash(RADIUS_PACKET *reply)
         *      correctly.
         */
        if (request->num_proxied_requests == request->num_proxied_responses) {
-               lrad_packet_list_yank(proxy_list, request->proxy);
-               lrad_packet_list_id_free(proxy_list, request->proxy);
+               fr_packet_list_yank(proxy_list, request->proxy);
+               fr_packet_list_id_free(proxy_list, request->proxy);
                request->in_proxy_hash = FALSE;
        }
 
@@ -252,8 +252,8 @@ static void remove_from_proxy_hash(REQUEST *request)
        if (!request->in_proxy_hash) return;
 
        PTHREAD_MUTEX_LOCK(&proxy_mutex);
-       lrad_packet_list_yank(proxy_list, request->proxy);
-       lrad_packet_list_id_free(proxy_list, request->proxy);
+       fr_packet_list_yank(proxy_list, request->proxy);
+       fr_packet_list_id_free(proxy_list, request->proxy);
 
        /*
         *      The home server hasn't replied, but we've given up on
@@ -293,7 +293,7 @@ static int insert_into_proxy_hash(REQUEST *request)
                request->home_server->total_requests_sent--;
        }
 
-       if (!lrad_packet_list_id_alloc(proxy_list, request->proxy)) {
+       if (!fr_packet_list_id_alloc(proxy_list, request->proxy)) {
                int found;
                rad_listen_t *proxy_listener;
 
@@ -339,14 +339,14 @@ static int insert_into_proxy_hash(REQUEST *request)
                }
                rad_assert(found >= 0);
 
-               if (!lrad_packet_list_socket_add(proxy_list, proxy_listener->fd)) {
+               if (!fr_packet_list_socket_add(proxy_list, proxy_listener->fd)) {
                        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                        DEBUG2("ERROR: Failed to create a new socket for proxying requests.");
                        return 0; /* leak proxy_listener */
 
                }
 
-               if (!lrad_packet_list_id_alloc(proxy_list, request->proxy)) {
+               if (!fr_packet_list_id_alloc(proxy_list, request->proxy)) {
                        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                        DEBUG2("ERROR: Failed to create a new socket for proxying requests.");
                        return 0;
@@ -376,8 +376,8 @@ static int insert_into_proxy_hash(REQUEST *request)
        rad_assert(proxy_listeners[proxy] != NULL);
        request->proxy_listener = proxy_listeners[proxy];
 
-       if (!lrad_packet_list_insert(proxy_list, &request->proxy)) {
-               lrad_packet_list_id_free(proxy_list, request->proxy);
+       if (!fr_packet_list_insert(proxy_list, &request->proxy)) {
+               fr_packet_list_id_free(proxy_list, request->proxy);
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                DEBUG2("ERROR: Failed to insert entry into proxy list");
                return 0;
@@ -422,7 +422,7 @@ static void wait_for_proxy_id_to_expire(void *ctx)
                               request->number,
                               (unsigned int) (request->timestamp - start_time));
                }
-               lrad_event_delete(el, &request->ev);
+               fr_event_delete(el, &request->ev);
                remove_from_proxy_hash(request);
                remove_from_request_hash(request);
                request_free(&request);
@@ -481,7 +481,7 @@ static void cleanup_delay(void *ctx)
               request->number, request->packet->id,
               (unsigned int) (request->timestamp - start_time));
 
-       lrad_event_delete(el, &request->ev);
+       fr_event_delete(el, &request->ev);
        request_free(&request);
 }
 
@@ -554,11 +554,11 @@ static void received_response_to_ping(REQUEST *request)
                         buffer, sizeof(buffer)),
               request->proxy->dst_port);
 
-       if (!lrad_event_delete(el, &home->ev)) {
+       if (!fr_event_delete(el, &home->ev)) {
                DEBUG2("Hmm... no event for home server, WTF?");
        }
 
-       if (!lrad_event_delete(el, &request->ev)) {
+       if (!fr_event_delete(el, &request->ev)) {
                DEBUG2("Hmm... no event for request, WTF?");
        }
 
@@ -587,7 +587,7 @@ static void ping_home_server(void *ctx)
        request->proxy = rad_alloc(1);
        rad_assert(request->proxy != NULL);
 
-       lrad_event_now(el, &request->when);
+       fr_event_now(el, &request->when);
        home->when = request->when;
 
        if (home->ping_check == HOME_PING_CHECK_STATUS_SERVER) {
@@ -654,7 +654,7 @@ static void ping_home_server(void *ctx)
         */
        home->when.tv_sec += home->ping_interval - 2;
 
-       jitter = lrad_rand();
+       jitter = fr_rand();
        jitter ^= (jitter >> 10);
        jitter &= ((1 << 23) - 1); /* 22 bits of 1 */
 
@@ -842,7 +842,7 @@ static void wait_a_bit(void *ctx)
 {
        struct timeval when;
        REQUEST *request = ctx;
-       lrad_event_callback_t callback = NULL;
+       fr_event_callback_t callback = NULL;
 
        rad_assert(request->magic == REQUEST_MAGIC);
 
@@ -859,7 +859,7 @@ static void wait_a_bit(void *ctx)
                 *      this call won't re-set it, because we're not
                 *      in the event loop.
                 */
-               lrad_event_now(el, &now);
+               fr_event_now(el, &now);
 
                if (timercmp(&now, &when, <)) {
                        if (request->delay < (USEC / 10)) {
@@ -1706,7 +1706,7 @@ static int can_handle_new_request(RADIUS_PACKET *packet,
         *      error.
         */
        if (root->max_requests) {
-               int request_count = lrad_packet_list_num_elements(pl);
+               int request_count = fr_packet_list_num_elements(pl);
 
                /*
                 *      This is a new request.  Let's see if
@@ -1753,9 +1753,9 @@ int received_request(rad_listen_t *listener,
        REQUEST *request = NULL;
        struct main_config_t *root = &mainconfig;
 
-       packet_p = lrad_packet_list_find(pl, packet);
+       packet_p = fr_packet_list_find(pl, packet);
        if (packet_p) {
-               request = lrad_packet2myptr(REQUEST, packet, packet_p);
+               request = fr_packet2myptr(REQUEST, packet, packet_p);
                rad_assert(request->in_request_hash);
 
                if ((request->packet->data_len == packet->data_len) &&
@@ -1847,7 +1847,7 @@ int received_request(rad_listen_t *listener,
        /*
         *      Remember the request in the list.
         */
-       if (!lrad_packet_list_insert(pl, &request->packet)) {
+       if (!fr_packet_list_insert(pl, &request->packet)) {
                radlog(L_ERR, "Failed to insert request %d in the list of live requests: discarding", request->number);
                request_free(&request);
                return 0;
@@ -2066,9 +2066,9 @@ static void handle_signal_self(int flag)
 
        if ((flag & (RADIUS_SIGNAL_SELF_EXIT | RADIUS_SIGNAL_SELF_TERM)) != 0) {
                if ((flag & RADIUS_SIGNAL_SELF_EXIT) != 0) {
-                       lrad_event_loop_exit(el, 1);
+                       fr_event_loop_exit(el, 1);
                } else {
-                       lrad_event_loop_exit(el, 2);
+                       fr_event_loop_exit(el, 2);
                }
 
                return;
@@ -2090,7 +2090,7 @@ static void handle_signal_self(int flag)
                }
                last_hup = when;
 
-               lrad_event_loop_exit(el, 0x80);
+               fr_event_loop_exit(el, 0x80);
        }
 }
 
@@ -2141,7 +2141,7 @@ void radius_signal_self(int flag)
 }
 
 
-static void event_signal_handler(lrad_event_list_t *xel, int fd, void *ctx)
+static void event_signal_handler(fr_event_list_t *xel, int fd, void *ctx)
 {
        size_t i, rcode;
        char buffer[32];
@@ -2175,11 +2175,11 @@ static void event_reset_fd(rad_listen_t *listener, int fd, int usec)
 
        tv_add(&when, usec);    
 
-       if (!lrad_event_fd_delete(el, 0, fd)) {
+       if (!fr_event_fd_delete(el, 0, fd)) {
                rad_panic("Failed deleting fd");
        }
        
-       if (!lrad_event_insert(el, event_poll_fd, listener,
+       if (!fr_event_insert(el, event_poll_fd, listener,
                               &when, NULL)) {
                rad_panic("Failed inserting event");
        }
@@ -2193,7 +2193,7 @@ static void event_reset_fd(rad_listen_t *listener, int fd, int usec)
  *     FIXME: On Linux, use inotify to watch the detail file.  This
  *     
  */
-static void event_detail_handler(lrad_event_list_t *xel, int fd, void *ctx)
+static void event_detail_handler(fr_event_list_t *xel, int fd, void *ctx)
 {
        rad_listen_t *listener = ctx;
        RAD_REQUEST_FUNP fun;
@@ -2256,7 +2256,7 @@ static void event_detail_handler(lrad_event_list_t *xel, int fd, void *ctx)
 }
 
 
-static void event_socket_handler(lrad_event_list_t *xel, int fd, void *ctx)
+static void event_socket_handler(fr_event_list_t *xel, int fd, void *ctx)
 {
        rad_listen_t *listener = ctx;
        RAD_REQUEST_FUNP fun;
@@ -2314,7 +2314,7 @@ static void event_poll_fd(void *ctx)
        RAD_REQUEST_FUNP fun;
        REQUEST *request;
        rad_listen_t *listener = ctx;
-       lrad_event_fd_handler_t handler;
+       fr_event_fd_handler_t handler;
 
        /*
         *      Ignore the detail file if we're busy with other work.
@@ -2353,7 +2353,7 @@ static void event_poll_fd(void *ctx)
                gettimeofday(&when, NULL);
                when.tv_sec += 1;
                
-               if (!lrad_event_insert(el, event_poll_fd, listener,
+               if (!fr_event_insert(el, event_poll_fd, listener,
                                       &when, NULL)) {
                        rad_panic("Failed inserting event");
                }
@@ -2370,7 +2370,7 @@ static void event_poll_fd(void *ctx)
        /*
         *      We have an FD.  Start watching it.
         */
-       if (!lrad_event_fd_insert(el, 0, listener->fd,
+       if (!fr_event_fd_insert(el, 0, listener->fd,
                                  handler, listener)) {
                char buffer[256];
                
@@ -2412,10 +2412,10 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
 
        time(&start_time);
 
-       el = lrad_event_list_create(event_status);
+       el = fr_event_list_create(event_status);
        if (!el) return 0;
 
-       pl = lrad_packet_list_create(0);
+       pl = fr_packet_list_create(0);
        if (!el) return 0;
 
        request_num_counter = 0;
@@ -2432,7 +2432,7 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
                 *      Create the tree for managing proxied requests and
                 *      responses.
                 */
-               proxy_list = lrad_packet_list_create(1);
+               proxy_list = fr_packet_list_create(1);
                if (!proxy_list) return 0;
 
 #ifdef HAVE_PTHREAD_H
@@ -2476,7 +2476,7 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
                exit(1);
        }
 
-       if (!lrad_event_fd_insert(el, 0, self_pipe[0],
+       if (!fr_event_fd_insert(el, 0, self_pipe[0],
                                  event_signal_handler, el)) {
                radlog(L_ERR, "Failed creating handler for signals");
                exit(1);
@@ -2521,7 +2521,7 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
                        
                        proxy_fds[this->fd & 0x1f] = this->fd;
                        proxy_listeners[this->fd & 0x1f] = this;
-                       if (!lrad_packet_list_socket_add(proxy_list,
+                       if (!fr_packet_list_socket_add(proxy_list,
                                                         this->fd)) {
                                rad_assert(0 == 1);
                        }
@@ -2547,7 +2547,7 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
                        gettimeofday(&when, NULL);
                        when.tv_sec += 1;
 
-                       if (!lrad_event_insert(el, event_poll_fd, this,
+                       if (!fr_event_insert(el, event_poll_fd, this,
                                               &when, NULL)) {
                                radlog(L_ERR, "Failed creating handler");
                                exit(1);
@@ -2562,7 +2562,7 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
                 *      FIXME: if we DO open the detail files automatically,
                 *      then much of this code becomes simpler.
                 */
-               if (!lrad_event_fd_insert(el, 0, this->fd,
+               if (!fr_event_fd_insert(el, 0, this->fd,
                                          event_socket_handler, this)) {
                        this->print(this, buffer, sizeof(buffer));
                        radlog(L_ERR, "Failed creating handler for socket %s",
@@ -2578,11 +2578,11 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag)
 static int request_hash_cb(void *ctx, void *data)
 {
        ctx = ctx;              /* -Wunused */
-       REQUEST *request = lrad_packet2myptr(REQUEST, packet, data);
+       REQUEST *request = fr_packet2myptr(REQUEST, packet, data);
 
        rad_assert(request->in_proxy_hash == FALSE);
 
-       lrad_event_delete(el, &request->ev);
+       fr_event_delete(el, &request->ev);
        remove_from_request_hash(request);
        request_free(&request);
 
@@ -2593,13 +2593,13 @@ static int request_hash_cb(void *ctx, void *data)
 static int proxy_hash_cb(void *ctx, void *data)
 {
        ctx = ctx;              /* -Wunused */
-       REQUEST *request = lrad_packet2myptr(REQUEST, proxy, data);
+       REQUEST *request = fr_packet2myptr(REQUEST, proxy, data);
 
-       lrad_packet_list_yank(proxy_list, request->proxy);
+       fr_packet_list_yank(proxy_list, request->proxy);
        request->in_proxy_hash = FALSE;
 
        if (!request->in_request_hash) {
-               lrad_event_delete(el, &request->ev);
+               fr_event_delete(el, &request->ev);
                request_free(&request);
        }
 
@@ -2621,18 +2621,18 @@ void radius_event_free(void)
         */
        if (proxy_list) {
                PTHREAD_MUTEX_LOCK(&proxy_mutex);
-               lrad_packet_list_walk(proxy_list, NULL, proxy_hash_cb);
+               fr_packet_list_walk(proxy_list, NULL, proxy_hash_cb);
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
-               lrad_packet_list_free(proxy_list);
+               fr_packet_list_free(proxy_list);
                proxy_list = NULL;
        }
 
-       lrad_packet_list_walk(pl, NULL, request_hash_cb);
+       fr_packet_list_walk(pl, NULL, request_hash_cb);
 
-       lrad_packet_list_free(pl);
+       fr_packet_list_free(pl);
        pl = NULL;
 
-       lrad_event_list_free(el);
+       fr_event_list_free(el);
 }
 
 int radius_event_process(void)
@@ -2641,7 +2641,7 @@ int radius_event_process(void)
 
        just_started = TRUE;
 
-       return lrad_event_loop(el);
+       return fr_event_loop(el);
 }
 
 void radius_handle_request(REQUEST *request, RAD_REQUEST_FUNP fun)
index d8caf88..9aac7d8 100644 (file)
@@ -71,7 +71,7 @@ int pairlist_read(const char *file, PAIR_LIST **list, int complain)
        PAIR_LIST **last = &pl;
        int lineno = 0;
        int old_lineno = 0;
-       LRAD_TOKEN parsecode;
+       FR_TOKEN parsecode;
        char newfile[8192];
 
        /*
index c5f8c3b..a118545 100644 (file)
@@ -61,7 +61,7 @@ typedef struct listen_socket_t {
        /*
         *      For normal sockets.
         */
-       lrad_ipaddr_t   ipaddr;
+       fr_ipaddr_t     ipaddr;
        int             port;
        RADCLIENT_LIST  *clients;
 } listen_socket_t;
@@ -70,7 +70,7 @@ typedef struct listen_socket_t {
  *     Find a per-socket client.
  */
 RADCLIENT *client_listener_find(const rad_listen_t *listener,
-                                      const lrad_ipaddr_t *ipaddr)
+                                      const fr_ipaddr_t *ipaddr)
 {
        const RADCLIENT_LIST *clients;
 
@@ -213,7 +213,7 @@ static int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
 {
        int             rcode;
        int             listen_port;
-       lrad_ipaddr_t   ipaddr;
+       fr_ipaddr_t     ipaddr;
        listen_socket_t *sock = this->data;
        const char      *section_name = NULL;
        CONF_SECTION    *client_cs, *parentcs;
@@ -418,7 +418,7 @@ static int auth_socket_recv(rad_listen_t *listener,
        RAD_REQUEST_FUNP fun = NULL;
        char            buffer[128];
        RADCLIENT       *client;
-       lrad_ipaddr_t   src_ipaddr;
+       fr_ipaddr_t     src_ipaddr;
 
        rcode = rad_recv_header(listener->fd, &src_ipaddr, &src_port, &code);
        if (rcode < 0) return 0;
@@ -519,7 +519,7 @@ static int acct_socket_recv(rad_listen_t *listener,
        RAD_REQUEST_FUNP fun = NULL;
        char            buffer[128];
        RADCLIENT       *client;
-       lrad_ipaddr_t   src_ipaddr;
+       fr_ipaddr_t     src_ipaddr;
 
        rcode = rad_recv_header(listener->fd, &src_ipaddr, &src_port, &code);
        if (rcode < 0) return 0;
@@ -852,14 +852,14 @@ static int listen_bind(rad_listen_t *this)
 
                if ((sock->port == other->port) &&
                    (sock->ipaddr.af == other->ipaddr.af) &&
-                   (lrad_ipaddr_cmp(&sock->ipaddr, &other->ipaddr) == 0)) {
+                   (fr_ipaddr_cmp(&sock->ipaddr, &other->ipaddr) == 0)) {
                        this->fd = (*last)->fd;
                        (*last)->fd = -1;
                        return 0;
                }
        }
 
-       this->fd = lrad_socket(&sock->ipaddr, sock->port);
+       this->fd = fr_socket(&sock->ipaddr, sock->port);
        if (this->fd < 0) {
                radlog(L_ERR, "ERROR: Failed to open socket: %s",
                       librad_errstr);
@@ -1018,7 +1018,7 @@ rad_listen_t *proxy_new_listener()
 }
 
 
-static const LRAD_NAME_NUMBER listen_compare[] = {
+static const FR_NAME_NUMBER listen_compare[] = {
        { "auth",       RAD_LISTEN_AUTH },
        { "acct",       RAD_LISTEN_ACCT },
        { "detail",     RAD_LISTEN_DETAIL },
@@ -1049,7 +1049,7 @@ static rad_listen_t *listen_parse(CONF_SECTION *cs, const char *server)
                return NULL;
        }
 
-       type = lrad_str2int(listen_compare, listen_type,
+       type = fr_str2int(listen_compare, listen_type,
                            RAD_LISTEN_NONE);
        if (type == RAD_LISTEN_NONE) {
                cf_log_err(cf_sectiontoitem(cs),
@@ -1104,7 +1104,7 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head)
        CONF_SECTION    *cs;
        rad_listen_t    **last;
        rad_listen_t    *this;
-       lrad_ipaddr_t   server_ipaddr;
+       fr_ipaddr_t     server_ipaddr;
        int             auth_port = 0;
 
        /*
@@ -1325,7 +1325,7 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head)
                        }
                }
 
-               if (port < 0) port = 1024 + (lrad_rand() & 0x1ff);
+               if (port < 0) port = 1024 + (fr_rand() & 0x1ff);
 
                /*
                 *      Address is still unspecified, use IPv4.
index 43c0d83..a3ac002 100644 (file)
@@ -37,7 +37,7 @@ static int openlog_run = 0;
  /*
  * Logging facility names
  */
-static const LRAD_NAME_NUMBER levels[] = {
+static const FR_NAME_NUMBER levels[] = {
        { ": Debug: ",          L_DBG   },
        { ": Auth: ",           L_AUTH  },
        { ": Proxy: ",          L_PROXY },
@@ -143,7 +143,7 @@ int vradlog(int lvl, const char *fmt, va_list ap)
                timeval = time(NULL);
                CTIME_R(&timeval, buffer + len, sizeof(buffer) - len - 1);
 
-               s = lrad_int2str(levels, (lvl & ~L_CONS), ": ");
+               s = fr_int2str(levels, (lvl & ~L_CONS), ": ");
 
                strcat(buffer, s);
                len = strlen(buffer);
index 0c68006..65af3af 100644 (file)
@@ -68,7 +68,7 @@ static int allow_core_dumps = 0;
 static const char *localstatedir = NULL;
 static const char *prefix = NULL;
 static char *syslog_facility = NULL;
-static const LRAD_NAME_NUMBER str2fac[] = {
+static const FR_NAME_NUMBER str2fac[] = {
 #ifdef LOG_KERN
        { "kern", LOG_KERN },
 #endif
@@ -496,7 +496,7 @@ static int switch_users(void)
 }
 
 
-static const LRAD_NAME_NUMBER str2dest[] = {
+static const FR_NAME_NUMBER str2dest[] = {
        { "null", RADLOG_NULL },
        { "files", RADLOG_FILES },
        { "syslog", RADLOG_SYSLOG },
@@ -616,7 +616,7 @@ int read_mainconfig(int reload)
                                      "files");
                if (rcode < 0) return -1;
 
-               mainconfig.radlog_dest = lrad_str2int(str2dest, radlog_dest, RADLOG_NUM_DEST);
+               mainconfig.radlog_dest = fr_str2int(str2dest, radlog_dest, RADLOG_NUM_DEST);
                if (mainconfig.radlog_dest == RADLOG_NUM_DEST) {
                        fprintf(stderr, "radiusd: Error: Unknown log_destination %s\n",
                                radlog_dest);
@@ -641,7 +641,7 @@ int read_mainconfig(int reload)
                                cf_section_free(&cs);
                                return -1;
                        }
-                       mainconfig.syslog_facility = lrad_str2int(str2fac, syslog_facility, -1);
+                       mainconfig.syslog_facility = fr_str2int(str2fac, syslog_facility, -1);
                        if (mainconfig.syslog_facility < 0) {
                                fprintf(stderr, "radiusd: Error: Unknown syslog_facility %s\n",
                                        syslog_facility);
index 636493d..3301688 100644 (file)
@@ -71,7 +71,7 @@ typedef struct {
        module_instance_t *modinst;
 } modsingle;
 
-static const LRAD_NAME_NUMBER grouptype_table[] = {
+static const FR_NAME_NUMBER grouptype_table[] = {
        { "", GROUPTYPE_SIMPLE },
        { "redundant ", GROUPTYPE_REDUNDANT },
        { "append ", GROUPTYPE_APPEND },
@@ -121,7 +121,7 @@ static void add_child(modgroup *g, modcallable *c)
 
 /* Here's where we recognize all of our keywords: first the rcodes, then the
  * actions */
-static const LRAD_NAME_NUMBER rcode_table[] = {
+static const FR_NAME_NUMBER rcode_table[] = {
        { "reject",     RLM_MODULE_REJECT       },
        { "fail",       RLM_MODULE_FAIL         },
        { "ok",         RLM_MODULE_OK           },
@@ -169,7 +169,7 @@ static int compile_action(modcallable *c, CONF_PAIR *cp)
        if (strcasecmp(attr, "default") != 0) {
                int rcode;
 
-               rcode = lrad_str2int(rcode_table, attr, -1);
+               rcode = fr_str2int(rcode_table, attr, -1);
                if (rcode < 0) {
                        cf_log_err(cf_pairtoitem(cp),
                                   "Unknown module rcode '%s'.\n",
@@ -463,7 +463,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
 
                                        count++;
 
-                                       if ((count * (lrad_rand() & 0xffff)) < (uint32_t) 0x10000) {
+                                       if ((count * (fr_rand() & 0xffff)) < (uint32_t) 0x10000) {
                                                q = p;
                                        }
                                }
@@ -516,7 +516,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                                       stack.pointer + 1, modcall_spaces,
                                       group_name[child->type],
                                       child->name ? child->name : "",
-                                      lrad_int2str(rcode_table,
+                                      fr_int2str(rcode_table,
                                                    stack.result[stack.pointer],
                                                    "??"));
                                goto do_return;
@@ -542,7 +542,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                DEBUG2("%.*s[%s] returns %s",
                       stack.pointer + 1, modcall_spaces,
                       child->name ? child->name : "",
-                      lrad_int2str(rcode_table, myresult, "??"));
+                      fr_int2str(rcode_table, myresult, "??"));
 
 
                /*
@@ -663,7 +663,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                               stack.pointer + 1, modcall_spaces,
                               group_name[parent->type],
                               parent->name ? parent->name : "",
-                              lrad_int2str(rcode_table, myresult, "??"));
+                              fr_int2str(rcode_table, myresult, "??"));
 
                        if ((parent->type == MOD_IF) ||
                            (parent->type == MOD_ELSIF)) {
@@ -720,7 +720,7 @@ static void dump_mc(modcallable *c, int indent)
 
        for(i = 0; i<RLM_MODULE_NUMCODES; ++i) {
                DEBUG("%.*s%s = %s", indent+1, "\t\t\t\t\t\t\t\t\t\t\t",
-                     lrad_int2str(rcode_table, i, "??"),
+                     fr_int2str(rcode_table, i, "??"),
                      action2str(c->actions[i]));
        }
 
index 06a62b2..47db15b 100644 (file)
@@ -499,7 +499,7 @@ static int define_type(const DICT_ATTR *dattr, const char *name)
         *      is that it's unique.
         */
        do {
-               value = lrad_rand() & 0x00ffffff;
+               value = fr_rand() & 0x00ffffff;
        } while (dict_valbyattr(dattr->attr, value));
 
        if (dict_addvalue(name, dattr->name, value) < 0) {
index f8fde62..bd3cd36 100644 (file)
@@ -47,19 +47,19 @@ static int totallost = 0;
 
 static int server_port = 0;
 static int packet_code = 0;
-static lrad_ipaddr_t server_ipaddr;
+static fr_ipaddr_t server_ipaddr;
 static int resend_count = 1;
 static int done = 1;
 static int print_filename = 0;
 
-static lrad_ipaddr_t client_ipaddr;
+static fr_ipaddr_t client_ipaddr;
 static int client_port = 0;
 
 static int sockfd;
 static int last_used_id = -1;
 
 static rbtree_t *filename_tree = NULL;
-static lrad_packet_list_t *pl = NULL;
+static fr_packet_list_t *pl = NULL;
 
 static int sleep_time = -1;
 
@@ -392,7 +392,7 @@ static void deallocate_id(radclient_t *radclient)
        /*
         *      One more unused RADIUS ID.
         */
-       lrad_packet_list_id_free(pl, radclient->request);
+       fr_packet_list_id_free(pl, radclient->request);
        radclient->request->id = -1;
 
        /*
@@ -500,16 +500,16 @@ static int send_one_packet(radclient_t *radclient)
                 *      this packet.
                 */
        retry:
-               rcode = lrad_packet_list_id_alloc(pl, radclient->request);
+               rcode = fr_packet_list_id_alloc(pl, radclient->request);
                if (rcode < 0) {
                        int mysockfd;
 
-                       mysockfd = lrad_socket(&client_ipaddr, 0);
+                       mysockfd = fr_socket(&client_ipaddr, 0);
                        if (!mysockfd) {
                                fprintf(stderr, "radclient: Can't open new socket\n");
                                exit(1);
                        }
-                       if (!lrad_packet_list_socket_add(pl, mysockfd)) {
+                       if (!fr_packet_list_socket_add(pl, mysockfd)) {
                                fprintf(stderr, "radclient: Can't add new socket\n");
                                exit(1);
                        }
@@ -526,7 +526,7 @@ static int send_one_packet(radclient_t *radclient)
                assert(radclient->request->data == NULL);
 
                for (i = 0; i < 4; i++) {
-                       *((uint32_t *) radclient->request->vector) = lrad_rand();
+                       *((uint32_t *) radclient->request->vector) = fr_rand();
                }
 
                /*
@@ -565,7 +565,7 @@ static int send_one_packet(radclient_t *radclient)
                /*
                 *      Duplicate found.  Serious error!
                 */
-               if (!lrad_packet_list_insert(pl, &radclient->request)) {
+               if (!fr_packet_list_insert(pl, &radclient->request)) {
                        assert(0 == 1);
                }
 
@@ -605,7 +605,7 @@ static int send_one_packet(radclient_t *radclient)
                         *      Delete the request from the tree of
                         *      outstanding requests.
                         */
-                       lrad_packet_list_yank(pl, radclient->request);
+                       fr_packet_list_yank(pl, radclient->request);
 
                        fprintf(stderr, "radclient: no response from server for ID %d socket %d\n", radclient->request->id, radclient->request->sockfd);
                        deallocate_id(radclient);
@@ -656,7 +656,7 @@ static int recv_one_packet(int wait_time)
        /* And wait for reply, timing out as necessary */
        FD_ZERO(&set);
 
-       max_fd = lrad_packet_list_fd_set(pl, &set);
+       max_fd = fr_packet_list_fd_set(pl, &set);
        if (max_fd < 0) exit(1); /* no sockets to listen on! */
 
        if (wait_time <= 0) {
@@ -676,7 +676,7 @@ static int recv_one_packet(int wait_time)
        /*
         *      Look for the packet.
         */
-       reply = lrad_packet_list_recv(pl, &set);
+       reply = fr_packet_list_recv(pl, &set);
        if (!reply) {
                fprintf(stderr, "radclient: received bad packet: %s\n",
                        librad_errstr);
@@ -692,13 +692,13 @@ static int recv_one_packet(int wait_time)
 
        if (librad_debug > 2) print_hex(reply);
 
-       request_p = lrad_packet_list_find_byreply(pl, reply);
+       request_p = fr_packet_list_find_byreply(pl, reply);
        if (!request_p) {
                fprintf(stderr, "radclient: received response to request we did not send. (id=%d socket %d)\n", reply->id, reply->sockfd);
                rad_free(&reply);
                return -1;      /* got reply to packet we didn't send */
        }
-       radclient = lrad_packet2myptr(radclient_t, request, request_p);
+       radclient = fr_packet2myptr(radclient_t, request, request_p);
 
        /*
         *      Fails the signature validation: not a real reply.
@@ -710,7 +710,7 @@ static int recv_one_packet(int wait_time)
                goto packet_done; /* shared secret is incorrect */
        }
 
-       lrad_packet_list_yank(pl, radclient->request);
+       fr_packet_list_yank(pl, radclient->request);
        if (print_filename) printf("%s:%d %d\n",
                                   radclient->filename,
                                   radclient->packet_number,
@@ -1023,19 +1023,19 @@ int main(int argc, char **argv)
                client_ipaddr = radclient_head->request->src_ipaddr;
                client_port = radclient_head->request->src_port;
        }
-       sockfd = lrad_socket(&client_ipaddr, client_port);
+       sockfd = fr_socket(&client_ipaddr, client_port);
        if (sockfd < 0) {
                fprintf(stderr, "radclient: socket: %s\n", librad_errstr);
                exit(1);
        }
 
-       pl = lrad_packet_list_create(1);
+       pl = fr_packet_list_create(1);
        if (!pl) {
                fprintf(stderr, "radclient: Out of memory\n");
                exit(1);
        }
 
-       if (!lrad_packet_list_socket_add(pl, sockfd)) {
+       if (!fr_packet_list_socket_add(pl, sockfd)) {
                fprintf(stderr, "radclient: Out of memory\n");
                exit(1);
        }
@@ -1163,7 +1163,7 @@ int main(int argc, char **argv)
                /*
                 *      Still have outstanding requests.
                 */
-               if (lrad_packet_list_num_elements(pl) > 0) {
+               if (fr_packet_list_num_elements(pl) > 0) {
                        done = 0;
                } else {
                        sleep_time = 0;
@@ -1182,7 +1182,7 @@ int main(int argc, char **argv)
        } while (!done);
 
        rbtree_free(filename_tree);
-       lrad_packet_list_free(pl);
+       fr_packet_list_free(pl);
        dict_free();
 
        if (do_summary) {
index 1254931..c56b894 100644 (file)
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
        char *radius_filter = NULL;
        int packet_count = -1;          /* how many packets to sniff */
        int opt;
-       LRAD_TOKEN parsecode;
+       FR_TOKEN parsecode;
        const char *radius_dir = RADIUS_DIR;
        int port = 1812;
 
index 7a362f5..fab0126 100644 (file)
@@ -105,7 +105,7 @@ static int home_server_addr_cmp(const void *one, const void *two)
        if (a->port < b->port) return -1;
        if (a->port > b->port) return +1;
 
-       return lrad_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
+       return fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
 }
 
 
@@ -620,7 +620,7 @@ static int server_pool_add(realm_config_t *rc,
 
        cp = cf_pair_find(cs, "type");
        if (cp) {
-               static LRAD_NAME_NUMBER pool_types[] = {
+               static FR_NAME_NUMBER pool_types[] = {
                        { "load-balance", HOME_POOL_LOAD_BALANCE },
                        { "fail-over", HOME_POOL_FAIL_OVER },
                        { "round_robin", HOME_POOL_LOAD_BALANCE },
@@ -638,7 +638,7 @@ static int server_pool_add(realm_config_t *rc,
                        goto error;
                }
 
-               pool->type = lrad_str2int(pool_types, value, 0);
+               pool->type = fr_str2int(pool_types, value, 0);
                if (!pool->type) {
                        cf_log_err(cf_pairtoitem(cp),
                                   "Unknown type \"%s\".",
@@ -1361,11 +1361,11 @@ home_server *home_server_ldb(const char *realmname,
        case HOME_POOL_CLIENT_BALANCE:
                switch (request->packet->src_ipaddr.af) {
                case AF_INET:
-                       hash = lrad_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
+                       hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip4addr));
                        break;
                case AF_INET6:
-                       hash = lrad_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
+                       hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip6addr));
                        break;
                default:
@@ -1378,25 +1378,25 @@ home_server *home_server_ldb(const char *realmname,
        case HOME_POOL_CLIENT_PORT_BALANCE:
                switch (request->packet->src_ipaddr.af) {
                case AF_INET:
-                       hash = lrad_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
+                       hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip4addr));
                        break;
                case AF_INET6:
-                       hash = lrad_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
+                       hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip6addr));
                        break;
                default:
                        hash = 0;
                        break;
                }
-               lrad_hash_update(&request->packet->src_port,
+               fr_hash_update(&request->packet->src_port,
                                 sizeof(request->packet->src_port), hash);
                start = hash % pool->num_home_servers;
                break;
 
        case HOME_POOL_KEYED_BALANCE:
                if ((vp = pairfind(request->config_items, PW_LOAD_BALANCE_KEY)) != NULL) {
-                       hash = lrad_hash(vp->vp_strvalue, vp->length);
+                       hash = fr_hash(vp->vp_strvalue, vp->length);
                        start = hash % pool->num_home_servers;
                        break;
                }
@@ -1477,7 +1477,7 @@ home_server *home_server_ldb(const char *realmname,
                 *      From the list of servers which have the same
                 *      load, choose one at random.
                 */
-               if (((count + 1) * (lrad_rand() & 0xffff)) < (uint32_t) 0x10000) {
+               if (((count + 1) * (fr_rand() & 0xffff)) < (uint32_t) 0x10000) {
                        found = home;
                }
 
@@ -1541,7 +1541,7 @@ home_server *home_server_ldb(const char *realmname,
 }
 
 
-home_server *home_server_find(lrad_ipaddr_t *ipaddr, int port)
+home_server *home_server_find(fr_ipaddr_t *ipaddr, int port)
 {
        home_server myhome;
 
index 2e295ad..d8bdf66 100644 (file)
@@ -127,7 +127,7 @@ int rad_check_ts(uint32_t nasaddr, unsigned int portnum, const char *user,
        char    address[16];
        char    port[11];
        RADCLIENT *cl;
-       lrad_ipaddr_t ipaddr;
+       fr_ipaddr_t ipaddr;
 
        ipaddr.af = AF_INET;
        ipaddr.ipaddr.ip4addr.s_addr = nasaddr;
index d6412fe..5ab3be1 100644 (file)
@@ -134,7 +134,7 @@ typedef struct THREAD_POOL {
        int spawn_flag;
 
        pthread_mutex_t wait_mutex;
-       lrad_hash_table_t *waiters;
+       fr_hash_table_t *waiters;
 
        /*
         *      All threads wait on this semaphore, for requests
@@ -150,7 +150,7 @@ typedef struct THREAD_POOL {
        int             max_queue_size;
        int             num_queued;
        int             can_read_detail;
-       lrad_fifo_t     *fifo[NUM_FIFOS];
+       fr_fifo_t       *fifo[NUM_FIFOS];
 } THREAD_POOL;
 
 static THREAD_POOL thread_pool;
@@ -266,12 +266,12 @@ static void reap_children(void)
                if (pid <= 0) break;
 
                mytf.pid = pid;
-               tf = lrad_hash_table_finddata(thread_pool.waiters, &mytf);
+               tf = fr_hash_table_finddata(thread_pool.waiters, &mytf);
                if (!tf) continue;
 
                tf->status = status;
                tf->exited = 1;
-       } while (lrad_hash_table_num_elements(thread_pool.waiters) > 0);
+       } while (fr_hash_table_num_elements(thread_pool.waiters) > 0);
 
        pthread_mutex_unlock(&thread_pool.wait_mutex);
 }
@@ -308,7 +308,7 @@ static int request_enqueue(REQUEST *request, RAD_REQUEST_FUNP fun)
        /*
         *      Push the request onto the appropriate fifo for that
         */
-       if (!lrad_fifo_push(thread_pool.fifo[request->priority],
+       if (!fr_fifo_push(thread_pool.fifo[request->priority],
                            entry)) {
                pthread_mutex_unlock(&thread_pool.queue_mutex);
                radlog(L_ERR, "!!! ERROR !!! Failed inserting request %d into the queue", request->number);
@@ -364,7 +364,7 @@ static int request_dequeue(REQUEST **request, RAD_REQUEST_FUNP *fun)
         *      requests will be quickly cleared.
         */
        for (i = 0; i < RAD_LISTEN_MAX; i++) {
-               entry = lrad_fifo_peek(thread_pool.fifo[i]);
+               entry = fr_fifo_peek(thread_pool.fifo[i]);
                if (!entry ||
                    (entry->request->master_state != REQUEST_STOP_PROCESSING)) {
                        continue;
@@ -372,7 +372,7 @@ static int request_dequeue(REQUEST **request, RAD_REQUEST_FUNP *fun)
                /*
                 *      This entry was marked to be stopped.  Acknowledge it.
                 */
-               entry = lrad_fifo_pop(thread_pool.fifo[i]);
+               entry = fr_fifo_pop(thread_pool.fifo[i]);
                rad_assert(entry != NULL);
                entry->request->child_state = REQUEST_DONE;
        }
@@ -383,7 +383,7 @@ static int request_dequeue(REQUEST **request, RAD_REQUEST_FUNP *fun)
         *      Pop results from the top of the queue
         */
        for (i = start; i < RAD_LISTEN_MAX; i++) {
-               entry = lrad_fifo_pop(thread_pool.fifo[i]);
+               entry = fr_fifo_pop(thread_pool.fifo[i]);
                if (entry) {
                        start = i;
                        break;
@@ -693,7 +693,7 @@ static uint32_t pid_hash(const void *data)
 {
        const thread_fork_t *tf = data;
 
-       return lrad_hash(&tf->pid, sizeof(tf->pid));
+       return fr_hash(&tf->pid, sizeof(tf->pid));
 }
 
 static int pid_cmp(const void *one, const void *two)
@@ -748,7 +748,7 @@ int thread_pool_init(CONF_SECTION *cs, int spawn_flag)
                /*
                 *      Create the hash table of child PID's
                 */
-               thread_pool.waiters = lrad_hash_table_create(pid_hash,
+               thread_pool.waiters = fr_hash_table_create(pid_hash,
                                                             pid_cmp,
                                                             free);
                if (!thread_pool.waiters) {
@@ -807,7 +807,7 @@ int thread_pool_init(CONF_SECTION *cs, int spawn_flag)
         *      Allocate multiple fifos.
         */
        for (i = 0; i < RAD_LISTEN_MAX; i++) {
-               thread_pool.fifo[i] = lrad_fifo_create(65536, NULL);
+               thread_pool.fifo[i] = fr_fifo_create(65536, NULL);
                if (!thread_pool.fifo[i]) {
                        radlog(L_ERR, "FATAL: Failed to set up request fifo");
                        return -1;
@@ -1056,7 +1056,7 @@ pid_t rad_fork(void)
 
        reap_children();        /* be nice to non-wait thingies */
 
-       if (lrad_hash_table_num_elements(thread_pool.waiters) >= 1024) {
+       if (fr_hash_table_num_elements(thread_pool.waiters) >= 1024) {
                return -1;
        }
 
@@ -1074,7 +1074,7 @@ pid_t rad_fork(void)
                tf->pid = child_pid;
 
                pthread_mutex_lock(&thread_pool.wait_mutex);
-               rcode = lrad_hash_table_insert(thread_pool.waiters, tf);
+               rcode = fr_hash_table_insert(thread_pool.waiters, tf);
                pthread_mutex_unlock(&thread_pool.wait_mutex);
 
                if (!rcode) {
@@ -1105,7 +1105,7 @@ pid_t rad_waitpid(pid_t pid, int *status)
        mytf.pid = pid;
 
        pthread_mutex_lock(&thread_pool.wait_mutex);
-       tf = lrad_hash_table_finddata(thread_pool.waiters, &mytf);
+       tf = fr_hash_table_finddata(thread_pool.waiters, &mytf);
        pthread_mutex_unlock(&thread_pool.wait_mutex);
 
        if (!tf) return -1;
@@ -1117,7 +1117,7 @@ pid_t rad_waitpid(pid_t pid, int *status)
                        *status = tf->status;
 
                        pthread_mutex_lock(&thread_pool.wait_mutex);
-                       lrad_hash_table_delete(thread_pool.waiters, &mytf);
+                       fr_hash_table_delete(thread_pool.waiters, &mytf);
                        pthread_mutex_unlock(&thread_pool.wait_mutex);
                        return pid;
                }
@@ -1128,7 +1128,7 @@ pid_t rad_waitpid(pid_t pid, int *status)
         *      10 seconds have passed, give up on the child.
         */
        pthread_mutex_lock(&thread_pool.wait_mutex);
-       lrad_hash_table_delete(thread_pool.waiters, &mytf);
+       fr_hash_table_delete(thread_pool.waiters, &mytf);
        pthread_mutex_unlock(&thread_pool.wait_mutex);
 
        return 0;
index 110f940..42e3048 100644 (file)
@@ -32,7 +32,7 @@ RCSID("$Id$")
 #include <freeradius-devel/rad_assert.h>
 
 extern RADCLIENT *client_listener_find(const rad_listen_t *listener,
-                                      const lrad_ipaddr_t *ipaddr);
+                                      const fr_ipaddr_t *ipaddr);
 
 #ifdef WITH_VMPS
 /*
index 60b9994..8728621 100644 (file)
@@ -94,7 +94,7 @@ static int checkval_instantiate(CONF_SECTION *conf, void **instance)
        DICT_ATTR *dattr;
        ATTR_FLAGS flags;
 
-       static const LRAD_NAME_NUMBER names[] = {
+       static const FR_NAME_NUMBER names[] = {
                { "string", PW_TYPE_STRING },
                { "integer", PW_TYPE_INTEGER },
                { "ipaddr", PW_TYPE_IPADDR },
@@ -177,7 +177,7 @@ static int checkval_instantiate(CONF_SECTION *conf, void **instance)
         *      so we don't have to do string comparisons on each
         *      packet.
         */
-       data->dat_type = lrad_str2int(names, data->data_type, -1);
+       data->dat_type = fr_str2int(names, data->data_type, -1);
        if (data->dat_type < 0) {
                radlog(L_ERR, "rlm_checkval: Data type %s in not known",data->data_type);
                checkval_detach(data);
index 2bed25a..e0ead00 100644 (file)
@@ -180,7 +180,7 @@ static int getuname(char **p,char *u,int n) {
 }
 
 static int sm_parse_file(FILE*fp,const char* fname) {
-        LRAD_TOKEN tok;
+        FR_TOKEN tok;
         VALUE_PAIR *vp = NULL;
        sm_parse_state_t  parse_state = SMP_USER;
        unsigned long lino  = 0;
index 2f4afbb..82a80b7 100644 (file)
@@ -71,7 +71,7 @@ struct detail_instance {
        /* log src/dst information */
        int log_srcdst;
 
-       lrad_hash_table_t *ht;
+       fr_hash_table_t *ht;
 };
 
 static const CONF_PARSER module_config[] = {
@@ -98,7 +98,7 @@ static int detail_detach(void *instance)
 {
         struct detail_instance *inst = instance;
        free((char*) inst->last_made_directory);
-       if (inst->ht) lrad_hash_table_free(inst->ht);
+       if (inst->ht) fr_hash_table_free(inst->ht);
 
         free(inst);
        return 0;
@@ -108,7 +108,7 @@ static int detail_detach(void *instance)
 static uint32_t detail_hash(const void *data)
 {
        const DICT_ATTR *da = data;
-       return lrad_hash(&(da->attr), sizeof(da->attr));
+       return fr_hash(&(da->attr), sizeof(da->attr));
 }
 
 static int detail_cmp(const void *a, const void *b)
@@ -145,7 +145,7 @@ static int detail_instantiate(CONF_SECTION *conf, void **instance)
        if (cs) {
                CONF_ITEM       *ci;
 
-               inst->ht = lrad_hash_table_create(detail_hash, detail_cmp,
+               inst->ht = fr_hash_table_create(detail_hash, detail_cmp,
                                                  NULL);
 
                for (ci = cf_item_find_next(cs, NULL);
@@ -171,7 +171,7 @@ static int detail_instantiate(CONF_SECTION *conf, void **instance)
                         *      since the suppression list will usually
                         *      be small, it doesn't matter.
                         */
-                       if (!lrad_hash_table_insert(inst->ht, da)) {
+                       if (!fr_hash_table_insert(inst->ht, da)) {
                                radlog(L_ERR, "rlm_detail: Failed trying to remember %s", attr);
                                detail_detach(inst);
                                return -1;
@@ -425,7 +425,7 @@ static int do_detail(void *instance, REQUEST *request, RADIUS_PACKET *packet,
                da.attr = pair->attribute;
 
                if (inst->ht &&
-                   lrad_hash_table_finddata(inst->ht, &da)) continue;
+                   fr_hash_table_finddata(inst->ht, &da)) continue;
 
                /*
                 *      Don't print passwords in old format...
index 92eb5e3..92397cf 100644 (file)
@@ -243,7 +243,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
                 *      Set A1 to Digest-HA1 if no User-Password found
                 */
                if (passwd->attribute == PW_DIGEST_HA1) {
-                       if (lrad_hex2bin(passwd->vp_strvalue, &a1[0], 16) != 16) {
+                       if (fr_hex2bin(passwd->vp_strvalue, &a1[0], 16) != 16) {
                                DEBUG2("rlm_digest: Invalid text in Digest-HA1");
                                return RLM_MODULE_INVALID;
                        }
@@ -258,7 +258,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
                 */
                if (passwd->attribute == PW_CLEARTEXT_PASSWORD) {
                        fr_md5_calc(hash, &a1[0], a1_len);
-                       lrad_bin2hex(hash, (char *) &a1[0], 16);
+                       fr_bin2hex(hash, (char *) &a1[0], 16);
                } else {        /* MUST be Digest-HA1 */
                        memcpy(&a1[0], passwd->vp_strvalue, 32);
                }
@@ -381,7 +381,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
        } else {
                memcpy(&hash[0], &a1[0], a1_len);
        }
-       lrad_bin2hex(hash, (char *) kd, sizeof(hash));
+       fr_bin2hex(hash, (char *) kd, sizeof(hash));
 
 #ifndef NDEBUG
        if (debug_flag) {
@@ -450,7 +450,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
 
        fr_md5_calc(&hash[0], &a2[0], a2_len);
 
-       lrad_bin2hex(hash, (char *) kd + kd_len, sizeof(hash));
+       fr_bin2hex(hash, (char *) kd + kd_len, sizeof(hash));
 
 #ifndef NDEBUG
        if (debug_flag) {
@@ -482,7 +482,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
                return RLM_MODULE_INVALID;
        }
 
-       if (lrad_hex2bin(&vp->vp_strvalue[0], &hash[0], vp->length >> 1) != (vp->length >> 1)) {
+       if (fr_hex2bin(&vp->vp_strvalue[0], &hash[0], vp->length >> 1) != (vp->length >> 1)) {
                DEBUG2("rlm_digest: Invalid text in Digest-Response");
                return RLM_MODULE_INVALID;
        }
index 36802d6..6f2943b 100644 (file)
@@ -92,7 +92,7 @@ typedef enum operation_t {
 typedef struct _eap_handler {
        struct _eap_handler *prev, *next;
        uint8_t         state[EAP_STATE_LEN];
-       lrad_ipaddr_t   src_ipaddr;
+       fr_ipaddr_t     src_ipaddr;
        unsigned int    eap_id;
        unsigned int    eap_type;
 
index 9637b09..5389e9b 100644 (file)
@@ -53,7 +53,7 @@ static int totaldeny = 0;
 static char filesecret[256];
 const char *radius_dir = RADDBDIR;
 const char *progname = "radeapclient";
-/* lrad_randctx randctx; */
+/* fr_randctx randctx; */
 
 
 radlog_dest_t radlog_dest = RADLOG_STDERR;
@@ -362,10 +362,10 @@ static int process_eap_start(RADIUS_PACKET *req,
                newvp->vp_octets[1]=0;
                newvp->length = 18;  /* 16 bytes of nonce + padding */
 
-               nonce[0]=lrad_rand();
-               nonce[1]=lrad_rand();
-               nonce[2]=lrad_rand();
-               nonce[3]=lrad_rand();
+               nonce[0]=fr_rand();
+               nonce[1]=fr_rand();
+               nonce[2]=fr_rand();
+               nonce[3]=fr_rand();
                memcpy(&newvp->vp_octets[2], nonce, 16);
                pairreplace(&(rep->vps), newvp);
 
@@ -1033,7 +1033,7 @@ int main(int argc, char **argv)
                        fclose(randinit);
                }
        }
-       lrad_randinit(&randctx, 1);
+       fr_randinit(&randctx, 1);
 #endif
 
        req->id = id;
index 0777b4b..92e00c5 100644 (file)
@@ -82,7 +82,7 @@ static int eap_handler_cmp(const void *a, const void *b)
        if (one->eap_id < two->eap_id) return -1;
        if (one->eap_id > two->eap_id) return +1;
 
-       rcode = lrad_ipaddr_cmp(&one->src_ipaddr, &two->src_ipaddr);
+       rcode = fr_ipaddr_cmp(&one->src_ipaddr, &two->src_ipaddr);
        if (rcode != 0) return rcode;
 
        return memcmp(one->state, two->state, sizeof(one->state));
index 2f1e90d..d5ebb0c 100644 (file)
@@ -91,7 +91,7 @@ void generate_key(void)
         *      pseudo-random numbers.
         */
        for (i = 0; i < sizeof(state_key); i++) {
-               state_key[i] = lrad_rand();
+               state_key[i] = fr_rand();
        }
 
        key_initialized = 1;
@@ -125,7 +125,7 @@ VALUE_PAIR *generate_state(time_t timestamp)
 
        /* Generate challenge (a random value).  */
        for (i = 0; i < sizeof(challenge); i++) {
-               challenge[i] = lrad_rand();
+               challenge[i] = fr_rand();
        }
 
        memcpy(value, challenge, sizeof(challenge));
index ffaf68a..93194ab 100644 (file)
@@ -225,7 +225,7 @@ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
 
        } else {                /* MUST be NT-Password */
                if (password->length == 32) {
-                       password->length = lrad_hex2bin(password->vp_strvalue,
+                       password->length = fr_hex2bin(password->vp_strvalue,
                                                        password->vp_octets,
                                                        16);
                }
@@ -415,7 +415,7 @@ LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
         *      Fill the challenge with random bytes.
         */
        for (i = 0; i < reply->count; i++) {
-               reply->challenge[i] = lrad_rand();
+               reply->challenge[i] = fr_rand();
        }
 
        DEBUG2("  rlm_eap_leap: Issuing AP Challenge");
index 12b04bc..3c5f711 100644 (file)
@@ -73,7 +73,7 @@ static int md5_initiate(void *type_data, EAP_HANDLER *handler)
         *      Get a random challenge.
         */
        for (i = 0; i < reply->value_size; i++) {
-               reply->value[i] = lrad_rand();
+               reply->value[i] = fr_rand();
        }
        radlog(L_INFO, "rlm_eap_md5: Issuing Challenge");
 
index 460464f..c080e16 100644 (file)
@@ -230,7 +230,7 @@ static int mschapv2_initiate(void *type_data, EAP_HANDLER *handler)
         */
        challenge->length = MSCHAPV2_CHALLENGE_LEN;
        for (i = 0; i < MSCHAPV2_CHALLENGE_LEN; i++) {
-               challenge->vp_strvalue[i] = lrad_rand();
+               challenge->vp_strvalue[i] = fr_rand();
        }
        radlog(L_INFO, "rlm_eap_mschapv2: Issuing Challenge");
 
index 3c78c85..93aac76 100644 (file)
@@ -38,27 +38,27 @@ struct file_instance {
 
        /* autz */
        char *usersfile;
-       lrad_hash_table_t *users;
+       fr_hash_table_t *users;
 
        /* preacct */
        char *acctusersfile;
-       lrad_hash_table_t *acctusers;
+       fr_hash_table_t *acctusers;
 
        /* pre-proxy */
        char *preproxy_usersfile;
-       lrad_hash_table_t *preproxy_users;
+       fr_hash_table_t *preproxy_users;
 
        /* authenticate */
        char *auth_usersfile;
-       lrad_hash_table_t *auth_users;
+       fr_hash_table_t *auth_users;
 
        /* post-proxy */
        char *postproxy_usersfile;
-       lrad_hash_table_t *postproxy_users;
+       fr_hash_table_t *postproxy_users;
 
        /* post-authenticate */
        char *postauth_usersfile;
-       lrad_hash_table_t *postauth_users;
+       fr_hash_table_t *postauth_users;
 };
 
 
@@ -96,7 +96,7 @@ static const CONF_PARSER module_config[] = {
 
 static uint32_t pairlist_hash(const void *data)
 {
-       return lrad_hash_string(((const PAIR_LIST *)data)->name);
+       return fr_hash_string(((const PAIR_LIST *)data)->name);
 }
 
 static int pairlist_cmp(const void *a, const void *b)
@@ -113,13 +113,13 @@ static void my_pairlist_free(void *data)
 }
 
 
-static int getusersfile(const char *filename, lrad_hash_table_t **pht,
+static int getusersfile(const char *filename, fr_hash_table_t **pht,
                        char *compat_mode_str)
 {
        int rcode;
        PAIR_LIST *users = NULL;
        PAIR_LIST *entry, *next;
-       lrad_hash_table_t *ht, *tailht;
+       fr_hash_table_t *ht, *tailht;
        int order = 0;
 
        if (!filename) {
@@ -252,17 +252,17 @@ static int getusersfile(const char *filename, lrad_hash_table_t **pht,
 
        }
 
-       ht = lrad_hash_table_create(pairlist_hash, pairlist_cmp,
+       ht = fr_hash_table_create(pairlist_hash, pairlist_cmp,
                                    my_pairlist_free);
        if (!ht) {
                pairlist_free(&users);
                return -1;
        }
 
-       tailht = lrad_hash_table_create(pairlist_hash, pairlist_cmp,
+       tailht = fr_hash_table_create(pairlist_hash, pairlist_cmp,
                                        NULL);
        if (!tailht) {
-               lrad_hash_table_free(ht);
+               fr_hash_table_free(ht);
                pairlist_free(&users);
                return -1;
        }
@@ -282,30 +282,30 @@ static int getusersfile(const char *filename, lrad_hash_table_t **pht,
                 *      Insert it into the hash table, and remember
                 *      the tail of the linked list.
                 */
-               tail = lrad_hash_table_finddata(tailht, entry);
+               tail = fr_hash_table_finddata(tailht, entry);
                if (!tail) {
                        /*
                         *      Insert it into the head & tail.
                         */
-                       if (!lrad_hash_table_insert(ht, entry) ||
-                           !lrad_hash_table_insert(tailht, entry)) {
+                       if (!fr_hash_table_insert(ht, entry) ||
+                           !fr_hash_table_insert(tailht, entry)) {
                                pairlist_free(&next);
-                               lrad_hash_table_free(ht);
-                               lrad_hash_table_free(tailht);
+                               fr_hash_table_free(ht);
+                               fr_hash_table_free(tailht);
                                return -1;
                        }
                } else {
                        tail->next = entry;
-                       if (!lrad_hash_table_replace(tailht, entry)) {
+                       if (!fr_hash_table_replace(tailht, entry)) {
                                pairlist_free(&next);
-                               lrad_hash_table_free(ht);
-                               lrad_hash_table_free(tailht);
+                               fr_hash_table_free(ht);
+                               fr_hash_table_free(tailht);
                                return -1;
                        }
                }
        }
 
-       lrad_hash_table_free(tailht);
+       fr_hash_table_free(tailht);
        *pht = ht;
 
        return 0;
@@ -317,12 +317,12 @@ static int getusersfile(const char *filename, lrad_hash_table_t **pht,
 static int file_detach(void *instance)
 {
        struct file_instance *inst = instance;
-       lrad_hash_table_free(inst->users);
-       lrad_hash_table_free(inst->acctusers);
-       lrad_hash_table_free(inst->preproxy_users);
-       lrad_hash_table_free(inst->auth_users);
-       lrad_hash_table_free(inst->postproxy_users);
-       lrad_hash_table_free(inst->postauth_users);
+       fr_hash_table_free(inst->users);
+       fr_hash_table_free(inst->acctusers);
+       fr_hash_table_free(inst->preproxy_users);
+       fr_hash_table_free(inst->auth_users);
+       fr_hash_table_free(inst->postproxy_users);
+       fr_hash_table_free(inst->postauth_users);
        free(inst);
        return 0;
 }
@@ -401,7 +401,7 @@ static int file_instantiate(CONF_SECTION *conf, void **instance)
  *     Common code called by everything below.
  */
 static int file_common(struct file_instance *inst, REQUEST *request,
-                      const char *filename, lrad_hash_table_t *ht,
+                      const char *filename, fr_hash_table_t *ht,
                       VALUE_PAIR *request_pairs, VALUE_PAIR **reply_pairs)
 {
        const char      *name, *match;
@@ -432,9 +432,9 @@ static int file_common(struct file_instance *inst, REQUEST *request,
        if (!ht) return RLM_MODULE_NOOP;
 
        my_pl.name = name;
-       user_pl = lrad_hash_table_finddata(ht, &my_pl);
+       user_pl = fr_hash_table_finddata(ht, &my_pl);
        my_pl.name = "DEFAULT";
-       default_pl = lrad_hash_table_finddata(ht, &my_pl);
+       default_pl = fr_hash_table_finddata(ht, &my_pl);
 
        /*
         *      Find the entry for the user.
index d2ac7fc..a8ace34 100644 (file)
@@ -342,7 +342,7 @@ static int ippool_accounting(void *instance, REQUEST *request)
                        fr_MD5Update(&md5_context, xlat_str, strlen(xlat_str));
                        fr_MD5Final(key_str, &md5_context);
                        key_str[17] = '\0';
-                       lrad_bin2hex(key_str,hex_str,16);
+                       fr_bin2hex(key_str,hex_str,16);
                        hex_str[32] = '\0';
                        DEBUG("rlm_ippool: MD5 on 'key' directive maps to: %s",hex_str);
                        memcpy(key.key,key_str,16);
@@ -485,7 +485,7 @@ static int ippool_postauth(void *instance, REQUEST *request)
        fr_MD5Update(&md5_context, xlat_str, strlen(xlat_str));
        fr_MD5Final(key_str, &md5_context);
        key_str[17] = '\0';
-       lrad_bin2hex(key_str,hex_str,16);
+       fr_bin2hex(key_str,hex_str,16);
        hex_str[32] = '\0';
        DEBUG("rlm_ippool: MD5 on 'key' directive maps to: %s",hex_str);
        memcpy(key.key,key_str,16);
index c7a652c..80ec830 100755 (executable)
@@ -157,7 +157,7 @@ void addip(char *sessiondbname,char *indexdbname,char *ipaddress, char* NASname,
                fr_MD5Update(&md5_context, md5_input_str, strlen(md5_input_str));
                fr_MD5Final(key_str, &md5_context);
                memcpy(key.key,key_str,16);
-               lrad_bin2hex(key_str,hex_str,16);
+               fr_bin2hex(key_str,hex_str,16);
                hex_str[32] = '\0';
                key_datum.dptr = (char *) &key;
                key_datum.dsize = sizeof(ippool_key);
@@ -413,7 +413,7 @@ void tonewformat(char *sessiondbname,char *newsessiondbname){
                fr_MD5Update(&md5_context, md5_input_str, strlen(md5_input_str));
                fr_MD5Final(key_str, &md5_context);
                memcpy(key.key,key_str,16);
-               lrad_bin2hex(key_str,hex_str,16);
+               fr_bin2hex(key_str,hex_str,16);
                hex_str[32] = '\0';
                printf("rlm_ippool_tool: Transforming pair nas/port (%s/%d) to md5 '%s'\n",
                        old_key.nas,old_key.port,hex_str);
@@ -481,7 +481,7 @@ void viewdb(char *sessiondbname,char *indexdbname,char *ipaddress, int old) {
                        printf("NAS:%s port:0x%x - ",old_key.nas,old_key.port);
                    else{
                        memcpy(key_str,key.key,16);
-                       lrad_bin2hex(key_str,hex_str,16);
+                       fr_bin2hex(key_str,hex_str,16);
                        hex_str[32] = '\0';
                        printf("KEY: '%s' - ",hex_str);
                    }
@@ -549,7 +549,7 @@ void viewdb(char *sessiondbname,char *indexdbname,char *ipaddress, int old) {
                        printf("NAS:%s port:0x%x\n",old_key.nas,old_key.port);
                    else{
                        memcpy(key_str,key.key,16);
-                       lrad_bin2hex(key_str,hex_str,16);
+                       fr_bin2hex(key_str,hex_str,16);
                        hex_str[32] = '\0';
                        printf("KEY: '%s' - ",hex_str);
                    }
index 3181a40..c7afe2d 100644 (file)
@@ -417,7 +417,7 @@ static int jradius_instantiate(CONF_SECTION *conf, void **instance)
       if (sscanf(b, "%[^:]:%d", host, &port) == 2) { h = host; p = port; }
 
       if (h) {
-       lrad_ipaddr_t ipaddr;
+       fr_ipaddr_t ipaddr;
        if (ip_hton(h, AF_INET, &ipaddr) < 0) {
          radlog(L_ERR, "Can't find IP address for host %s", h);
          continue;
index 732b644..c256224 100644 (file)
@@ -106,7 +106,7 @@ int radLdapXtnNMASAuth( LDAP *, char *, char *, char *, char *, size_t *, char *
 struct TLDAP_RADIUS {
        char*                 attr;
        char*                 radius_attr;
-       LRAD_TOKEN            operator;
+       FR_TOKEN              operator;
        struct TLDAP_RADIUS*  next;
 };
 typedef struct TLDAP_RADIUS TLDAP_RADIUS;
@@ -641,7 +641,7 @@ read_mappings(ldap_instance* inst)
        char buf[MAX_LINE_LEN], itemType[MAX_LINE_LEN];
        char radiusAttribute[MAX_LINE_LEN], ldapAttribute[MAX_LINE_LEN];
        int linenumber;
-       LRAD_TOKEN operator;
+       FR_TOKEN operator;
        char opstring[MAX_LINE_LEN];
 
        /* open the mappings file for reading */
@@ -1202,7 +1202,7 @@ static int ldap_xlat(void *instance, REQUEST *request, char *fmt,
 /*
  *     For auto-header discovery.
  */
-static const LRAD_NAME_NUMBER header_names[] = {
+static const FR_NAME_NUMBER header_names[] = {
        { "{clear}",    PW_CLEARTEXT_PASSWORD },
        { "{cleartext}", PW_CLEARTEXT_PASSWORD },
        { "{md5}",      PW_MD5_PASSWORD },
@@ -1474,7 +1474,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                        memcpy(autobuf, value, p - value + 1);
                                        autobuf[p - value + 1] = '\0';
 
-                                       attr = lrad_str2int(header_names,
+                                       attr = fr_str2int(header_names,
                                                            autobuf, 0);
                                        if (!attr) continue;
                                        value = p + 1;
@@ -2491,7 +2491,7 @@ fieldcpy(char *string, char **uptr)
 /*
  *     Copied from src/lib/token.c
  */
-static const LRAD_NAME_NUMBER tokens[] = {
+static const FR_NAME_NUMBER tokens[] = {
        { "=~", T_OP_REG_EQ,    }, /* order is important! */
        { "!~", T_OP_REG_NE,    },
        { "{",  T_LCBRACE,      },
@@ -2530,7 +2530,7 @@ static VALUE_PAIR *ldap_pairget(LDAP *ld, LDAPMessage *entry,
        char           *ptr;
        char           *value;
        TLDAP_RADIUS   *element;
-       LRAD_TOKEN      token, operator;
+       FR_TOKEN      token, operator;
        int             is_generic_attribute;
        char            buf[MAX_STRING_LEN];
        VALUE_PAIR     *pairlist = NULL;
@@ -2572,7 +2572,7 @@ static VALUE_PAIR *ldap_pairget(LDAP *ld, LDAPMessage *entry,
                                /*
                                 *      This is a generic attribute.
                                 */
-                               LRAD_TOKEN dummy; /* makes pairread happy */
+                               FR_TOKEN dummy; /* makes pairread happy */
 
                                /* not sure if using pairread here is ok ... */
                                if ( (newpair = pairread(&value, &dummy)) != NULL) {
index ce8cfd0..dc9b783 100644 (file)
@@ -540,7 +540,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                DEBUG("rlm_mschap: NT-Hash: %s",p);
                ntpwdhash(buffer,p);
 
-               lrad_bin2hex(buffer, out, 16);
+               fr_bin2hex(buffer, out, 16);
                out[32] = '\0';
                DEBUG("rlm_mschap: NT-Hash: Result: %s",out);
                return 32;
@@ -557,7 +557,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
 
                DEBUG("rlm_mschap: LM-Hash: %s",p);
                smbdes_lmpwdhash(p,buffer);
-               lrad_bin2hex(buffer, out, 16);
+               fr_bin2hex(buffer, out, 16);
                out[32] = '\0';
                DEBUG("rlm_mschap: LM-Hash: Result: %s",out);
                return 32;
@@ -831,7 +831,7 @@ static int do_mschap(rlm_mschap_t *inst,
                /*
                 *      Update the NT hash hash, from the NT key.
                 */
-               if (lrad_hex2bin(buffer + 8, nthashhash, 16) != 16) {
+               if (fr_hex2bin(buffer + 8, nthashhash, 16) != 16) {
                        DEBUG2("  rlm_mschap: Invalid output from ntlm_auth: NT_KEY has non-hex values");
                        return -1;
                }
@@ -1078,7 +1078,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                 */
                if ((lm_password->length == 16) ||
                    ((lm_password->length == 32) &&
-                    (lrad_hex2bin(lm_password->vp_strvalue,
+                    (fr_hex2bin(lm_password->vp_strvalue,
                                   lm_password->vp_strvalue, 16) == 16))) {
                        DEBUG2("  rlm_mschap: Found LM-Password");
                        lm_password->length = 16;
@@ -1110,7 +1110,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
        if (nt_password) {
                if ((nt_password->length == 16) ||
                    ((nt_password->length == 32) &&
-                    (lrad_hex2bin(nt_password->vp_strvalue,
+                    (fr_hex2bin(nt_password->vp_strvalue,
                                   nt_password->vp_strvalue, 16) == 16))) {
                        DEBUG2("  rlm_mschap: Found NT-Password");
                        nt_password->length = 16;
index f4199f6..f31ef9f 100644 (file)
@@ -23,8 +23,8 @@
 RCSID("$Id$")
 
 /* avoid inclusion of these FR headers which conflict w/ OpenSSL */
-#define _LRAD_MD4_H
-#define _LRAD_SHA1_H
+#define _FR_MD4_H
+#define _FR_SHA1_H
 
 #include <freeradius-devel/rad_assert.h>
 
index abad891..4083180 100644 (file)
@@ -29,8 +29,8 @@
 RCSID("$Id$")
 
 /* avoid inclusion of these FR headers which conflict w/ OpenSSL */
-#define _LRAD_MD4_H
-#define _LRAD_SHA1_H
+#define _FR_MD4_H
+#define _FR_SHA1_H
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/rad_assert.h>
 
index 6b8f632..b896413 100644 (file)
@@ -23,8 +23,8 @@
 RCSID("$Id$")
 
 /* avoid inclusion of these FR headers which conflict w/ OpenSSL */
-#define _LRAD_MD4_H
-#define _LRAD_SHA1_H
+#define _FR_MD4_H
+#define _FR_SHA1_H
 
 #include "extern.h"
 
index 4c596fb..4087381 100644 (file)
@@ -41,7 +41,7 @@ otp_get_random(char *rnd_data, size_t len)
   while (bytes_read < len) {
     int n;
     unsigned int bytes_left = len - bytes_read;
-    uint32_t r = lrad_rand();
+    uint32_t r = fr_rand();
 
     n = sizeof(r) < bytes_left ? sizeof(r) : bytes_left;
     (void) memcpy(rnd_data + bytes_read, &r, n);
index 00f47cb..6a4fd6c 100644 (file)
@@ -77,7 +77,7 @@ static const CONF_PARSER module_config[] = {
        { NULL, -1, 0, NULL, NULL }
 };
 
-static const LRAD_NAME_NUMBER schemes[] = {
+static const FR_NAME_NUMBER schemes[] = {
        { "clear", PAP_ENC_CLEAR },
        { "crypt", PAP_ENC_CRYPT },
        { "md5", PAP_ENC_MD5 },
@@ -94,7 +94,7 @@ static const LRAD_NAME_NUMBER schemes[] = {
 /*
  *     For auto-header discovery.
  */
-static const LRAD_NAME_NUMBER header_names[] = {
+static const FR_NAME_NUMBER header_names[] = {
        { "{clear}",    PW_CLEARTEXT_PASSWORD },
        { "{cleartext}", PW_CLEARTEXT_PASSWORD },
        { "{md5}",      PW_MD5_PASSWORD },
@@ -147,7 +147,7 @@ static int pap_instantiate(CONF_SECTION *conf, void **instance)
                return -1;
        }
 
-       inst->sch = lrad_str2int(schemes, inst->scheme, PAP_ENC_INVALID);
+       inst->sch = fr_str2int(schemes, inst->scheme, PAP_ENC_INVALID);
        if (inst->sch == PAP_ENC_INVALID) {
                radlog(L_ERR, "rlm_pap: Unknown scheme \"%s\"", inst->scheme);
                pap_detach(inst);
@@ -249,7 +249,7 @@ static void normify(VALUE_PAIR *vp, int min_length)
         *      Hex encoding.
         */
        if (vp->length >= (2 * min_length)) {
-               decoded = lrad_hex2bin(vp->vp_octets, buffer, vp->length >> 1);
+               decoded = fr_hex2bin(vp->vp_octets, buffer, vp->length >> 1);
                if (decoded == (vp->length >> 1)) {
                        DEBUG2("rlm_pap: Normalizing %s from hex encoding", vp->name);
                        memcpy(vp->vp_octets, buffer, decoded);
@@ -332,7 +332,7 @@ static int pap_authorize(void *instance, REQUEST *request)
                        memcpy(buffer, q, p - q + 1);
                        buffer[p - q + 1] = '\0';
 
-                       attr = lrad_str2int(header_names, buffer, 0);
+                       attr = fr_str2int(header_names, buffer, 0);
                        if (!attr) {
                                DEBUG2("rlm_pap: Found unknown header {%s}: Not doing anything", buffer);
                                break;
@@ -592,7 +592,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
        case PAP_ENC_CRYPT:
        do_crypt:
                DEBUG("rlm_pap: Using CRYPT encryption.");
-               if (lrad_crypt_check((char *) request->password->vp_strvalue,
+               if (fr_crypt_check((char *) request->password->vp_strvalue,
                                     (char *) vp->vp_strvalue) != 0) {
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: CRYPT password check failed");
                        goto make_msg;
@@ -713,7 +713,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: mschap xlat failed");
                        goto make_msg;
                }
-               if ((lrad_hex2bin(digest, digest, 16) != vp->length) ||
+               if ((fr_hex2bin(digest, digest, 16) != vp->length) ||
                    (memcmp(digest, vp->vp_octets, vp->length) != 0)) {
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: NT password check failed");
                        goto make_msg;
@@ -738,7 +738,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: mschap xlat failed");
                        goto make_msg;
                }
-               if ((lrad_hex2bin(digest, digest, 16) != vp->length) ||
+               if ((fr_hex2bin(digest, digest, 16) != vp->length) ||
                    (memcmp(digest, vp->vp_octets, vp->length) != 0)) {
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: LM password check failed");
                make_msg:
@@ -764,7 +764,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                /*
                 *      Sanity check the value of NS-MTA-MD5-Password
                 */
-               if (lrad_hex2bin(vp->vp_octets, buff, 32) != 16) {
+               if (fr_hex2bin(vp->vp_octets, buff, 32) != 16) {
                        DEBUG("rlm_pap: Configured NS-MTA-MD5-Password has invalid value");
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: Configured NS-MTA-MD5-Password has invalid value");
                        goto make_msg;
index d3f9cab..b1ecfdc 100644 (file)
@@ -73,7 +73,7 @@ static void policy_print(const policy_item_t *item, int indent)
                                if (indent) printf("%*s", indent, " ");
 
                                printf("\t%s %s ", assign->lhs,
-                                      lrad_int2str(rlm_policy_tokens,
+                                      fr_int2str(rlm_policy_tokens,
                                                    assign->assign, "?"));
                                if (assign->rhs_type == POLICY_LEX_BARE_WORD) {
                                        printf("%s\n", assign->rhs);
@@ -129,7 +129,7 @@ static void policy_print(const policy_item_t *item, int indent)
                                /*
                                 *      We always print this condition.
                                 */
-                               printf(" %s ", lrad_int2str(rlm_policy_tokens,
+                               printf(" %s ", fr_int2str(rlm_policy_tokens,
                                                            condition->compare,
                                                            "?"));
                                if (condition->rhs_type == POLICY_LEX_BARE_WORD) {
@@ -146,7 +146,7 @@ static void policy_print(const policy_item_t *item, int indent)
 
                                if ((condition->child_condition != POLICY_LEX_BAD) &&
                                    (condition->child_condition != POLICY_LEX_BARE_WORD)) {
-                                       printf(" %s ", lrad_int2str(rlm_policy_tokens, condition->child_condition, "?"));
+                                       printf(" %s ", fr_int2str(rlm_policy_tokens, condition->child_condition, "?"));
                                        policy_print(condition->child, indent);
                                }
                        }
@@ -188,9 +188,9 @@ static void policy_print(const policy_item_t *item, int indent)
 
                                if (indent) printf("%*s", indent, " ");
                                printf("%s %s {\n",
-                                      lrad_int2str(policy_reserved_words,
+                                      fr_int2str(policy_reserved_words,
                                                    this->where, "?"),
-                                      lrad_int2str(rlm_policy_tokens,
+                                      fr_int2str(rlm_policy_tokens,
                                                    this->how, "?"));
                                policy_print(this->attributes, indent + 1);
                                if (indent) printf("%*s", indent, " ");
@@ -228,7 +228,7 @@ static void policy_print(const policy_item_t *item, int indent)
                                this = (const policy_return_t *) item;
                                if (indent) printf("%*s", indent, " ");
                                printf("return %s\n",
-                                      lrad_int2str(policy_return_codes,
+                                      fr_int2str(policy_return_codes,
                                                    this->rcode, "???"));
                        }
                        break;
@@ -240,7 +240,7 @@ static void policy_print(const policy_item_t *item, int indent)
                                this = (const policy_module_t *) item;
                                if (indent) printf("%*s", indent, " ");
                                printf("module %s <stuff>\n",
-                                      lrad_int2str(policy_component_names,
+                                      fr_int2str(policy_component_names,
                                                    this->component, "???"));
                        }
                        break;
@@ -519,7 +519,7 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                         *      evaluate all of it...
                         */
                        rcode = policy_evaluate_name(state, this->lhs);
-                       data = lrad_int2str(policy_return_codes, rcode, "???");
+                       data = fr_int2str(policy_return_codes, rcode, "???");
                        strlcpy(lhs_buffer, data, sizeof(lhs_buffer)); /* FIXME: yuck */
                } else if (this->lhs_type == POLICY_LEX_DOUBLE_QUOTED_STRING) {
                        if (radius_xlat(lhs_buffer, sizeof(lhs_buffer), this->lhs,
@@ -800,7 +800,7 @@ static VALUE_PAIR *assign2vp(REQUEST *request,
                             const policy_assignment_t *assign)
 {
        VALUE_PAIR *vp;
-       LRAD_TOKEN operator = T_OP_EQ;
+       FR_TOKEN operator = T_OP_EQ;
        const char *value = assign->rhs;
        char buffer[2048];
 
@@ -829,7 +829,7 @@ static VALUE_PAIR *assign2vp(REQUEST *request,
 
        default:
                fprintf(stderr, "Expected '=' for operator, not '%s' at line %d\n",
-                       lrad_int2str(rlm_policy_tokens,
+                       fr_int2str(rlm_policy_tokens,
                                     assign->assign, "?"),
                        assign->item.lineno);
                return NULL;
@@ -1095,7 +1095,7 @@ int rlm_policy_evaluate(rlm_policy_t *inst, REQUEST *request, const char *name)
        state->request = request;
        state->inst = inst;
        state->rcode = RLM_MODULE_OK;
-       state->component = lrad_str2int(policy_component_names, name,
+       state->component = fr_str2int(policy_component_names, name,
                                        RLM_COMPONENT_COUNT);
 
        rcode = policy_evaluate_name(state, name);
index 080af37..0384298 100644 (file)
@@ -36,7 +36,7 @@ RCSID("$Id$")
 
 #include <freeradius-devel/modules.h>
 
-const LRAD_NAME_NUMBER policy_return_codes[] = {
+const FR_NAME_NUMBER policy_return_codes[] = {
        { "reject", RLM_MODULE_REJECT },
        { "fail", RLM_MODULE_FAIL },
        { "ok", RLM_MODULE_OK },
@@ -52,7 +52,7 @@ const LRAD_NAME_NUMBER policy_return_codes[] = {
 /*
  *     Explanations of what the lexical tokens are.
  */
-static const LRAD_NAME_NUMBER policy_explanations[] = {
+static const FR_NAME_NUMBER policy_explanations[] = {
        { "invalid input", POLICY_LEX_BAD },
        { "end of file", POLICY_LEX_EOF },
        { "end of line", POLICY_LEX_EOL },
@@ -86,7 +86,7 @@ static const LRAD_NAME_NUMBER policy_explanations[] = {
 };
 
 
-const LRAD_NAME_NUMBER rlm_policy_tokens[] = {
+const FR_NAME_NUMBER rlm_policy_tokens[] = {
        { "EOF", POLICY_LEX_EOF },
        { "#", POLICY_LEX_HASH },
        { "(", POLICY_LEX_L_BRACKET },
@@ -488,7 +488,7 @@ static policy_lex_t policy_lex_file(policy_lex_file_t *lexer,
                        if (flags & POLICY_LEX_FLAG_PRINT_TOKEN) {
                                debug_tokens("[%s token %s] ",
                                             (flags & POLICY_LEX_FLAG_PEEK) ? "peek " : "",
-                                            lrad_int2str(rlm_policy_tokens,
+                                            fr_int2str(rlm_policy_tokens,
                                                          token, "?"));
                        }
                        return token;
@@ -533,7 +533,7 @@ static int parse_block(policy_lex_file_t *lexer, policy_item_t **tail);
 /*
  *     Map reserved words to tokens, and vice versa.
  */
-const LRAD_NAME_NUMBER policy_reserved_words[] = {
+const FR_NAME_NUMBER policy_reserved_words[] = {
        { "if", POLICY_RESERVED_IF },
        { "else", POLICY_RESERVED_ELSE },
        { "debug", POLICY_RESERVED_DEBUG },
@@ -555,7 +555,7 @@ const LRAD_NAME_NUMBER policy_reserved_words[] = {
  *     Simplifies some later coding
  */
 static int policy_lex_str2int(policy_lex_file_t *lexer,
-                             const LRAD_NAME_NUMBER *table, int default_value)
+                             const FR_NAME_NUMBER *table, int default_value)
 {
        policy_lex_t token;
        char buffer[256];
@@ -567,7 +567,7 @@ static int policy_lex_str2int(policy_lex_file_t *lexer,
                return default_value;
        }
 
-       return lrad_str2int(table, buffer, default_value);
+       return fr_str2int(table, buffer, default_value);
 }
 
 
@@ -620,7 +620,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
        if (token != POLICY_LEX_L_BRACKET) {
                fprintf(stderr, "%s[%d]: Expected '(', got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, lhs));
+                       fr_int2str(rlm_policy_tokens, token, lhs));
                return 0;
        }
 
@@ -694,7 +694,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                        if (token != POLICY_LEX_L_BRACKET) {
                                fprintf(stderr, "%s[%d]: Expected left bracket, got \"%s\"\n",
                                        lexer->filename, lexer->lineno,
-                                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                                       fr_int2str(rlm_policy_tokens, token, "?"));
                                return 0;
                        }
 
@@ -702,7 +702,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                        if (token != POLICY_LEX_R_BRACKET) {
                                fprintf(stderr, "%s[%d]: Expected right bracket, got \"%s\"\n",
                                        lexer->filename, lexer->lineno,
-                                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                                       fr_int2str(rlm_policy_tokens, token, "?"));
                                return 0;
                        }
                } /* else it's a comparison? */
@@ -740,7 +740,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                default:
                        fprintf(stderr, "%s[%d]: Invalid operator \"%s\"\n",
                                lexer->filename, lexer->lineno,
-                               lrad_int2str(rlm_policy_tokens, compare, rhs));
+                               fr_int2str(rlm_policy_tokens, compare, rhs));
                        rlm_policy_free_item((policy_item_t *) this);
                        return 0;
                }
@@ -754,7 +754,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                        return 0;
                }
                debug_tokens("[COMPARE (%s %s %s)] ",
-                      lhs, lrad_int2str(rlm_policy_tokens, compare, "?"), rhs);
+                      lhs, fr_int2str(rlm_policy_tokens, compare, "?"), rhs);
                this->lhs = strdup(lhs);
                this->compare = compare;
                this->rhs_type = token;
@@ -772,7 +772,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
        if (token != POLICY_LEX_R_BRACKET) {
                fprintf(stderr, "%s[%d]: Expected ')', got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                rlm_policy_free_item((policy_item_t *) this);
                return 0;
        }
@@ -784,7 +784,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
        if ((token == POLICY_LEX_L_AND) || (token == POLICY_LEX_L_OR)) {
                token = policy_lex_file(lexer, 0, NULL, 0); /* skip over it */
                debug_tokens("[%s] ",
-                      lrad_int2str(rlm_policy_tokens, token, "?"));
+                      fr_int2str(rlm_policy_tokens, token, "?"));
                this->child_condition = token;
                rcode = parse_condition(lexer, &(this->child));
                if (!rcode) {
@@ -834,7 +834,7 @@ static int parse_if(policy_lex_file_t *lexer, policy_item_t **tail)
        token = policy_lex_file(lexer, POLICY_LEX_FLAG_PEEK,
                                mystring, sizeof(mystring));
        if ((token == POLICY_LEX_BARE_WORD) &&
-           (lrad_str2int(policy_reserved_words, mystring,
+           (fr_str2int(policy_reserved_words, mystring,
                          POLICY_RESERVED_UNKNOWN) == POLICY_RESERVED_ELSE)) {
                debug_tokens("[ELSE] ");
                token = policy_lex_file(lexer, 0, mystring, sizeof(mystring));
@@ -842,7 +842,7 @@ static int parse_if(policy_lex_file_t *lexer, policy_item_t **tail)
                token = policy_lex_file(lexer, POLICY_LEX_FLAG_PEEK,
                                        mystring, sizeof(mystring));
                if ((token == POLICY_LEX_BARE_WORD) &&
-                   (lrad_str2int(policy_reserved_words, mystring,
+                   (fr_str2int(policy_reserved_words, mystring,
                                  POLICY_RESERVED_UNKNOWN) == POLICY_RESERVED_IF)) {
                        token = policy_lex_file(lexer, 0,
                                                mystring, sizeof(mystring));
@@ -890,7 +890,7 @@ static int parse_call(policy_lex_file_t *lexer, policy_item_t **tail,
        if (token != POLICY_LEX_L_BRACKET) {
                fprintf(stderr, "%s[%d]: Expected left bracket, got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                return 0;
        }
 
@@ -898,7 +898,7 @@ static int parse_call(policy_lex_file_t *lexer, policy_item_t **tail,
        if (token != POLICY_LEX_R_BRACKET) {
                fprintf(stderr, "%s[%d]: Expected right bracket, got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                return 0;
        }
 
@@ -937,7 +937,7 @@ static int parse_attribute_block(policy_lex_file_t *lexer,
        default:
                fprintf(stderr, "%s[%d]: Unexpected token %s\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                return 0;       /* unknown */
        }
 
@@ -1000,7 +1000,7 @@ static int parse_return(policy_lex_file_t *lexer, policy_item_t **tail)
 }
 
 
-const LRAD_NAME_NUMBER policy_component_names[] = {
+const FR_NAME_NUMBER policy_component_names[] = {
        { "authenticate", RLM_COMPONENT_AUTH },
        { "authorize", RLM_COMPONENT_AUTZ },
        { "preacct", RLM_COMPONENT_PREACCT },
@@ -1034,7 +1034,7 @@ static int parse_module(policy_lex_file_t *lexer, policy_item_t **tail)
        if (token != POLICY_LEX_DOUBLE_QUOTED_STRING) {
                fprintf(stderr, "%s[%d]: Expected filename, got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                return 0;
        }
 
@@ -1073,7 +1073,7 @@ static int parse_module(policy_lex_file_t *lexer, policy_item_t **tail)
 
        section_name = cf_section_name1(subcs);
        rad_assert(section_name != NULL);
-       component = lrad_str2int(policy_component_names, section_name,
+       component = fr_str2int(policy_component_names, section_name,
                                 RLM_COMPONENT_COUNT);
        if (component == RLM_COMPONENT_COUNT) {
                fprintf(stderr, "%s[%d]: Invalid section name \"%s\"\n",
@@ -1131,7 +1131,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
                break;
 
        case POLICY_LEX_BARE_WORD:
-               reserved = lrad_str2int(policy_reserved_words,
+               reserved = fr_str2int(policy_reserved_words,
                                        lhs,
                                        POLICY_RESERVED_UNKNOWN);
                switch (reserved) {
@@ -1224,7 +1224,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
        default:
                fprintf(stderr, "%s[%d]: Unexpected %s\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(policy_explanations,
+                       fr_int2str(policy_explanations,
                                     token, "string"));
                break;
        }
@@ -1244,7 +1244,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
        default:
                fprintf(stderr, "%s[%d]: Unexpected assign %s\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(policy_explanations,
+                       fr_int2str(policy_explanations,
                                     assign, "string"));
                return 0;
        }
@@ -1260,7 +1260,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
            (token != POLICY_LEX_DOUBLE_QUOTED_STRING)) {
                fprintf(stderr, "%s[%d]: Unexpected rhs %s\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(policy_explanations,
+                       fr_int2str(policy_explanations,
                                     token, "string"));
                rlm_policy_free_item((policy_item_t *) this);
                return 0;
@@ -1277,7 +1277,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
                return 0;
        }
        debug_tokens("[ASSIGN %s %s %s]\n",
-              lhs, lrad_int2str(rlm_policy_tokens, assign, "?"), rhs);
+              lhs, fr_int2str(rlm_policy_tokens, assign, "?"), rhs);
 
        /*
         *      Fill in the assignment struct
@@ -1411,7 +1411,7 @@ static int parse_named_policy(policy_lex_file_t *lexer)
        if (token != POLICY_LEX_BARE_WORD) {
                fprintf(stderr, "%s[%d]: Expected policy name, got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                rlm_policy_free_item((policy_item_t *) this);
                return 0;
        }
@@ -1467,7 +1467,7 @@ static int parse_include(policy_lex_file_t *lexer)
        if (token != POLICY_LEX_DOUBLE_QUOTED_STRING) {
                fprintf(stderr, "%s[%d]: Expected filename, got \"%s\"\n",
                        lexer->filename, lexer->lineno,
-                       lrad_int2str(rlm_policy_tokens, token, "?"));
+                       fr_int2str(rlm_policy_tokens, token, "?"));
                return 0;
        }
 
@@ -1568,7 +1568,7 @@ int rlm_policy_parse(rbtree_t *policies, const char *filename)
                token = policy_lex_file(lexer, 0, buffer, sizeof(buffer));
                switch (token) {
                case POLICY_LEX_BARE_WORD:
-                       reserved = lrad_str2int(policy_reserved_words,
+                       reserved = fr_str2int(policy_reserved_words,
                                                buffer,
                                                POLICY_RESERVED_UNKNOWN);
                        switch (reserved) {
index 79b27ec..a618056 100644 (file)
@@ -247,10 +247,10 @@ typedef struct rlm_policy_t {
 /*
  *     Functions.
  */
-extern const LRAD_NAME_NUMBER rlm_policy_tokens[];
-extern const LRAD_NAME_NUMBER policy_reserved_words[];
-extern const LRAD_NAME_NUMBER policy_return_codes[];
-extern const LRAD_NAME_NUMBER policy_component_names[];
+extern const FR_NAME_NUMBER rlm_policy_tokens[];
+extern const FR_NAME_NUMBER policy_reserved_words[];
+extern const FR_NAME_NUMBER policy_return_codes[];
+extern const FR_NAME_NUMBER policy_component_names[];
 
 extern int rlm_policy_insert(rbtree_t *head, policy_named_t *policy);
 extern policy_named_t *rlm_policy_find(rbtree_t *head, const char *name);
index a48432e..9246968 100644 (file)
@@ -258,7 +258,7 @@ static int check_for_realm(void *instance, REQUEST *request, REALM **returnrealm
        vp = pairfind(request->packet->vps, PW_FREERADIUS_PROXIED_TO);
        if (vp && (request->packet->src_ipaddr.af == AF_INET)) {
                int i;
-               lrad_ipaddr_t my_ipaddr;
+               fr_ipaddr_t my_ipaddr;
 
                my_ipaddr.af = AF_INET;
                my_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
@@ -271,7 +271,7 @@ static int check_for_realm(void *instance, REQUEST *request, REALM **returnrealm
                 *      send it there again.
                 */
                for (i = 0; i < realm->acct_pool->num_home_servers; i++) {
-                       if (lrad_ipaddr_cmp(&realm->acct_pool->servers[i]->ipaddr,
+                       if (fr_ipaddr_cmp(&realm->acct_pool->servers[i]->ipaddr,
                                            &my_ipaddr) == 0) {
                                DEBUG2("Suppressing proxy due to FreeRADIUS-Proxied-To");
                                return 0;
@@ -295,7 +295,7 @@ static int check_for_realm(void *instance, REQUEST *request, REALM **returnrealm
                 *      send it there again.
                 */
                for (i = 0; i < realm->acct_pool->num_home_servers; i++) {
-                       if ((lrad_ipaddr_cmp(&realm->acct_pool->servers[i]->ipaddr,
+                       if ((fr_ipaddr_cmp(&realm->acct_pool->servers[i]->ipaddr,
                                             &request->packet->src_ipaddr) == 0) &&
                            (realm->acct_pool->servers[i]->port == request->packet->src_port)) {
                                DEBUG2("Suppressing proxy because packet was already sent to a server in that realm");
index 67d2bf3..100c463 100644 (file)
@@ -319,7 +319,7 @@ void RFCNB_Print_Pkt(FILE *fd, char *dirn, struct RFCNB_Pkt *pkt, int len)
 int RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP)
 
 {
-       lrad_ipaddr_t ipaddr;
+       fr_ipaddr_t ipaddr;
 
        if (ip_hton(host, AF_INET, &ipaddr) < 0) {
                /* Try NetBIOS name lookup, how the hell do we do that? */
index 16f2e71..f4893a3 100644 (file)
@@ -318,7 +318,7 @@ int sql_userparse(VALUE_PAIR ** first_pair, SQL_ROW row)
        char *ptr, *value;
        char buf[MAX_STRING_LEN];
        char do_xlat = 0;
-       LRAD_TOKEN token, operator = T_EOL;
+       FR_TOKEN token, operator = T_EOL;
 
        /*
         *      Verify the 'Attribute' field
index 18a1d56..308dc72 100644 (file)
@@ -531,7 +531,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
        uint32_t ip_allocation;
        VALUE_PAIR * vp;
        SQLSOCK * sqlsocket;
-       lrad_ipaddr_t ipaddr;
+       fr_ipaddr_t ipaddr;
        char    logstr[MAX_STRING_LEN];
 
        /*
index 6a0fbd8..b1987b9 100644 (file)
@@ -364,7 +364,7 @@ static int unix_authenticate(void *instance, REQUEST *request)
        /*
         *      0 means "ok"
         */
-       if (lrad_crypt_check((char *) request->password->vp_strvalue,
+       if (fr_crypt_check((char *) request->password->vp_strvalue,
                             (char *) vp->vp_strvalue) != 0) {
                radlog(L_AUTH, "rlm_unix: [%s]: invalid password",
                       request->username->vp_strvalue);