Просмотр исходного кода

modules/cdp: added class of auth session to know more info about auth session
- for example: ims_qos can now report Rx session for Reg or for media
- useful for reporting CDP session and which class they belong to

jaybeepee 10 лет назад
Родитель
Сommit
1112649ba7
3 измененных файлов с 20 добавлено и 5 удалено
  1. 4 2
      modules/cdp/session.c
  2. 10 3
      modules/cdp/session.h
  3. 6 0
      modules/ims_qos/mod.c

+ 4 - 2
modules/cdp/session.c

@@ -403,12 +403,13 @@ void cdp_sessions_log()
 			switch (x->type){
 				case AUTH_CLIENT_STATEFULL:
 				case AUTH_SERVER_STATEFULL:
-					LM_DBG(ANSI_GRAY"\tAuth State [%d] Timeout [%d] Lifetime [%d] Grace [%d] Generic [%p]\n",
+					LM_DBG(ANSI_GRAY"\tAuth State [%d] Timeout [%d] Lifetime [%d] Grace [%d] Generic [%p] Class [%d]\n",
 							x->u.auth.state,
 							(int)(x->u.auth.timeout-time(0)),
 							x->u.auth.lifetime?(int)(x->u.auth.lifetime-time(0)):-1,
 							(int)(x->u.auth.grace_period),
-							x->u.auth.generic_data);
+							x->u.auth.generic_data, 
+                                                        x->u.auth.class);
 					break;
 				case ACCT_CC_CLIENT:
 					LM_DBG(ANSI_GRAY"\tCCAcct State [%d] Charging Active [%c (%d)s] Reserved Units(valid=%ds) [%d] Generic [%p]\n",
@@ -585,6 +586,7 @@ AAASession* cdp_new_auth_session(str id,int is_client,int is_statefull)
 		s->u.auth.timeout=time(0)+config->default_auth_session_timeout;
 		s->u.auth.lifetime=0;
 		s->u.auth.grace_period=0;
+                s->u.auth.class = AUTH_CLASS_UNKNOWN;
 		cdp_add_session(s);
 	}
 	return s;

+ 10 - 3
modules/cdp/session.h

@@ -110,13 +110,20 @@ typedef enum {
 	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_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 	*/
+	time_t grace_period;            /**< grace_period in seconds 	*/
 	void* generic_data;
 } cdp_auth_session_t;
 

+ 6 - 0
modules/ims_qos/mod.c

@@ -358,6 +358,10 @@ void callback_dialog(struct dlg_cell* dlg, int type, struct dlg_cb_params * para
     int new_has_video = 0;
     int must_unlock_aaa = 1;
     
+    if (rx_session_id==0) {
+        LM_WARN("Strange... no rx session ID in callback.... why?\n");
+        return;
+    } 
     //getting session data
     
     LM_DBG("Dialog callback of type %d received\n", type);
@@ -857,6 +861,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int
             }
             goto error;
         }
+        auth_session->u.auth.class = AUTH_CLASS_RXMEDIA;
 
         //attach new cdp auth session to dlg for this direction
         if (dlg_direction == DLG_MOBILE_ORIGINATING) {
@@ -1101,6 +1106,7 @@ static int w_rx_aar_register(struct sip_msg *msg, char* route, char* str1, char*
                             lock_release(saved_t_data->lock);
                             goto error;
                         }
+                        auth->u.auth.class = AUTH_CLASS_RXREG;
                     }
 
                     //we are ready to send the AAR async. lets save the local data data