• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

rad_dict.h

00001 /*
00002  * Include file for RADIUS
00003  *
00004  * Copyright (C) 2001-2003 FhG FOKUS
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 /*
00029  * WARNING: Don't forget to update sip_router/etc/dictionary.sip-router if you 
00030  * update this file !
00031  */
00032 
00033 #ifndef _RAD_DICT_H
00034 #define _RAD_DICT_H
00035 
00036 struct attr {
00037         const char *n;
00038         int v;
00039 };
00040 
00041 struct val {
00042         const char *n;
00043         int v;
00044 };
00045 
00046 typedef enum rad_attr {
00047              /* Standard attributes according to RFC2865 and RFC2866 */
00048         A_USER_NAME = 0,
00049         A_NAS_IP_ADDRESS,
00050         A_NAS_PORT,
00051         A_SERVICE_TYPE,
00052         A_CALLED_STATION_ID,
00053         A_CALLING_STATION_ID,
00054         A_ACCT_STATUS_TYPE,
00055         A_ACCT_SESSION_ID,
00056         A_ACCT_SESSION_TIME,
00057 
00058              /* Attributes according to draft-schulzrinne-sipping-radius-accounting-00 */
00059         A_SIP_METHOD,
00060         A_SIP_RESPONSE_CODE,
00061         A_SIP_CSEQ,
00062         A_SIP_TO_TAG,
00063         A_SIP_FROM_TAG,
00064         A_SIP_BRANCH_ID,
00065         A_SIP_TRANSLATED_REQUEST_ID,
00066         A_SIP_SOURCE_IP_ADDRESS,
00067         A_SIP_SOURCE_PORT,
00068         
00069              /* Attributes according to draft-sterman-aaa-sip-00 */
00070         A_DIGEST_RESPONSE,
00071         A_DIGEST_REALM,
00072         A_DIGEST_NONCE,
00073         A_DIGEST_METHOD,
00074         A_DIGEST_URI,
00075         A_DIGEST_QOP,
00076         A_DIGEST_ALGORITHM,
00077         A_DIGEST_BODY_DIGEST,
00078         A_DIGEST_CNONCE,
00079         A_DIGEST_NONCE_COUNT,
00080         A_DIGEST_USER_NAME,
00081 
00082              /* To be deprecated in the future */
00083 
00084              /* SER-specific attributes */
00085         A_SER_FROM,
00086         A_SER_FLAGS,
00087         A_SER_ORIGINAL_REQUEST_ID,
00088         A_SER_TO,
00089         A_SER_DIGEST_USERNAME,
00090         A_SER_DIGEST_REALM,
00091         A_SER_REQUEST_TIMESTAMP,
00092         A_SER_TO_DID,
00093         A_SER_FROM_UID,
00094         A_SER_FROM_DID,
00095         A_SER_TO_UID,
00096         A_SER_RESPONSE_TIMESTAMP,
00097         A_SER_ATTR,
00098         A_SER_SERVICE_TYPE,
00099         A_SER_DID,
00100         A_SER_UID,
00101         A_SER_DOMAIN,
00102         A_SER_URI_USER,
00103         A_SER_URI_SCHEME,
00104         A_SER_SERVER_ID,
00105 
00106              /* CISCO Vendor Specific Attributes */
00107         A_CISCO_AVPAIR,
00108         A_MAX
00109 } rad_attr_t;
00110 
00111 
00112 typedef enum rad_val {
00113          /* Acct-Status-Type */
00114         V_START = 0,
00115         V_STOP,
00116         V_INTERIM_UPDATE,
00117         V_FAILED,
00118 
00119              /* Service-Type */
00120         V_SIP_SESSION,
00121         V_CALL_CHECK,
00122 
00123              /* SER-Service-Type */
00124         V_GET_URI_ATTRS,
00125         V_GET_USER_ATTRS,
00126         V_DIGEST_AUTHENTICATION,
00127         V_GET_DOMAIN_ATTRS,
00128         V_GET_GLOBAL_ATTRS,
00129         V_LOOKUP_DOMAIN,
00130 
00131         V_MAX
00132 } rad_val_t;
00133 
00134 
00135 /*
00136  * Search the RADIUS dictionary for codes of all attributes
00137  * and values defined above
00138  */
00139 #define INIT_AV(rh, at, vl, fn, e1, e2)                                 \
00140 {                                                                       \
00141         int i;                                                          \
00142         DICT_ATTR *da;                                                  \
00143         DICT_VALUE *dv;                                                 \
00144                                                                         \
00145         for (i = 0; i < A_MAX; i++) {                                   \
00146                 if (at[i].n == NULL)                                    \
00147                         continue;                                       \
00148                 da = rc_dict_findattr(rh, at[i].n);                     \
00149                 if (da == NULL) {                                       \
00150                         LOG(L_ERR, "ERROR: %s: can't get code for the " \
00151                                    "%s attribute\n", fn, at[i].n);      \
00152                         return e1;                                      \
00153                 }                                                       \
00154                 at[i].v = da->value;                                    \
00155         }                                                               \
00156         for (i = 0; i < V_MAX; i++) {                                   \
00157                 if (vl[i].n == NULL)                                    \
00158                         continue;                                       \
00159                 dv = rc_dict_findval(rh, vl[i].n);                      \
00160                 if (dv == NULL) {                                       \
00161                         LOG(L_ERR, "ERROR: %s: can't get code for the " \
00162                                    "%s attribute value\n", fn, vl[i].n);\
00163                         return e2;                                      \
00164                 }                                                       \
00165                 vl[i].v = dv->value;                                    \
00166         }                                                               \
00167 }
00168 
00169 #endif /* _RAD_DICT_H */

Generated on Tue May 22 2012 13:10:13 for SIP Router by  doxygen 1.7.1