* Version: $Id$
*
*/
-
#include "autoconf.h"
#ifdef HAVE_SYS_TYPES_H
#endif
typedef struct attr_flags {
- char addport; /* Add port to IP address */
- char has_tag; /* attribute allows tags */
- signed char tag;
- uint8_t encrypt; /* encryption method */
- signed char len_disp; /* length displacement */
- char do_xlat;
+ unsigned int addport : 1; /* add NAS-Port to IP address */
+ unsigned int has_tag : 1; /* tagged attribute */
+ unsigned int do_xlat : 1; /* strvalue is dynamic */
+ unsigned int caseless : 1; /* case insensitive compares */
+ int8_t tag; /* tag for tunneled attributes */
+ uint8_t encrypt; /* encryption method */
} ATTR_FLAGS;
/*
int type;
int vendor;
ATTR_FLAGS flags;
- struct dict_attr *next;
} DICT_ATTR;
typedef struct dict_value {
char name[40];
- char attrname[40];
int attr;
int value;
- struct dict_value *next;
} DICT_VALUE;
typedef struct dict_vendor {
- char vendorname[40];
+ char name[40];
int vendorpec;
struct dict_vendor *next;
} DICT_VENDOR;
int dict_addattr(const char *name, int vendor, int type, int value, ATTR_FLAGS flags);
int dict_addvalue(const char *namestr, char *attrstr, int value);
int dict_init(const char *dir, const char *fn);
+void dict_free(void);
DICT_ATTR *dict_attrbyvalue(int attr);
DICT_ATTR *dict_attrbyname(const char *attr);
DICT_VALUE *dict_valbyattr(int attr, int val);
DICT_VALUE *dict_valbyname(int attr, const char *val);
-int dict_vendorname(const char *name);
+int dict_vendorbyname(const char *name);
+DICT_VENDOR *dict_vendorbyvalue(int vendor);
/*
* Compatibility
/*#define dict_valget dict_valbyattr almost but not quite*/
#endif
+/* get around diffrent ctime_r styles */
+#ifdef CTIMERSTYLE
+#if CTIMERSTYLE == SOLARISSTYLE
+#define CTIME_R(a,b,c) ctime_r(a,b,c)
+#else
+#define CTIME_R(a,b,c) ctime_r(a,b)
+#endif
+#else
+#define CTIME_R(a,b,c) ctime_r(a,b)
+#endif
+
/* md5.c */
void librad_md5_calc(u_char *, u_char *, u_int);
*/
char * ip_hostname (char *buf, size_t buflen, uint32_t ipaddr);
uint32_t ip_getaddr (const char *);
-char * ip_ntoa(char *, uint32_t);
+const char * ip_ntoa(char *, uint32_t);
uint32_t ip_addr(const char *);
char *ifid_ntoa(char *buffer, size_t size, uint8_t *ifid);
uint8_t *ifid_aton(const char *ifid_str, uint8_t *ifid);
-char *ipv6_ntoa(char *buffer, size_t size, void *ip6addr);
+const char *ipv6_ntoa(char *buffer, size_t size, void *ip6addr);
int ipv6_addr(const char *ip6_str, void *ip6addr);
char *strNcpy(char *dest, const char *src, int n);
void rad_lowercase(char *str);
void print_abinary(VALUE_PAIR *vp, u_char *buffer, int len);
#endif /*ASCEND_BINARY*/
+#ifndef HAVE_SNPRINTF
+#define HAVE_LOCAL_SNPRINTF
+#define snprintf lrad_snprintf
+#endif
+
+#ifndef HAVE_VSNPRINTF
+#define HAVE_LOCAL_SNPRINTF
+#define vsnprintf lrad_vsnprintf
+#endif
+
#ifdef HAVE_LOCAL_SNPRINTF
#include <stdarg.h>
int snprintf(char *str, size_t count, const char *fmt, ...);
void lrad_randinit(lrad_randctx *ctx, int flag);
uint32_t lrad_rand(void); /* like rand(), but better. */
-void lrad_lmpwdhash(const unsigned char *password,unsigned char *lmhash);
-void lrad_mschap(const unsigned char *win_password,
- const unsigned char *challenge, unsigned char *response);
-
-
/* crypt wrapper from crypt.c */
int lrad_crypt_check(const char *key, const char *salt);
+/* rbtree.c */
+typedef struct rbtree_t rbtree_t;
+typedef struct rbnode_t rbnode_t;
+
+rbtree_t *rbtree_create(int (*Compare)(const void *, const void *),
+ void (*freeNode)(void *),
+ int replace_flag);
+void rbtree_free(rbtree_t *tree);
+int rbtree_insert(rbtree_t *tree, const void *Data);
+void rbtree_delete(rbtree_t *tree, rbnode_t *Z);
+int rbtree_deletebydata(rbtree_t *tree, const void *data);
+rbnode_t *rbtree_find(rbtree_t *tree, const void *Data);
+void *rbtree_finddata(rbtree_t *tree, const void *Data);
+int rbtree_num_elements(rbtree_t *tree);
+void *rbtree_node2data(rbtree_t *tree, rbnode_t *node);
+
+/* callback order for walking */
+typedef enum { PreOrder, InOrder, PostOrder } RBTREE_ORDER;
+
+/*
+ * The callback should be declared as:
+ * int callback(void *context, void *data)
+ *
+ * The "context" is some user-defined context.
+ * The "data" is the pointer to the user data in the node,
+ * NOT the node itself.
+ *
+ * It should return 0 if all is OK, and !0 for any error.
+ * The walking will stop on any error.
+ */
+int rbtree_walk(rbtree_t *tree, RBTREE_ORDER order, int (*callback)(void *, void *), void *context);
+
#endif /*LIBRADIUS_H*/