sst_mi.c

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2008 SOMA Networks, Inc.
00005  * Written By Ovidiu Sas (osas)
00006  *
00007  * This file is part of SIP-router, a free SIP server.
00008  *
00009  * SIP-router is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * SIP-router is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022  * USA
00023  *
00024  * History:
00025  * --------
00026  * 2008-04-11 initial version (osas)
00027  */
00028 
00037 #include "../../ut.h"
00038 #include "../../lib/kmi/mi.h"
00039 #include "../dialog/dlg_load.h"
00040 #include "sst_handlers.h"
00041 
00045 void sst_dialog_mi_context_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params)
00046 {
00047         struct mi_node* parent_node = (struct mi_node*)(params->dlg_data);
00048         struct mi_node* node;
00049         struct mi_attr* attr;
00050         sst_info_t* sst_info = (sst_info_t*)*(params->param);
00051         char* p;
00052         int len;
00053 
00054         node = add_mi_node_child(parent_node, 0, "sst", 3, NULL, 0);
00055         if (node==NULL) {
00056                 LM_ERR("oom\n");
00057                 return;
00058         }
00059 
00060         p = int2str((unsigned long)(sst_info->requester), &len);
00061         attr = add_mi_attr(node, MI_DUP_VALUE, "requester_flags", 15, p, len);
00062         if(attr == NULL) {
00063                 LM_ERR("oom requester_flags\n");
00064                 return;
00065         }
00066 
00067         p = int2str((unsigned long)(sst_info->supported), &len);
00068         attr = add_mi_attr(node, MI_DUP_VALUE, "supported_flags", 15, p, len);
00069         if(attr == NULL) {
00070                 LM_ERR("oom supported_flags\n");
00071                 return;
00072         }
00073 
00074         p = int2str((unsigned long)(sst_info->interval), &len);
00075         attr = add_mi_attr(node, MI_DUP_VALUE, "interval", 8, p, len);
00076         if(attr == NULL) {
00077                 LM_ERR("oom interval\n");
00078                 return;
00079         }
00080 
00081         return;
00082 }