#define WITH_TCP (1)
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define EAP_START 2
#define AUTH_VECTOR_LEN 16
#define CHAP_VALUE_LENGTH 16
#define MAX_STRING_LEN 254 /* RFC2138: string 0-253 octets */
-
-# define VENDOR(x) ((x >> 16) & 0xffff)
+#define FR_MAX_VENDOR (1 << 24) /* RFC limitations */
#ifdef _LIBRADIUS
# define AUTH_HDR_LEN 20
unsigned int has_tlv : 1; /* has sub attributes */
unsigned int is_tlv : 1; /* is a sub attribute */
unsigned int encoded : 1; /* has been put into packet */
+ unsigned int extended : 1; /* extended attribute */
+ unsigned int extended_flags : 1; /* with flag */
int8_t tag; /* tag for tunneled attributes */
uint8_t encrypt; /* encryption method */
+ uint8_t length;
} ATTR_FLAGS;
/*
typedef struct dict_value {
unsigned int attr;
+ unsigned int vendor;
int value;
char name[1];
} DICT_VALUE;
typedef struct dict_vendor {
int vendorpec;
- int type; /* length of type data */
- int length; /* length of length data */
- int flags;
+ size_t type; /* length of type data */
+ size_t length; /* length of length data */
+ size_t flags;
char name[1];
} DICT_VENDOR;
typedef struct value_pair {
const char *name;
- int attribute;
- int vendor;
+ unsigned int attribute;
+ unsigned int vendor;
int type;
size_t length; /* of data */
+#ifdef __cplusplus
+ /*
+ * C++ hackery. The server and modules are all C, so
+ * the defs here don't affect them. But any C++ code
+ * gets excited over "operator", so we change the name.
+ */
+ FR_TOKEN op_token;
+#else
FR_TOKEN operator;
+#endif
ATTR_FLAGS flags;
struct value_pair *next;
uint32_t lvalue;
struct in_addr ip4addr;
struct in6_addr ip6addr; /* maybe defined in missing.h */
} ipaddr;
+ uint32_t scope; /* for IPv6 */
} fr_ipaddr_t;
/*
char *out, size_t outlen);
int vp_prints_value(char *out, size_t outlen,
VALUE_PAIR *vp, int delimitst);
-const char *vp_print_name(char *buffer, size_t bufsize, int attr);
+const char *vp_print_name(char *buffer, size_t bufsize, int attr, int vendor);
int vp_prints(char *out, size_t outlen, VALUE_PAIR *vp);
void vp_print(FILE *, VALUE_PAIR *);
void vp_printlist(FILE *, VALUE_PAIR *);
* Dictionary functions.
*/
int dict_addvendor(const char *name, int value);
-int dict_addattr(const char *name, int vendor, int type, int value, ATTR_FLAGS flags);
+int dict_addattr(const char *name, int attr, int vendor, int type, ATTR_FLAGS flags);
int dict_addvalue(const char *namestr, const char *attrstr, int value);
int dict_init(const char *dir, const char *fn);
void dict_free(void);
-DICT_ATTR *dict_attrbyvalue(unsigned int attr);
+DICT_ATTR *dict_attrbyvalue(unsigned int attr, unsigned int vendor);
DICT_ATTR *dict_attrbyname(const char *attr);
-DICT_VALUE *dict_valbyattr(unsigned int attr, int val);
-DICT_VALUE *dict_valbyname(unsigned int attr, const char *val);
+DICT_VALUE *dict_valbyattr(unsigned int attr, unsigned int vendor, int val);
+DICT_VALUE *dict_valbyname(unsigned int attr, unsigned int vendor, const char *val);
int dict_vendorbyname(const char *name);
DICT_VENDOR *dict_vendorbyvalue(int vendor);
int rad_chap_encode(RADIUS_PACKET *packet, uint8_t *output,
int id, VALUE_PAIR *password);
VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
- const char *secret, int attribute, int length,
- const uint8_t *data);
+ const char *secret, int attribute, int vendor,
+ int length, const uint8_t *data);
int rad_vp2attr(const RADIUS_PACKET *packet,
const RADIUS_PACKET *original, const char *secret,
- const VALUE_PAIR *vp, uint8_t *ptr);
+ const VALUE_PAIR *vp, uint8_t *ptr, size_t room);
/* valuepair.c */
VALUE_PAIR *pairalloc(DICT_ATTR *da);
-VALUE_PAIR *paircreate(int attr, int type);
+VALUE_PAIR *paircreate_raw(int attr, int vendor, int type, VALUE_PAIR *);
+VALUE_PAIR *paircreate(int attr, int vendor, int type);
void pairfree(VALUE_PAIR **);
void pairbasicfree(VALUE_PAIR *pair);
-VALUE_PAIR *pairfind(VALUE_PAIR *, int);
-void pairdelete(VALUE_PAIR **, int);
+VALUE_PAIR *pairfind(VALUE_PAIR *, unsigned int attr, unsigned int vendor);
+void pairdelete(VALUE_PAIR **, unsigned int attr, unsigned int vendor);
void pairadd(VALUE_PAIR **, VALUE_PAIR *);
void pairreplace(VALUE_PAIR **first, VALUE_PAIR *add);
int paircmp(VALUE_PAIR *check, VALUE_PAIR *data);
VALUE_PAIR *paircopyvp(const VALUE_PAIR *vp);
VALUE_PAIR *paircopy(VALUE_PAIR *vp);
-VALUE_PAIR *paircopy2(VALUE_PAIR *vp, int attr);
+VALUE_PAIR *paircopy2(VALUE_PAIR *vp, unsigned int attr, unsigned int vendor);
void pairmove(VALUE_PAIR **to, VALUE_PAIR **from);
-void pairmove2(VALUE_PAIR **to, VALUE_PAIR **from, int attr);
+void pairmove2(VALUE_PAIR **to, VALUE_PAIR **from, unsigned int attr, unsigned int vendor);
VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value);
VALUE_PAIR *pairmake(const char *attribute, const char *value, int operator);
VALUE_PAIR *pairread(const char **ptr, FR_TOKEN *eol);
void *fr_fifo_peek(fr_fifo_t *fi);
int fr_fifo_num_elements(fr_fifo_t *fi);
+#ifdef __cplusplus
+}
+#endif
+
#include <freeradius-devel/packet.h>
#ifdef WITH_TCP