Annotation of embedaddon/mpd/src/radius.h, revision 1.1
1.1 ! misho 1: /*
! 2: * See ``COPYRIGHT.mpd''
! 3: *
! 4: * $Id: radius.h,v 1.44 2011/08/30 11:47:02 dmitryluhtionov Exp $
! 5: *
! 6: */
! 7:
! 8: #ifdef CCP_MPPC
! 9: #include <netgraph/ng_mppc.h>
! 10: #endif
! 11: #include <radlib.h>
! 12:
! 13: #include <net/if.h>
! 14: #include <net/if_types.h>
! 15:
! 16: #include "iface.h"
! 17:
! 18: #ifndef _RADIUS_H_
! 19: #define _RADIUS_H_
! 20:
! 21: /*
! 22: * DEFINITIONS
! 23: */
! 24:
! 25: #define RADIUS_CHAP 1
! 26: #define RADIUS_PAP 2
! 27: #define RADIUS_EAP 3
! 28: #define RADIUS_MAX_SERVERS 10
! 29:
! 30: #ifndef RAD_UPDATE
! 31: #define RAD_UPDATE 3
! 32: #endif
! 33:
! 34: #ifndef RAD_ACCT_INPUT_GIGAWORDS
! 35: #define RAD_ACCT_INPUT_GIGAWORDS 52
! 36: #endif
! 37:
! 38: #ifndef RAD_ACCT_OUTPUT_GIGAWORDS
! 39: #define RAD_ACCT_OUTPUT_GIGAWORDS 53
! 40: #endif
! 41:
! 42: #ifndef RAD_TUNNEL_TYPE
! 43: #define RAD_TUNNEL_TYPE 64
! 44: #endif
! 45:
! 46: #ifndef RAD_TUNNEL_MEDIUM_TYPE
! 47: #define RAD_TUNNEL_MEDIUM_TYPE 65
! 48: #endif
! 49:
! 50: #ifndef RAD_TUNNEL_CLIENT_ENDPOINT
! 51: #define RAD_TUNNEL_CLIENT_ENDPOINT 66
! 52: #endif
! 53:
! 54: #ifndef RAD_TUNNEL_SERVER_ENDPOINT
! 55: #define RAD_TUNNEL_SERVER_ENDPOINT 67
! 56: #endif
! 57:
! 58: #ifndef RAD_EAP_MESSAGE
! 59: #define RAD_EAP_MESSAGE 79
! 60: #endif
! 61:
! 62: #ifndef RAD_MESSAGE_AUTHENTIC
! 63: #define RAD_MESSAGE_AUTHENTIC 80
! 64: #endif
! 65:
! 66: #ifndef RAD_ACCT_INTERIM_INTERVAL
! 67: #define RAD_ACCT_INTERIM_INTERVAL 85
! 68: #endif
! 69:
! 70: #ifndef RAD_NAS_PORT_ID
! 71: #define RAD_NAS_PORT_ID 87
! 72: #endif
! 73:
! 74: #ifndef RAD_FRAMED_POOL
! 75: #define RAD_FRAMED_POOL 88
! 76: #endif
! 77:
! 78: #ifndef RAD_TUNNEL_CLIENT_AUTH_ID
! 79: #define RAD_TUNNEL_CLIENT_AUTH_ID 90
! 80: #endif
! 81:
! 82: #ifndef RAD_TUNNEL_SERVER_AUTH_ID
! 83: #define RAD_TUNNEL_SERVER_AUTH_ID 91
! 84: #endif
! 85:
! 86: #ifndef RAD_MAX_ATTR_LEN
! 87: #define RAD_MAX_ATTR_LEN 253
! 88: #endif
! 89:
! 90: /* for mppe-keys */
! 91: #define AUTH_LEN 16
! 92: #define SALT_LEN 2
! 93:
! 94: /* max. length of RAD_ACCT_SESSION_ID, RAD_ACCT_MULTI_SESSION_ID */
! 95: #define RAD_ACCT_MAX_SESSIONID 256
! 96:
! 97: #define RAD_VENDOR_MPD 12341
! 98: #define RAD_MPD_RULE 1
! 99: #define RAD_MPD_PIPE 2
! 100: #define RAD_MPD_QUEUE 3
! 101: #define RAD_MPD_TABLE 4
! 102: #define RAD_MPD_TABLE_STATIC 5
! 103: #define RAD_MPD_FILTER 6
! 104: #define RAD_MPD_LIMIT 7
! 105: #define RAD_MPD_INPUT_OCTETS 8
! 106: #define RAD_MPD_INPUT_PACKETS 9
! 107: #define RAD_MPD_OUTPUT_OCTETS 10
! 108: #define RAD_MPD_OUTPUT_PACKETS 11
! 109: #define RAD_MPD_LINK 12
! 110: #define RAD_MPD_BUNDLE 13
! 111: #define RAD_MPD_IFACE 14
! 112: #define RAD_MPD_IFACE_INDEX 15
! 113: #define RAD_MPD_INPUT_ACCT 16
! 114: #define RAD_MPD_OUTPUT_ACCT 17
! 115: #define RAD_MPD_ACTION 18
! 116: #define RAD_MPD_PEER_IDENT 19
! 117: #define RAD_MPD_IFACE_NAME 20
! 118: #define RAD_MPD_IFACE_DESCR 21
! 119: #define RAD_MPD_IFACE_GROUP 22
! 120: #define RAD_MPD_DROP_USER 154
! 121:
! 122: /* Configuration options */
! 123: enum {
! 124: RADIUS_CONF_MESSAGE_AUTHENTIC
! 125: };
! 126:
! 127: extern const struct cmdtab RadiusSetCmds[];
! 128:
! 129: /* Configuration for a radius server */
! 130: struct radiusserver_conf {
! 131: char *hostname;
! 132: char *sharedsecret;
! 133: in_port_t auth_port;
! 134: in_port_t acct_port;
! 135: struct radiusserver_conf *next;
! 136: };
! 137: typedef struct radiusserver_conf *RadServe_Conf;
! 138:
! 139: struct radiusconf {
! 140: int radius_timeout;
! 141: int radius_retries;
! 142: struct in_addr radius_me;
! 143: struct u_addr radius_mev6;
! 144: char *identifier;
! 145: char *file;
! 146: struct radiusserver_conf *server;
! 147: struct optinfo options; /* Configured options */
! 148: };
! 149: typedef struct radiusconf *RadConf;
! 150:
! 151: struct rad_chapvalue {
! 152: u_char ident;
! 153: u_char response[CHAP_MAX_VAL];
! 154: };
! 155:
! 156: struct rad_mschapvalue {
! 157: u_char ident;
! 158: u_char flags;
! 159: u_char lm_response[24];
! 160: u_char nt_response[24];
! 161: };
! 162:
! 163: struct rad_mschapv2value {
! 164: u_char ident;
! 165: u_char flags;
! 166: u_char pchallenge[16];
! 167: u_char reserved[8];
! 168: u_char response[24];
! 169: };
! 170:
! 171: struct authdata;
! 172:
! 173: /*
! 174: * FUNCTIONS
! 175: */
! 176:
! 177: extern void RadiusInit(Link l);
! 178: extern int RadiusAuthenticate(struct authdata *auth);
! 179: extern int RadiusAccount(struct authdata *auth);
! 180: extern void RadiusClose(struct authdata *auth);
! 181: extern void RadiusEapProxy(void *arg);
! 182: extern int RadStat(Context ctx, int ac, char *av[], void *arg);
! 183:
! 184: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>