]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/radiusclient/include/radiusclient.h
add rc_avpair_copy() and use it when sending user-specified av's. This
[ppp.git] / pppd / plugins / radius / radiusclient / include / radiusclient.h
index f5183fcf07dc25dca3e924898dbfb28605fe8457..9ce2a39e001465a760833653d87691b04139f9f8 100644 (file)
@@ -1,15 +1,15 @@
 /*
- * $Id: radiusclient.h,v 1.1 2002/01/22 16:03:01 dfs Exp $
+ * $Id: radiusclient.h,v 1.9 2002/11/13 18:19:26 fcusack Exp $
  *
  * Copyright (C) 1995,1996,1997,1998 Lars Fenneberg
  *
  * Copyright 1992 Livingston Enterprises, Inc.
  *
- * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan 
+ * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
  * and Merit Network, Inc. All Rights Reserved
  *
- * See the file COPYRIGHT for the respective terms and conditions. 
- * If the file is missing contact me at lf@elemental.net 
+ * See the file COPYRIGHT for the respective terms and conditions.
+ * If the file is missing contact me at lf@elemental.net
  * and I'll send you a copy.
  *
  */
 # define __P(protos) ()
 #endif
 
+#ifndef _UINT4_T
+#ifdef _LP64
+typedef unsigned int UINT4;
+typedef int          INT4;
+#else
 typedef unsigned long UINT4;
-typedef long         INT4;
+typedef long          INT4;
+#endif
+#endif
 
 #define AUTH_VECTOR_LEN                16
 #define AUTH_PASS_LEN          (3 * 16) /* multiple of 16 */
@@ -67,7 +74,7 @@ typedef long        INT4;
 typedef struct server {
        int max;
        char *name[SERVER_MAX];
-       unsigned short port[SERVER_MAX];        
+       unsigned short port[SERVER_MAX];
 } SERVER;
 
 typedef struct pw_auth_hdr
@@ -83,8 +90,8 @@ typedef struct pw_auth_hdr
 #define MAX_SECRET_LENGTH              (3 * 16) /* MUST be multiple of 16 */
 #define CHAP_VALUE_LENGTH              16
 
-#define PW_AUTH_UDP_PORT               1645
-#define PW_ACCT_UDP_PORT               1646
+#define PW_AUTH_UDP_PORT               1812
+#define PW_ACCT_UDP_PORT               1813
 
 #define PW_TYPE_STRING                 0
 #define PW_TYPE_INTEGER                        1
@@ -154,6 +161,18 @@ typedef struct pw_auth_hdr
 #define        PW_PORT_LIMIT                   62      /* integer */
 #define PW_LOGIN_LAT_PORT               63      /* string */
 
+/* Vendor RADIUS attribute-value pairs */
+#define PW_MS_CHAP_CHALLENGE           11      /* string */
+#define PW_MS_CHAP_RESPONSE            1       /* string */
+#define PW_MS_CHAP2_RESPONSE           25      /* string */
+#define PW_MS_CHAP2_SUCCESS            26      /* string */
+#define PW_MS_MPPE_ENCRYPTION_POLICY   7       /* string */
+#define PW_MS_MPPE_ENCRYPTION_TYPE     8       /* string */
+#define PW_MS_MPPE_ENCRYPTION_TYPES PW_MS_MPPE_ENCRYPTION_TYPE
+#define PW_MS_CHAP_MPPE_KEYS           12      /* string */
+#define PW_MS_MPPE_SEND_KEY            16      /* string */
+#define PW_MS_MPPE_RECV_KEY            17      /* string */
+
 /*     Accounting */
 
 #define        PW_ACCT_STATUS_TYPE             40      /* integer */
@@ -169,11 +188,19 @@ typedef struct pw_auth_hdr
 #define PW_ACCT_MULTI_SESSION_ID       50      /* string */
 #define PW_ACCT_LINK_COUNT             51      /* integer */
 
+/* From RFC 2869 */
+#define PW_ACCT_INTERIM_INTERVAL        85     /* integer */
+
 /*     Merit Experimental Extensions */
 
 #define PW_USER_ID                      222     /* string */
 #define PW_USER_REALM                   223     /* string */
 
+
+/*      Session limits */
+#define PW_SESSION_OCTETS_LIMIT                227    /* integer */
+#define PW_OCTETS_DIRECTION            228    /* integer */
+
 /*     Integer Translations */
 
 /*     SERVICE TYPES   */
@@ -260,7 +287,7 @@ typedef struct pw_auth_hdr
 #define PW_CALLBACK             16
 #define PW_USER_ERROR           17
 #define PW_HOST_REQUEST         18
