home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / radius-2.zip / src / radius.h < prev    next >
C/C++ Source or Header  |  1996-05-14  |  5KB  |  205 lines

  1. /*
  2.  *
  3.  *    RADIUS
  4.  *    Remote Authentication Dial In User Service
  5.  *
  6.  *
  7.  *    Livingston Enterprises, Inc.
  8.  *    6920 Koll Center Parkway
  9.  *    Pleasanton, CA   94566
  10.  *
  11.  *    Copyright 1992 Livingston Enterprises, Inc.
  12.  *
  13.  *    Permission to use, copy, modify, and distribute this software for any
  14.  *    purpose and without fee is hereby granted, provided that this
  15.  *    copyright and permission notice appear on all copies and supporting
  16.  *    documentation, the name of Livingston Enterprises, Inc. not be used
  17.  *    in advertising or publicity pertaining to distribution of the
  18.  *    program without specific prior permission, and notice be given
  19.  *    in supporting documentation that copying and distribution is by
  20.  *    permission of Livingston Enterprises, Inc.   
  21.  *
  22.  *    Livingston Enterprises, Inc. makes no representations about
  23.  *    the suitability of this software for any purpose.  It is
  24.  *    provided "as is" without express or implied warranty.
  25.  *
  26.  */
  27.  
  28. /*
  29.  *    @(#)radius.h    1.9 11/14/94 
  30.  */
  31.  
  32. #include "conf.h"
  33.  
  34. #define AUTH_VECTOR_LEN        16
  35. #define AUTH_PASS_LEN        16
  36. #define AUTH_STRING_LEN        128    /* maximum of 254 */
  37.  
  38.  
  39. typedef struct pw_auth_hdr {
  40.     u_char        code;
  41.     u_char        id;
  42.     u_short        length;
  43.     u_char        vector[AUTH_VECTOR_LEN];
  44.     u_char        data[2];
  45. } AUTH_HDR;
  46.  
  47. #define AUTH_HDR_LEN            20
  48. #define CHAP_VALUE_LENGTH        16
  49.  
  50. #define PW_AUTH_UDP_PORT        1645
  51. #define PW_ACCT_UDP_PORT        1646
  52.  
  53. #define PW_TYPE_STRING            0
  54. #define PW_TYPE_INTEGER            1
  55. #define PW_TYPE_IPADDR            2
  56. #define PW_TYPE_DATE            3
  57.  
  58.  
  59. #define    PW_AUTHENTICATION_REQUEST    1
  60. #define    PW_AUTHENTICATION_ACK        2
  61. #define    PW_AUTHENTICATION_REJECT    3
  62. #define    PW_ACCOUNTING_REQUEST        4
  63. #define    PW_ACCOUNTING_RESPONSE        5
  64. #define    PW_ACCOUNTING_STATUS        6
  65. #define PW_PASSWORD_REQUEST        7
  66. #define PW_PASSWORD_ACK            8
  67. #define PW_PASSWORD_REJECT        9
  68. #define    PW_ACCOUNTING_MESSAGE        10
  69. #define PW_ACCESS_CHALLENGE        11
  70.  
  71. #define    PW_USER_NAME            1
  72. #define    PW_PASSWORD            2
  73. #define    PW_CHAP_PASSWORD        3
  74. #define    PW_CLIENT_ID            4
  75. #define    PW_CLIENT_PORT_ID        5
  76. #define    PW_USER_SERVICE_TYPE        6
  77. #define    PW_FRAMED_PROTOCOL        7
  78. #define    PW_FRAMED_ADDRESS        8
  79. #define    PW_FRAMED_NETMASK        9
  80. #define    PW_FRAMED_ROUTING        10
  81. #define    PW_FRAMED_FILTER_ID        11
  82. #define    PW_FRAMED_MTU            12
  83. #define    PW_FRAMED_COMPRESSION        13
  84. #define    PW_LOGIN_HOST            14
  85. #define    PW_LOGIN_SERVICE        15
  86. #define    PW_LOGIN_TCP_PORT        16
  87. #define PW_OLD_PASSWORD            17
  88. #define PW_PORT_MESSAGE            18
  89. #define PW_DIALBACK_NO            19
  90. #define PW_DIALBACK_NAME        20
  91. #define PW_EXPIRATION            21
  92. #define PW_FRAMED_ROUTE            22
  93. #define PW_FRAMED_IPXNET        23
  94. #define PW_STATE            24
  95.  
  96. #define PW_ACCT_STATUS_TYPE        40
  97. #define PW_ACCT_DELAY_TIME        41
  98. #define PW_ACCT_INPUT_OCTETS        42
  99. #define PW_ACCT_OUTPUT_OCTETS        43
  100. #define PW_ACCT_SESSION_ID        44
  101. #define PW_ACCT_AUTHENTIC        45
  102. #define PW_ACCT_SESSION_TIME        46
  103.  
  104. /*
  105.  *    INTEGER TRANSLATIONS
  106.  */
  107.  
  108. /*    USER TYPES    */
  109.  
  110. #define    PW_LOGIN_USER            1
  111. #define    PW_FRAMED_USER            2
  112. #define    PW_DIALBACK_LOGIN_USER        3
  113. #define    PW_DIALBACK_FRAMED_USER        4
  114.  
  115. /*    FRAMED PROTOCOLS    */
  116.  
  117. #define    PW_PPP                1
  118. #define    PW_SLIP                2
  119.  
  120. /*    FRAMED ROUTING VALUES    */
  121.  
  122. #define    PW_NONE                0
  123. #define    PW_BROADCAST            1
  124. #define    PW_LISTEN            2
  125. #define    PW_BROADCAST_LISTEN        3
  126.  
  127. /*    FRAMED COMPRESSION TYPES    */
  128.  
  129. #define    PW_VAN_JACOBSEN_TCP_IP        1
  130.  
  131. /*    LOGIN SERVICES    */
  132.  
  133. #define    PW_TELNET            0
  134. #define    PW_RLOGIN            1
  135. #define    PW_TCP_CLEAR            2
  136. #define    PW_PORTMASTER            3
  137.  
  138. /*    AUTHENTICATION LEVEL    */
  139.  
  140. #define PW_AUTH_NONE            0
  141. #define PW_AUTH_RADIUS            1
  142. #define PW_AUTH_LOCAL            2
  143.  
  144. /*    STATUS TYPES    */
  145.  
  146. #define PW_STATUS_START            1
  147. #define PW_STATUS_STOP            2
  148. #define PW_STATUS_ALIVE            3
  149.  
  150. /* Default Database File Names */
  151.  
  152. #define RADIUS_DIR      "/mptn/etc/raddb"
  153. #define RADACCT_DIR     "/mptn/etc/radacct"
  154.  
  155. #define RADIUS_DICTIONARY    "dictionary"
  156. #define RADIUS_CLIENTS        "clients"
  157. #define RADIUS_USERS        "users"
  158. #define RADIUS_HOLD        "holdusers"
  159. #define RADIUS_LOG        "logfile"
  160.  
  161. /* Server data structures */
  162.  
  163. typedef struct dict_attr {
  164.     char            name[32];
  165.     int            value;
  166.     int            type;
  167.     struct dict_attr    *next;
  168. } DICT_ATTR;
  169.  
  170. typedef struct dict_value {
  171.     char            attrname[32];
  172.     char            name[32];
  173.     int            value;
  174.     struct dict_value    *next;
  175. } DICT_VALUE;
  176.  
  177. typedef struct value_pair {
  178.     char            name[32];
  179.     int            attribute;
  180.     int            type;
  181.     UINT4            lvalue;
  182.     char            strvalue[AUTH_STRING_LEN];
  183.     struct value_pair    *next;
  184. } VALUE_PAIR;
  185.  
  186. typedef struct auth_req {
  187.     UINT4            ipaddr;
  188.     u_short            udp_port;
  189.     u_char            id;
  190.     u_char            code;
  191.     u_char            vector[16];
  192.     u_char            secret[16];
  193.     VALUE_PAIR        *request;
  194.     int            child_pid;    /* Process ID of child */
  195.     UINT4            timestamp;
  196.     struct auth_req        *next;        /* Next active request */
  197. } AUTH_REQ;
  198.  
  199. #define DEBUG    if(debug_flag)printf
  200.  
  201. #define SECONDS_PER_DAY        86400
  202. #define MAX_REQUEST_TIME    30
  203. #define CLEANUP_DELAY        5
  204. #define MAX_REQUESTS        100
  205.