/* * $Id$ * * Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com * Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com * * The initial version of this code was written by Dragos Vingarzan * (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the * Fruanhofer Institute. It was and still is maintained in a separate * branch of the original SER. We are therefore migrating it to * Kamailio/SR and look forward to maintaining it from here on out. * 2011/2012 Smile Communications, Pty. Ltd. * ported/maintained/improved by * Jason Penton (jason(dot)penton(at)smilecoms.com and * Richard Good (richard(dot)good(at)smilecoms.com) as part of an * effort to add full IMS support to Kamailio/SR using a new and * improved architecture * * NB: Alot of this code was originally part of OpenIMSCore, * FhG Fokus. * Copyright (C) 2004-2006 FhG Fokus * Thanks for great work! This is an effort to * break apart the various CSCF functions into logically separate * components. We hope this will drive wider use. We also feel * that in this way the architecture is more complete and thereby easier * to manage in the Kamailio/SR environment * * This file is part of Kamailio, a free SIP server. * * Kamailio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * Kamailio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __DIAMETER_SESSION_H #define __DIAMETER_SESSION_H //#include "diameter_api.h" #include "utils.h" #include "diameter.h" /** Function for callback on session events: timeout, etc. */ typedef void (AAASessionCallback_f)(int event, void *session); /** Types of sessions */ typedef enum { UNKNOWN_SESSION = 0, AUTH_CLIENT_STATELESS = 1, AUTH_SERVER_STATELESS = 2, AUTH_CLIENT_STATEFULL = 3, AUTH_SERVER_STATEFULL = 4, ACCT_CLIENT_STATELESS = 5, ACCT_CLIENT_STATEFUL = 6, ACCT_SERVER_STATELESS = 7, ACCT_SERVER_STATEFULL = 8, ACCT_CC_CLIENT = 9, /**< Credit Control Client - RFC (4006) */ } cdp_session_type_t; /** auth session states */ typedef enum { AUTH_ST_IDLE, AUTH_ST_PENDING, AUTH_ST_OPEN, AUTH_ST_DISCON } cdp_auth_state; /** auth session event */ typedef enum { AUTH_EV_START =0, AUTH_EV_SEND_REQ =1, AUTH_EV_SEND_ANS =2, AUTH_EV_SEND_ANS_SUCCESS =3, AUTH_EV_SEND_ANS_UNSUCCESS =4, AUTH_EV_RECV_ASR =5, AUTH_EV_RECV_REQ =6, AUTH_EV_RECV_ANS =7, AUTH_EV_RECV_ANS_SUCCESS =8, AUTH_EV_RECV_ANS_UNSUCCESS =9, AUTH_EV_SEND_ASR =10, AUTH_EV_SEND_ASA_SUCCESS =11, AUTH_EV_SEND_ASA_UNSUCCESS =12, AUTH_EV_SEND_STA =13, AUTH_EV_RECV_ASA =14, AUTH_EV_RECV_ASA_SUCCESS =15, AUTH_EV_RECV_ASA_UNSUCCESS =16, AUTH_EV_RECV_STA =17, AUTH_EV_RECV_STR =18, AUTH_EV_SESSION_LIFETIME_TIMEOUT =19, AUTH_EV_SESSION_GRACE_TIMEOUT =20, AUTH_EV_SESSION_TIMEOUT =21, AUTH_EV_SERVICE_TERMINATED =22, AUTH_EV_SESSION_CREATED =23, AUTH_EV_SESSION_MODIFIED =24, AUTH_EV_SESSION_DROP =25, } cdp_auth_event; /** Accounting states definition */ typedef enum { AUTH_CLASS_UNKNOWN = 0, AUTH_CLASS_RXREG = 1, AUTH_CLASS_RXMEDIA = 2 } cdp_auth_session_class_t; /** structure for auth session */ typedef struct _cdp_auth_session_t { cdp_auth_state state; /**< current state */ cdp_auth_session_class_t class; /**< useful to know if this is Rx reg or Rx media for example */ time_t timeout; /**< absolute time for session timeout -1 means forever */ time_t lifetime; /**< absolute time for auth lifetime -1 means forever */ time_t grace_period; /**< grace_period in seconds */ unsigned int last_requested_lifetime; /**< the following 3 timers are used to store what we are */ unsigned int last_requested_timeout; /**