+
 /*     NAS PORT TYPES    */
 
 #define PW_ASYNC               0
@@ -275,8 +302,16 @@ typedef struct pw_auth_hdr
 #define PW_LOCAL       2
 #define PW_REMOTE      3
 
+/*    Session-Octets-Limit    */
+#define PW_OCTETS_DIRECTION_SUM        0
+#define PW_OCTETS_DIRECTION_IN 1
+#define PW_OCTETS_DIRECTION_OUT        2
+#define PW_OCTETS_DIRECTION_MAX        3
+
+
 /* Vendor codes */
 #define VENDOR_NONE     (-1)
+#define VENDOR_MICROSOFT       311
 
 /* Server data structures */
 
@@ -285,7 +320,7 @@ typedef struct dict_attr
        char              name[NAME_LENGTH + 1];        /* attribute name */
        int               value;                        /* attribute index */
        int               type;                         /* string, int, etc. */
-        int               vendorcode;                   /* vendor code */
+       int               vendorcode;                   /* vendor code */
        struct dict_attr *next;
 } DICT_ATTR;
 
@@ -309,17 +344,17 @@ typedef struct value_pair
 {
        char               name[NAME_LENGTH + 1];
        int                attribute;
-        int                vendorcode;
+       int                vendorcode;
        int                type;
        UINT4              lvalue;
-       char               strvalue[AUTH_STRING_LEN + 1];
+       u_char             strvalue[AUTH_STRING_LEN + 1];
        struct value_pair *next;
 } VALUE_PAIR;
 
 /* don't change this, as it has to be the same as in the Merit radiusd code */
 #define MGMT_POLL_SECRET       "Hardlyasecret"
 
-/*     Define return codes from "SendServer" utility */
+/*     Define return codes from "SendServer" utility */
 
 #define BADRESP_RC     -2
 #define ERROR_RC       -1
@@ -338,6 +373,12 @@ typedef struct send_data /* Used to pass information to sendserver() function */
        VALUE_PAIR     *receive_pairs;  /* Where to place received a/v pairs */
 } SEND_DATA;
 
+typedef struct request_info
+{
+       char            secret[MAX_SECRET_LENGTH + 1];
+       u_char          request_vector[AUTH_VECTOR_LEN];
+} REQUEST_INFO;
+
 #ifndef MIN
 #define MIN(a, b)     ((a) < (b) ? (a) : (b))
 #endif
@@ -368,6 +409,7 @@ int rc_avpair_assign __P((VALUE_PAIR *, void *, int));
 VALUE_PAIR *rc_avpair_new __P((int, void *, int, int));
 VALUE_PAIR *rc_avpair_gen __P((AUTH_HDR *));
 VALUE_PAIR *rc_avpair_get __P((VALUE_PAIR *, UINT4));
+VALUE_PAIR *rc_avpair_copy __P((VALUE_PAIR *));
 void rc_avpair_insert __P((VALUE_PAIR **, VALUE_PAIR *, VALUE_PAIR *));
 void rc_avpair_free __P((VALUE_PAIR *));
 int rc_avpair_parse __P((char *, VALUE_PAIR **));
@@ -378,9 +420,12 @@ VALUE_PAIR *rc_avpair_readin __P((FILE *));
 
 void rc_buildreq __P((SEND_DATA *, int, char *, unsigned short, int, int));
 unsigned char rc_get_seqnbr __P((void));
-int rc_auth __P((UINT4, VALUE_PAIR *, VALUE_PAIR **, char *));
+int rc_auth __P((UINT4, VALUE_PAIR *, VALUE_PAIR **, char *, REQUEST_INFO *));
+int rc_auth_using_server __P((SERVER *, UINT4, VALUE_PAIR *, VALUE_PAIR **,
+                             char *, REQUEST_INFO *));
 int rc_auth_proxy __P((VALUE_PAIR *, VALUE_PAIR **, char *));
 int rc_acct __P((UINT4, VALUE_PAIR *));
+int rc_acct_using_server __P((SERVER *, UINT4, VALUE_PAIR *));
 int rc_acct_proxy __P((VALUE_PAIR *));
 int rc_check __P((char *, unsigned short, char *));
 
@@ -424,7 +469,7 @@ void rc_log __P((int, const char *, ...));
 
 /*     sendserver.c            */
 
-int rc_send_server __P((SEND_DATA *, char *));
+int rc_send_server __P((SEND_DATA *, char *, REQUEST_INFO *));
 
 /*     util.c                  */