4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
7 * Sooyoung Ha <yoosah.ha@samsung.com>
8 * Sungmin Ha <sungmin82.ha@samsung.com>
9 * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
11 * This library is free software; you can redistribute it and/or modify it under
12 * the terms of the GNU Lesser General Public License as published by the
13 * Free Software Foundation; either version 2.1 of the License, or (at your option)
16 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
17 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 * License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this library; if not, write to the Free Software Foundation, Inc., 51
23 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 #include <glib/gstdio.h>
38 #include "vgsm_call.h"
46 #define ALP_NOTIFY_DATABASE_DIR "./db"
47 #define ALP_NOTIFY_DATABASE_FILE "ss.db"
48 #define ALP_NOTIFY_DATABASE_MODE (S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG)
50 // ----------------------------------------------------------------------------
51 // sqlite3 specific code
52 // ----------------------------------------------------------------------------
57 static int cw_count=0;
59 unsigned int g_cw_entry_count;
60 unsigned int g_cf_entry_count;
61 unsigned int g_cb_entry_count;
71 call_waiting_entry_t g_cw_entry[20];
72 call_barring_entry_t g_cb_entry[20];
73 call_forwarding_entry_t g_cf_entry[20];
74 int g_mo_voice_is_barred = FALSE;
75 int g_mt_voice_is_barred = FALSE;
76 int g_mo_video_is_barred = FALSE;
77 int g_mt_video_is_barred = FALSE;
78 int g_cf_is_activated = FALSE;
79 char* g_cb_pwd="1111";
80 static int g_cb_pwd_fail_count = 0;
84 // callback to handle each row from "SELECT ALL * FROM ss"
85 // where each row is a persistent registration
86 static int vgsm_ss_sqlite_restore_callback(void * ref, int ncol, char ** cols, char ** name)
88 ss_cmd_e_type * type = (ss_cmd_e_type*)ref;
90 log_msg(MSGL_VGSM_INFO,"ncol : %d \n", ncol);
95 call_forwarding_entry_t entry;
96 memset(entry.number, 0, sizeof(entry.number));
98 log_msg(MSGL_VGSM_INFO,"class = %d, type = %d, number = %s(%d), reply time = %d, ss_mode = %d \n", atoi(*cols), atoi(*(cols+1)), *(cols+2), strlen(*(cols+2)), atoi(*(cols+3)), atoi(*(cols+4)));
99 entry.tel_class = atoi(*cols);
100 entry.type = atoi(*(cols+1));
101 memcpy(&entry.number, *(cols+2), strlen(*(cols+2)));
102 entry.replyTime = atoi(*(cols+3));
103 entry.ss_mode = atoi(*(cols+4));
106 set_call_forwarding_entry(&entry, g_cf_entry_count);
111 call_barring_entry_t entry;
113 log_msg(MSGL_VGSM_INFO,"class = %d, type = %d, ss_mode = %d \n", atoi(*cols), atoi(*(cols+1)), atoi(*(cols+2)));
114 entry.tel_class = atoi(*cols);
115 entry.type = atoi(*(cols+1));
116 entry.ss_mode = atoi(*(cols+2));
119 set_call_barring_entry(&entry, g_cb_entry_count);
121 if(entry.tel_class == AT_CALL_SS_CLASS_VIDEO) // video call
123 if(entry.type == SS_CB_TYPE_AB)
125 set_outgoing_video_call_barring_state(entry.ss_mode);
126 set_incoming_video_call_barring_state(entry.ss_mode);
128 else if(entry.type == SS_CB_TYPE_BAOC)
130 set_outgoing_video_call_barring_state(entry.ss_mode);
132 else if(entry.type == SS_CB_TYPE_BAIC)
134 set_incoming_video_call_barring_state(entry.ss_mode);
139 if(entry.type == SS_CB_TYPE_AB)
141 set_outgoing_voice_call_barring_state(entry.ss_mode);
142 set_incoming_voice_call_barring_state(entry.ss_mode);
144 else if(entry.type == SS_CB_TYPE_BAOC)
146 set_outgoing_voice_call_barring_state(entry.ss_mode);
148 else if(entry.type == SS_CB_TYPE_BAIC)
150 set_incoming_voice_call_barring_state(entry.ss_mode);
157 call_waiting_entry_t entry;
158 memset(entry.number, 0, sizeof(entry.number));
160 entry.tel_class = atoi(*cols);
161 entry.ss_mode = atoi(*(cols+1));
162 memcpy(&entry.number, *(cols+2), strlen(*(cols+2)));
163 log_msg(MSGL_VGSM_INFO,"class = %d, ss_mode = %d\n", entry.tel_class, entry.ss_mode);
166 set_call_waiting_entry(&entry, g_cw_entry_count);
171 // should always return zero from the callback
176 // initialize the database
177 // create the ss table
178 static int vgsm_ss_sqlite_init(void)
185 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init\n");
190 //char *dbname = ALP_NOTIFY_DATABASE_DIR "/" ALP_NOTIFY_DATABASE_FILE;
191 //char *directory = ALP_NOTIFY_DATABASE_DIR;
192 char *bin_path = get_bin_path();
193 sprintf(directory,"%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR);
194 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
199 /* make sure database directory exists */
200 if (!g_file_test (directory, G_FILE_TEST_IS_DIR)) {
202 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: directory %s does not exit or is not directory\n", directory);
204 /* check if exists and if so, attempt to remove non-directory */
205 if (g_file_test (directory, G_FILE_TEST_EXISTS)) {
206 if (g_remove (directory) < 0) {
208 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: "
209 "unable to remove %s: %d %s\n",
210 directory, errno, strerror(errno));
217 /* create directory */
218 if (g_mkdir_with_parents (directory, ALP_NOTIFY_DATABASE_MODE) < 0) {
219 /* unable to create directory */
221 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: "
222 "unable to create %s: %d %s\n",
223 directory, errno, strerror(errno));
231 err = sqlite3_open(dbname, &db);
232 if (err != SQLITE_OK) {
233 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: sqlite3_open err=%d\n",err);
238 // create the call forwarding table
239 err = sqlite3_exec(db,"CREATE TABLE forwarding ( class INT , type INT, number TEXT, replytime INT, ss_mode INT)", 0, 0, &mesg);
240 if (err != SQLITE_OK) {
241 //log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init(forwarding): sqlite3_exec err=%d\n",err);
242 sqlite3_exec(db,"DELETE FROM forwarding",0,0,&mesg);
244 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: sqlite3_exec: %s\n",mesg);
247 //goto Done; //Á¸Àç ÇÑ´Ù¸é, ±× ÀÌÈÄ tableÀº ¸ø¸¸µç´Ù. ÀÌ ºÎºÐ »èÁ¦°ËÅä.
250 // create the call barring table
251 err = sqlite3_exec(db,"CREATE TABLE barring ( class INT , type INT, ss_mode INT)", 0, 0, &mesg);
252 if (err != SQLITE_OK) {
253 //log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init(barring): sqlite3_exec err=%d\n",err);
254 sqlite3_exec(db,"DELETE FROM barring",0,0,&mesg);
256 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: sqlite3_exec: %s\n",mesg);
262 // create the call waiting table
263 err = sqlite3_exec(db,"CREATE TABLE waiting ( class INT , ss_mode INT, number TEXT)", 0, 0, &mesg);
264 if (err != SQLITE_OK) {
265 //log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init(waiting): sqlite3_exec err=%d\n",err);
266 sqlite3_exec(db,"DELETE FROM waiting",0,0,&mesg);
268 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_init: sqlite3_exec: %s\n",mesg);
275 // close the database
276 if (db) sqlite3_close(db);
279 return err == SQLITE_OK ? TRUE: err;
282 static int count_callback(void *some_entry, int ncol, char **cols, char **azColName)
284 unsigned char * count;
286 count = (unsigned char *)(some_entry);
295 int vgsm_ss_sqlite_cw_check_exist (int tel_class)
297 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cw_check_exist\n");
300 unsigned char counter = 0;
307 char *bin_path = get_bin_path();
308 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
313 err = sqlite3_open(dbname, &db);
314 if (err != SQLITE_OK) {
316 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cw_check_exist: sqlite3_open err=%d\n", err);
321 sprintf(str, "SELECT * FROM waiting WHERE class = '%d'", tel_class);
323 log_msg(MSGL_VGSM_INFO,"count sql = <%s> \n", str);
325 err = sqlite3_exec(db, str, count_callback, &counter, &mesg);
326 if (err != SQLITE_OK) {
328 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cw_check_exist: sqlite3_exec err=%d\n", err);
332 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cw_check_exist: sqlite3_exec: %s\n", mesg);
343 // close the database
344 if (db) sqlite3_close(db);
349 static int vgsm_ss_sqlite_cb_check_exist (int tel_class, int type)
351 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cb_check_exist\n");
354 unsigned char counter = 0;
362 char *bin_path = get_bin_path();
363 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
368 err = sqlite3_open(dbname, &db);
369 if (err != SQLITE_OK) {
371 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cb_check_exist: sqlite3_open err=%d\n", err);
376 sprintf(str, "SELECT * FROM barring WHERE (class = '%d' AND type = '%d')", tel_class, type);
378 log_msg(MSGL_VGSM_INFO,"count sql = <%s> \n", str);
380 err = sqlite3_exec(db, str, count_callback, &counter, &mesg);
381 if (err != SQLITE_OK) {
383 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cb_check_exist: sqlite3_exec err=%d\n", err);
387 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cb_check_exist: sqlite3_exec: %s\n", mesg);
398 // close the database
399 if (db) sqlite3_close(db);
404 static int vgsm_ss_sqlite_cf_check_exist (int tel_class, int type)
406 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cf_check_exist\n");
409 unsigned char counter = 0;
416 char *bin_path = get_bin_path();
417 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
422 log_msg(MSGL_VGSM_INFO,"check 1 in vgsm_ss_sqlite_cf_check_exist\n");
423 err = sqlite3_open(dbname, &db);
424 log_msg(MSGL_VGSM_INFO,"check 2 in vgsm_ss_sqlite_cf_check_exist\n");
425 if (err != SQLITE_OK) {
427 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cf_check_exist: sqlite3_open err=%d\n", err);
432 sprintf(str, "SELECT * FROM forwarding WHERE (class = '%d' AND type = '%d')", tel_class, type);
434 log_msg(MSGL_VGSM_INFO,"count sql = <%s> \n", str);
436 err = sqlite3_exec(db, str, count_callback, &counter, &mesg);
437 if (err != SQLITE_OK) {
439 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cf_check_exist: sqlite3_exec err=%d\n", err);
443 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_cf_check_exist: sqlite3_exec: %s\n", mesg);
454 // close the database
455 if (db) sqlite3_close(db);
460 // add a new registration to the database
461 // insert a row into the database which contains the registration information
462 static int vgsm_ss_sqlite_add(char * sqlString)
471 #if 0 // - this is for checking sqlString
474 if(fd = open("/root/sql_tmp",O_WRONLY|O_CREAT) == -1)
476 log_msg(MSGL_VGSM_INFO,"err=%d\n","Error opening the file");
477 log_msg(MSGL_VGSM_INFO,"err=%d\n","Error opening the file");
478 log_msg(MSGL_VGSM_INFO,"err=%d\n","Error opening the file");
482 write(fd, sqlString, strlen(*sqlString));
487 sprintf(str, "<ADD>SELECT * FROM waiting WHERE class = '%s'", sqlString);
488 log_msg(MSGL_VGSM_INFO,"count sql = <%s> \n", str);
492 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_add\n");
496 char *bin_path = get_bin_path();
497 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
503 err = sqlite3_open(dbname,&db);
504 if (err != SQLITE_OK) {
506 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_add: sqlite3_open err=%d\n",err);
511 // create the sql string
512 // sprintf(str,"INSERT INTO ss VALUES (%d,%d,%d,'%s')",id, PLMN_status, number_PLMN, ACT);
514 if(sqlString == NULL)
517 log_msg(MSGL_VGSM_INFO," SQL statement : %s\n", sqlString);
520 err = sqlite3_exec(db, sqlString, 0, 0, &mesg);
521 if (err != SQLITE_OK) {
523 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_add: sqlite3_exec err=%d\n",err);
527 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_add: sqlite3_exec: %s\n",mesg);
534 // close the database
535 if (db) sqlite3_close(db);
538 //return err == SQLITE_OK ? TRUE: err;
542 // restore all previously save registrations
543 // select all rows and process each one in the callback
544 static int vgsm_ss_sqlite_restore(ss_cmd_e_type type)
553 char *bin_path = get_bin_path();
554 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
560 err = sqlite3_open(dbname, &db);
561 if (err != SQLITE_OK) {
563 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_restore: sqlite3_open err=%d\n", err);
571 sprintf(str, "SELECT * FROM %s", "forwarding");
574 sprintf(str, "SELECT * FROM %s", "barring");
577 sprintf(str, "SELECT * FROM %s", "waiting");
581 g_cw_entry_count = 0;
582 g_cf_entry_count = 0;
583 g_cb_entry_count = 0;
585 log_msg(MSGL_VGSM_INFO, "%s\n", str);
586 err = sqlite3_exec(db,str, vgsm_ss_sqlite_restore_callback, &type, &mesg);
591 log_msg(MSGL_VGSM_INFO,"<<<<>>>>>cw(%d) cf(%d) cb(%d)\n", g_cw_entry_count, g_cf_entry_count, g_cb_entry_count);
592 if(type == SS_CMD_CW && g_cw_entry_count == 0)
593 set_call_waiting_entry(NULL, 0);
594 if(type == SS_CMD_CF && g_cf_entry_count == 0)
595 set_call_forwarding_entry(NULL, 0);
596 if(type == SS_CMD_CB && g_cb_entry_count == 0)
597 set_call_barring_entry(NULL, 0);
599 if (err != SQLITE_OK) {
600 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_restore: sqlite3_exec err=%d\n", err);
603 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_restore: sqlite3_exec: %s\n", mesg);
611 // close the database
612 if (db) sqlite3_close(db);
618 // remove a registration from the database
619 // delete a row from the database which contains the registration information
620 static int vgsm_ss_sqlite_remove(ss_cmd_e_type type, int tel_class, int ss_type)
628 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_remove\n");
632 char *bin_path = get_bin_path();
633 sprintf(dbname,"%s/%s/%s", bin_path, ALP_NOTIFY_DATABASE_DIR, ALP_NOTIFY_DATABASE_FILE);
639 err = sqlite3_open(dbname,&db);
640 if (err != SQLITE_OK) {
642 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_remove: sqlite3_open err=%d\n",err);
647 // create the sql string
652 //sprintf(str,"DELETE FROM forwarding WHERE (class = '%d' AND type = '%d')", tel_class, ss_type);
653 if(ss_type == SS_CF_TYPE_CF_ALL) // SS_CF_TYPE_CF_ALL
654 sprintf(str,"DELETE FROM forwarding"); // for defect X200001252, set Cancel all in Simulator
655 else if(tel_class == -1 || tel_class == 0x10) // All teleservices
656 sprintf(str,"DELETE FROM forwarding WHERE type = '%d'", ss_type);
658 // sprintf(str,"DELETE FROM forwarding WHERE type = '%d'", ss_type);
659 sprintf(str,"DELETE FROM forwarding WHERE (class = '%d' AND type = '%d')", tel_class, ss_type);
664 //sprintf(str,"DELETE FROM barring WHERE (class = '%d' AND type = '%d')", tel_class, ss_type);
665 sprintf(str,"DELETE FROM barring WHERE type = '%d'", ss_type);
668 sprintf(str,"DELETE FROM waiting WHERE (class = '%d')", tel_class);
672 log_msg(MSGL_VGSM_INFO,"delete sql = <%s> \n", str);
675 err = sqlite3_exec(db, str, 0, 0, &mesg);
676 if (err != SQLITE_OK) {
678 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_remove: sqlite3_exec err=%d\n",err);
682 log_msg(MSGL_VGSM_INFO,"vgsm_ss_sqlite_remove: sqlite3_exec: %s\n",mesg);
689 return vgsm_ss_sqlite_restore(type);
692 // close the database
693 if (db) sqlite3_close(db);
700 static int vgsm_ss_sqlite_make_sql(ss_cmd_e_type type, void * entry)
709 call_forwarding_entry_t * cf_entry = (call_forwarding_entry_t*)entry;
710 log_msg(MSGL_VGSM_INFO, "ss_mode = %d\n", cf_entry->ss_mode);
711 if(vgsm_ss_sqlite_cf_check_exist(cf_entry->tel_class, cf_entry->type))
713 if(cf_entry->ss_mode == SS_MODE_DEREG) // GSM_SS_MODE_DEREG
715 if(cf_entry->type == SS_CF_TYPE_CFU)
717 log_msg(MSGL_VGSM_INFO, "g_cf_is_activated = FALSE\n");
718 g_cf_is_activated = FALSE;
721 return vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, cf_entry->type);
723 else if(cf_entry->ss_mode == SS_MODE_REG && cf_entry->type == SS_CF_TYPE_CFU)
725 log_msg(MSGL_VGSM_INFO, "g_cf_is_activated = TRUE\n");
726 g_cf_is_activated = TRUE;
727 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFB);
728 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRy);
729 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRc);
731 memset(str, '\0', sizeof(str));
732 sprintf(str, "UPDATE forwarding SET number = '%s', replytime = '%d', ss_mode = '%d' "
733 "WHERE (class = '%d' AND type = '%d')", cf_entry->number, cf_entry->replyTime, cf_entry->ss_mode, cf_entry->tel_class, cf_entry->type);
734 log_msg(MSGL_VGSM_INFO, "\n");
738 if(g_cf_is_activated == TRUE)
740 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFB);
741 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRy);
742 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRc);
744 return vgsm_ss_sqlite_restore(type);
747 memset(str, '\0', sizeof(str));
748 sprintf(str, "UPDATE forwarding SET number = '%s', replytime = '%d', ss_mode = '%d' "
749 "WHERE (class = '%d' AND type = '%d')", cf_entry->number, cf_entry->replyTime, cf_entry->ss_mode, cf_entry->tel_class, cf_entry->type);
750 log_msg(MSGL_VGSM_INFO, "\n");
753 else if(cf_entry->ss_mode == SS_MODE_DEREG)
755 if(cf_entry->type == SS_CF_TYPE_CFU)
757 log_msg(MSGL_VGSM_INFO, "g_cf_is_activated = FALSE\n");
758 g_cf_is_activated = FALSE;
761 log_msg(MSGL_VGSM_INFO,"###%d, %d, '%s',%d, %d\n",cf_entry->tel_class, cf_entry->type, cf_entry->number, cf_entry->replyTime, cf_entry->ss_mode);
762 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, cf_entry->type);
766 if(cf_entry->ss_mode == SS_MODE_REG && cf_entry->type == SS_CF_TYPE_CFU)
768 log_msg(MSGL_VGSM_INFO, "g_cf_is_activated = TRUE\n");
769 g_cf_is_activated = TRUE;
770 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFB);
771 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRy);
772 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRc);
774 else if(g_cf_is_activated == TRUE)
776 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFB);
777 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRy);
778 vgsm_ss_sqlite_remove(SS_CMD_CF, cf_entry->tel_class, SS_CF_TYPE_CFNRc);
780 return vgsm_ss_sqlite_restore(type);
783 memset(str, '\0', sizeof(str));
784 sprintf(str,"INSERT INTO forwarding VALUES (%d, %d, '%s',%d, %d)", cf_entry->tel_class, cf_entry->type, cf_entry->number, cf_entry->replyTime, cf_entry->ss_mode);
785 log_msg(MSGL_VGSM_INFO,"####%d, %d, '%s',%d, %d\n",cf_entry->tel_class, cf_entry->type, cf_entry->number, cf_entry->replyTime, cf_entry->ss_mode);
791 call_barring_entry_t * cb_entry = (call_barring_entry_t*)entry;
792 log_msg(MSGL_VGSM_INFO,"tel_class : %x, ssmode : %x, sstype : %x\n",cb_entry->tel_class, cb_entry->ss_mode, cb_entry->type);
793 if(vgsm_ss_sqlite_cb_check_exist(cb_entry->tel_class, cb_entry->type))
795 if(cb_entry->ss_mode == SS_MODE_DEREG) // GSM_SS_MODE_DEREG
796 return vgsm_ss_sqlite_remove(SS_CMD_CB, cb_entry->tel_class, cb_entry->type);
799 if(cb_entry->type == SS_CB_TYPE_BAOC && cb_entry->ss_mode == SS_MODE_ACT)
801 memset(str, '\0', sizeof(str));
802 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, SS_CB_TYPE_BAOC);
803 if(vgsm_ss_sqlite_add((char*)&str))
805 memset(str, '\0', sizeof(str));
806 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, SS_CB_TYPE_BOIC);
807 if(vgsm_ss_sqlite_add((char*)&str))
809 memset(str, '\0', sizeof(str));
810 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, SS_CB_TYPE_BOIC_NOT_HC);
812 else if(cb_entry->type == SS_CB_TYPE_BAIC && cb_entry->ss_mode == SS_MODE_ACT)
814 memset(str, '\0', sizeof(str));
815 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, SS_CB_TYPE_BAIC);
816 if(vgsm_ss_sqlite_add((char*)&str))
818 memset(str, '\0', sizeof(str));
819 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, SS_CB_TYPE_BIC_ROAM);
823 memset(str, '\0', sizeof(str));
824 sprintf(str, "UPDATE barring SET ss_mode = '%d' WHERE (class = '%d' AND type = '%d')", cb_entry->ss_mode, cb_entry->tel_class, cb_entry->type);
828 //090327 // this is point of preventing deregisteration data in cb
829 else if(cb_entry->ss_mode != SS_MODE_DEACT) // GSM_SS_MODE_DEACTIVATE
831 if(cb_entry->type == SS_CB_TYPE_BAOC && cb_entry->ss_mode == SS_MODE_ACT)
833 memset(str, '\0', sizeof(str));
834 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, SS_CB_TYPE_BAOC, cb_entry->ss_mode);
835 log_msg(MSGL_VGSM_INFO, "%s\n", str);
836 if(vgsm_ss_sqlite_add((char*)&str))
838 memset(str, '\0', sizeof(str));
839 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, SS_CB_TYPE_BOIC, cb_entry->ss_mode);
840 log_msg(MSGL_VGSM_INFO, "%s\n", str);
841 if(vgsm_ss_sqlite_add((char*)&str))
843 memset(str, '\0', sizeof(str));
844 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, SS_CB_TYPE_BOIC_NOT_HC, cb_entry->ss_mode);
845 log_msg(MSGL_VGSM_INFO, "%s\n", str);
847 else if(cb_entry->type == SS_CB_TYPE_BAIC && cb_entry->ss_mode == SS_MODE_ACT)
849 memset(str, '\0', sizeof(str));
850 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, SS_CB_TYPE_BAIC, cb_entry->ss_mode);
851 if(vgsm_ss_sqlite_add((char*)&str))
853 memset(str, '\0', sizeof(str));
854 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, SS_CB_TYPE_BIC_ROAM, cb_entry->ss_mode);
858 memset(str, '\0', sizeof(str));
859 sprintf(str,"INSERT INTO barring VALUES (%d, %d, %d)", cb_entry->tel_class, cb_entry->type, cb_entry->ss_mode);
866 call_waiting_entry_t * cw_entry = (call_waiting_entry_t*)entry;
867 /*******090225*****************************************************************************************************/
868 if(cw_entry->tel_class == -1 || cw_entry->tel_class == 0x10) // for defect X200001045, inconsistency problem
870 if(cw_entry->ss_mode == SS_MODE_DEREG || cw_entry->ss_mode == SS_MODE_DEACT) // GSM_SS_MODE_DEREG or GSM_SS_MODE_DEACTIVATE
871 // return vgsm_ss_sqlite_remove(SS_CMD_CW, cw_entry->tel_class, 0);
873 memset(str, '\0', sizeof(str));
874 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 1);
875 if(vgsm_ss_sqlite_add((char*)&str))
877 memset(str, '\0', sizeof(str));
878 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 4);
879 if(vgsm_ss_sqlite_add((char*)&str))
881 memset(str, '\0', sizeof(str));
882 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 8);
883 if(vgsm_ss_sqlite_add((char*)&str))
885 memset(str, '\0', sizeof(str));
886 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 32);
890 memset(str, '\0', sizeof(str));
891 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 1);
892 if(vgsm_ss_sqlite_add((char*)&str))
894 memset(str, '\0', sizeof(str));
895 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 4);
896 if(vgsm_ss_sqlite_add((char*)&str))
898 memset(str, '\0', sizeof(str));
899 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 8);
900 if(vgsm_ss_sqlite_add((char*)&str))
902 memset(str, '\0', sizeof(str));
903 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 32);
908 if(vgsm_ss_sqlite_cw_check_exist(cw_entry->tel_class))
910 /* if(cw_entry->ss_mode == SS_MODE_DEREG || cw_entry->ss_mode == SS_MODE_DEACT) // GSM_SS_MODE_DEREG or GSM_SS_MODE_DEACT
911 return vgsm_ss_sqlite_remove(SS_CMD_CW, cw_entry->tel_class, 0);
913 memset(str, '\0', sizeof(str));
914 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 1);
915 if(vgsm_ss_sqlite_add((char*)&str))
917 memset(str, '\0', sizeof(str));
918 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 4);
919 if(vgsm_ss_sqlite_add((char*)&str))
921 memset(str, '\0', sizeof(str));
922 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 8);
923 if(vgsm_ss_sqlite_add((char*)&str))
925 memset(str, '\0', sizeof(str));
926 sprintf(str, "UPDATE waiting SET number = '%s', ss_mode = '%d' WHERE class = '%d'", cw_entry->number, cw_entry->ss_mode, 32);
930 memset(str, '\0', sizeof(str));
931 sprintf(str,"INSERT INTO waiting VALUES (%d, %d, '%s')", cw_entry->tel_class, cw_entry->ss_mode, cw_entry->number);
932 log_msg(MSGL_VGSM_INFO, "%s\n", str);
939 if(vgsm_ss_sqlite_add((char*)&str))
942 return vgsm_ss_sqlite_restore(type);
946 // ----------------------------------------------------------------------------
947 // end of sqlite3 specific code
948 // ----------------------------------------------------------------------------
950 // initialize the database
951 int vgsm_ss_database_init()
953 log_msg(MSGL_VGSM_INFO,"vgsm_ss_database_init\n");
955 // initialize the database
956 return vgsm_ss_sqlite_init();
959 // add a registration
960 int vgsm_ss_database_add(ss_cmd_e_type type, void * entry)
962 log_msg(MSGL_VGSM_INFO,"vgsm_ss_database_add\n");
964 return vgsm_ss_sqlite_make_sql(type, entry);
967 // remove a registration
968 int vgsm_ss_database_remove(ss_cmd_e_type type, int tel_class, int ss_type)
971 log_msg(MSGL_VGSM_INFO,"vgsm_ss_database_remove\n");
973 if(ss_type == SS_CF_TYPE_CFU)
975 log_msg(MSGL_VGSM_INFO, "g_cf_is_activated = FALSE\n");
976 g_cf_is_activated = FALSE;
978 // remove the registration from the database
979 return vgsm_ss_sqlite_remove(type, tel_class, ss_type);
982 // restore all previously save registrations
983 int vgsm_ss_database_restore(ss_cmd_e_type type)
985 log_msg(MSGL_VGSM_INFO,"vgsm_ss_database_restore : ss_cmd=%d \n", type);
987 return vgsm_ss_sqlite_restore(type);
990 /*========== voice =================*/
992 int get_outgoing_voice_call_barring_state(void)
994 log_msg(MSGL_VGSM_INFO,"%d\n", g_mo_voice_is_barred);
995 return g_mo_voice_is_barred;
998 int get_incoming_voice_call_barring_state(void)
1000 log_msg(MSGL_VGSM_INFO,"%d\n", g_mt_voice_is_barred);
1001 return g_mt_voice_is_barred;
1004 void set_outgoing_voice_call_barring_state(int state)
1006 log_msg(MSGL_VGSM_INFO,"%d\n", state);
1007 g_mo_voice_is_barred = state == 0x03 ? TRUE : FALSE;
1010 void set_incoming_voice_call_barring_state(int state)
1012 log_msg(MSGL_VGSM_INFO,"%d\n", state);
1013 g_mt_voice_is_barred = state == 0x03 ? TRUE : FALSE;
1016 /*========== video =================*/
1018 int get_outgoing_video_call_barring_state(void)
1020 log_msg(MSGL_VGSM_INFO,"%d\n", g_mo_video_is_barred);
1021 return g_mo_video_is_barred;
1024 int get_incoming_video_call_barring_state(void)
1026 log_msg(MSGL_VGSM_INFO,"%d\n", g_mt_video_is_barred);
1027 return g_mt_video_is_barred;
1030 void set_outgoing_video_call_barring_state(int state)
1032 log_msg(MSGL_VGSM_INFO,"%d\n", state);
1033 g_mo_video_is_barred = state == 0x03 ? TRUE : FALSE;
1036 void set_incoming_video_call_barring_state(int state)
1038 log_msg(MSGL_VGSM_INFO,"%d\n", state);
1039 g_mt_video_is_barred = state == 0x03 ? TRUE : FALSE;
1042 void set_call_waiting_entry(call_waiting_entry_t * entry, int num)
1045 memset(g_cw_entry, 0, sizeof(g_cw_entry));
1048 g_cw_entry[num-1].tel_class = entry->tel_class;
1049 g_cw_entry[num-1].ss_mode = entry->ss_mode;
1050 g_cw_entry[0].count = num;
1051 memset(&g_cw_entry[num-1].number, 0, MAX_GSM_DIALED_DIGITS_NUMBER);
1052 memcpy(&g_cw_entry[num-1].number, &entry->number, strlen((char*)&entry->number));
1054 log_msg(MSGL_VGSM_INFO,"[set_call_waiting_entry]--------class : %d, ss_mode : %d, num : %d\n", g_cw_entry[num-1].tel_class, g_cw_entry[num-1].ss_mode, num);
1057 call_waiting_entry_t * get_call_waiting_entry()
1059 return (call_waiting_entry_t *)&g_cw_entry;
1062 call_waiting_entry_t g_cw_entry_tmp;
1064 call_waiting_entry_t * find_call_waiting_entry(int tel_class)
1067 call_waiting_entry_t * entry ;
1069 for(i = 0; i<g_cw_entry[0].count; i++)
1071 log_msg(MSGL_VGSM_INFO,"%d. [%s] class : %d, ss_mode : %d with matching telclass : %d\n"
1072 , i, __FUNCTION__, g_cw_entry[i].tel_class, g_cw_entry[i].ss_mode, tel_class);
1074 if(g_cw_entry[i].tel_class == tel_class){
1075 log_msg(MSGL_VGSM_INFO,"Found: class : %d, ss_mode : %d\n"
1076 , g_cw_entry[i].tel_class, g_cw_entry[i].ss_mode);
1078 return &g_cw_entry[i];
1082 log_msg(MSGL_VGSM_INFO,"Not Found: Fake return class : %d, ss_mode : %d\n"
1083 , tel_class, status);
1085 entry = &g_cw_entry_tmp ;
1087 memset(entry, 0, sizeof(call_waiting_entry_t));
1088 entry->tel_class = tel_class;
1089 entry->ss_mode = status;
1091 strcpy(entry->number, SUBSCRIBER_NUM);
1095 void set_call_barring_entry(call_barring_entry_t * entry, int num)
1099 memset(g_cb_entry, 0, sizeof(call_barring_entry_t)*20);
1100 g_cb_entry[0].count = 0;
1104 g_cb_entry[num-1].tel_class = entry->tel_class;
1105 g_cb_entry[num-1].type = entry->type;
1106 g_cb_entry[num-1].ss_mode = entry->ss_mode;
1107 g_cb_entry[0].count = num;
1109 // log_msg(MSGL_VGSM_INFO,"[set_call_barring_entry]--------class : %d, type : %d, ss_mode : %d, num : %d\n", g_cb_entry[num-1].tel_class, g_cb_entry[num-1].type, g_cb_entry[num-1].ss_mode, num);
1112 call_barring_entry_t * get_call_barring_entry()
1114 return (call_barring_entry_t *)&g_cb_entry;
1117 //class¿Í type°ªÀº ´Ù½Ã ¸®ÅÏÇØÁÙ ÇÊ¿ä°¡ ¾ø´Ù. -> status¸¸ ¾Ë·ÁÁÖ¸é µÊ
1119 call_barring_entry_t g_cb_entry_tmp;
1121 int send_call_barring_entry(call_barring_entry_t* entry)
1123 unsigned char * data = 0;
1127 log_msg(MSGL_VGSM_INFO,"entry->count = %d \n", entry->count);
1128 if(entry->ss_mode == SS_MODE_REG || entry->ss_mode == SS_MODE_ACT)
1129 ss_status = AT_SS_STATUS_ACTIVE;
1131 ss_status = AT_SS_STATUS_NOT_ACTIVE;
1134 data = malloc(sizeof(unsigned char) * data_len);
1135 data[0] = entry->type;
1136 data[1] = 1; // entry->count
1137 data[2] = entry->tel_class;
1138 data[3] = ss_status;
1140 log_msg(MSGL_VGSM_INFO,"data[0] : %x\ndata[1] : %x\ndata[2] : %x\ndata[3] : %x\nss_mode : %x\n", data[0], data[1], data[2], data[3], entry->ss_mode);
1142 ret = oem_tx_ss_cb_resp(data, data_len);
1148 call_barring_entry_t * find_call_barring_entry(int tel_class, int type)
1150 int i, status = SS_MODE_DEACT, found = 0;
1151 call_barring_entry_t * entry = (call_barring_entry_t*)malloc(sizeof(call_barring_entry_t));
1153 log_msg(MSGL_VGSM_INFO,"1. [find_call_barring_entry]--------telclass : %d, type : %d\n", tel_class, type );
1154 for(i = 0; i<g_cb_entry[0].count; i++)
1156 log_msg(MSGL_VGSM_INFO,"2. [find_call_barring_entry]--------class : %d, ss_mode : %d, type : %d\n", g_cb_entry[i].tel_class, g_cb_entry[i].ss_mode, g_cb_entry[i].type);
1158 if((tel_class == AT_CALL_SS_CLASS_ALL) ? (g_cb_entry[i].type == type) : (g_cb_entry[i].tel_class == tel_class) && (g_cb_entry[i].type == type))
1160 log_msg(MSGL_VGSM_INFO,"entry: count %d \n", g_cb_entry[i].count);
1162 entry = &g_cb_entry_tmp;
1164 memset(entry, 0, sizeof(call_barring_entry_t));
1165 entry->tel_class = g_cb_entry[i].tel_class;
1166 //entry->tel_class = class;
1167 entry->type = g_cb_entry[i].type;
1168 if(entry->tel_class == AT_CALL_SS_CLASS_VIDEO) // video call
1170 if(g_cb_entry[i].type == SS_CB_TYPE_BOIC || g_cb_entry[i].type == SS_CB_TYPE_BOIC_NOT_HC)
1172 if(get_outgoing_video_call_barring_state())
1173 entry->ss_mode = SS_MODE_ACT;
1175 entry->ss_mode = g_cb_entry[i].ss_mode;
1177 else if(g_cb_entry[i].type == SS_CB_TYPE_BIC_ROAM)
1179 if(get_incoming_video_call_barring_state())
1180 entry->ss_mode = SS_MODE_ACT;
1182 entry->ss_mode = g_cb_entry[i].ss_mode;
1185 entry->ss_mode = g_cb_entry[i].ss_mode;
1189 if(g_cb_entry[i].type == SS_CB_TYPE_BOIC || g_cb_entry[i].type == SS_CB_TYPE_BOIC_NOT_HC)
1191 if(get_outgoing_voice_call_barring_state())
1192 entry->ss_mode = SS_MODE_ACT;
1194 entry->ss_mode = g_cb_entry[i].ss_mode;
1196 else if(g_cb_entry[i].type == SS_CB_TYPE_BIC_ROAM)
1198 if(get_incoming_voice_call_barring_state())
1199 entry->ss_mode = SS_MODE_ACT;
1201 entry->ss_mode = g_cb_entry[i].ss_mode;
1204 entry->ss_mode = g_cb_entry[i].ss_mode;
1207 entry->count = g_cb_entry[i].count; // it should be 0 ??? check plz...
1209 send_call_barring_entry(entry);
1216 log_msg(MSGL_VGSM_INFO,"not found \n");
1218 if(tel_class == AT_CALL_SS_CLASS_VIDEO) // video call
1220 if(type == SS_CB_TYPE_BAIC || type == SS_CB_TYPE_BIC_ROAM) // incoming
1222 log_msg(MSGL_VGSM_INFO,"class: %d, type: %d \n", tel_class, type);
1223 if(get_incoming_video_call_barring_state())
1224 status = SS_MODE_ACT;
1226 status = SS_MODE_DEACT;
1230 log_msg(MSGL_VGSM_INFO,"class: %d, type: %d \n", tel_class, type);
1231 if(get_outgoing_video_call_barring_state())
1232 status = SS_MODE_ACT;
1234 status = SS_MODE_DEACT;
1239 if(type == SS_CB_TYPE_BAIC || type == SS_CB_TYPE_BIC_ROAM) // incoming
1241 log_msg(MSGL_VGSM_INFO,"class: %d, type: %d \n", tel_class, type);
1242 if(get_incoming_voice_call_barring_state())
1243 status = SS_MODE_ACT;
1245 status = SS_MODE_DEACT;
1249 log_msg(MSGL_VGSM_INFO,"class: %d, type: %d \n", tel_class, type);
1250 if(get_outgoing_voice_call_barring_state())
1251 status = SS_MODE_ACT;
1253 status = SS_MODE_DEACT;
1256 // À̺κРȮÀÎÇÏÀÚ. db¿¡ ¾ø´Â°ÍÀ» µ¥ÀÌŸ¸¦ ¾î
\89F°Ô ÁÙÁö »ý°¢....
1257 entry = &g_cb_entry_tmp ;
1259 memset(entry, 0, sizeof(call_barring_entry_t));
1261 entry->ss_mode = status;
1264 if(tel_class == AT_CALL_SS_CLASS_ALL)
1266 entry->tel_class = AT_CALL_SS_CLASS_VOICE;
1267 send_call_barring_entry(entry);
1269 entry->tel_class = AT_CALL_SS_CLASS_VIDEO;
1270 send_call_barring_entry(entry);
1274 entry->tel_class = tel_class;
1275 send_call_barring_entry(entry);
1281 void set_call_forwarding_entry(call_forwarding_entry_t * entry, int num)
1283 log_msg(MSGL_VGSM_INFO, "num: %d\n", num);
1285 memset(g_cf_entry, 0, sizeof(call_forwarding_entry_t) * 20);
1288 g_cf_entry[num-1].tel_class = entry->tel_class;
1289 g_cf_entry[num-1].type = entry->type;
1290 memset(&g_cf_entry[num-1].number, 0, MAX_GSM_DIALED_DIGITS_NUMBER);
1291 memcpy(&g_cf_entry[num-1].number, &entry->number, strlen((char*)&entry->number));
1292 g_cf_entry[num-1].replyTime = entry->replyTime;
1293 g_cf_entry[num-1].ss_mode = entry->ss_mode;
1295 g_cf_entry[0].count = num;
1296 // log_msg(MSGL_VGSM_INFO,"[set_call_forwarding_entry]--------[%s] -> <%s>\n", entry->number, g_cf_entry[num-1].number);
1299 call_forwarding_entry_t * get_call_forwarding_entry()
1301 return (call_forwarding_entry_t *)&g_cf_entry;
1304 call_forwarding_entry_t g_cf_entry_tmp;
1306 call_forwarding_entry_t * find_call_forwarding_entry(int tel_class, int type)
1309 call_forwarding_entry_t * entry ;
1311 log_msg(MSGL_VGSM_INFO,"tel_class=0x%x type=%d\n", tel_class,type);
1313 for(i = 0; i<g_cf_entry[0].count; i++)
1315 log_msg(MSGL_VGSM_INFO,"tel_class=0x%x type=%d\n", g_cf_entry[i].tel_class,g_cf_entry[i].type);
1317 if(g_cf_entry[i].tel_class == -1)
1319 if((class == tel_class) && (g_cf_entry[i].type == type))
1321 log_msg(MSGL_VGSM_INFO,"entry: count %d \n", g_cf_entry[i].count);
1323 entry = &g_cf_entry_tmp;
1325 memset(entry, 0, sizeof(call_forwarding_entry_t));
1326 //entry->tel_class = g_cf_entry[i].tel_class;
1327 entry->tel_class = class;
1328 entry->type = g_cf_entry[i].type;
1329 entry->ss_mode = g_cf_entry[i].ss_mode;
1330 entry->count = g_cf_entry[i].count; // it should be 0 ??? check plz...
1331 strcpy(entry->number, g_cf_entry[i].number);
1332 entry->replyTime = g_cf_entry[i].replyTime;
1333 //entry->number[0] = '\0';
1334 //entry->replyTime = 0;
1337 //return &g_cf_entry[i];
1340 log_msg(MSGL_VGSM_INFO,"entry is not found !!! \n");
1342 // À̺κРȮÀÎÇÏÀÚ. db¿¡ ¾ø´Â°ÍÀ» µ¥ÀÌŸ¸¦ ¾î
\89F°Ô ÁÙÁö »ý°¢....
1343 //entry = (call_forwarding_entry_t *)malloc(sizeof(call_forwarding_entry_t));
1344 entry = &g_cf_entry_tmp;
1346 memset(entry, 0, sizeof(call_forwarding_entry_t));
1347 entry->tel_class = tel_class;
1349 entry->ss_mode = SS_MODE_DEACT;
1350 entry->count = 1; // it should be 0 ??? check plz...
1351 entry->number[0] = '\0';
1352 entry->replyTime = 0;
1358 ///////////////////////////////////////////////////////////
1360 char* get_callbarring_pwd(void)
1365 void set_callbarring_pwd(char* cb_pwd)
1367 strcpy(g_cb_pwd,cb_pwd);
1370 int increase_callbarring_pwd_fail_count(void)
1372 g_cb_pwd_fail_count++;
1373 return g_cb_pwd_fail_count;
1377 void clear_callbarring_pwd_fail_count(void)
1379 g_cb_pwd_fail_count = 0;