modules_k/auth_diameter/authorize.h

00001 /* 
00002  * $Id$
00003  *
00004  * Digest Authentication - Diameter support
00005  *
00006  * Copyright (C) 2001-2003 FhG Fokus
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  * 
00015  * Kamailio is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software 
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * History:
00025  * -------
00026  *  
00027  *  
00028  */
00029 
00030 #ifndef DIAMETER_AUTHORIZE_H
00031 #define DIAMETER_AUTHORIZE_H
00032 
00033 #include "diameter_msg.h"
00034 #include "../../parser/digest/digest_parser.h"
00035 #include "../../parser/hf.h"
00036 #include "../../pvar.h"
00037 #include "../../str.h"
00038 #include "defs.h"
00039 
00040 typedef enum auth_diam_result {
00041         NONCE_REUSED = -6,  
00042         AUTH_ERROR,         
00043         NO_CREDENTIALS,     
00044         STALE_NONCE,        
00045         INVALID_PASSWORD,   
00046         USER_UNKNOWN,       
00047         ERROR,              
00049         AUTHORIZED,         
00051         DO_AUTHORIZATION,   
00053 } auth_diam_result_t;
00054 
00055 
00056 
00057 int get_uri(struct sip_msg* m, str** uri);
00058 
00059 int get_realm(struct sip_msg* m, int hftype, struct sip_uri* u);
00060 
00061 auth_diam_result_t diam_pre_auth(struct sip_msg* m, str* realm, int hftype, 
00062                                                 struct hdr_field** h);
00063 
00064 int authorize(struct sip_msg* msg, pv_elem_t* realm, int hftype);
00065 
00066 int diameter_authorize(struct hdr_field* cred, str* p_method, 
00067                                         struct sip_uri uri,     struct sip_uri ruri,
00068                                         unsigned int m_id, rd_buf_t *response);
00069 
00070 int srv_response(struct sip_msg* msg, rd_buf_t* rb, int hftype);
00071 
00072 int send_resp(struct sip_msg* _m, int _code, str* _reason,
00073                                         char* _hdr, int _hdr_len);
00074 
00075 #endif /* DIAMETER_AUTHORIZE_H */
00076