source: remove build warning for 64bit build
[platform/adaptation/emulator/vmodem-daemon-emulator.git] / vmodem / server / server_tx_gprs.c
1 /*
2  *  telephony-emulator
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  * Sooyoung Ha <yoosah.ha@samsung.com>
8  * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23  *
24  * Contributors:
25  * - S-Core Co., Ltd
26  *
27  */
28
29 #include "oem_tx_gprs.h"
30 #include "linuxtapi.h"
31 #include "at_msg.h"
32 #include "vgsm_gprs.h"
33 #include "db_gprs.h"
34 #include "vgsm_gprs.h"
35 #include "logmsg.h"
36 #include <string.h>
37 #include "server_tx_gprs.h"
38 #include "at_func.h"
39
40 extern GprsConfList g_gprs_conflist;
41 extern GSM_SetPDPContext g_pdpcontext;
42
43 int server_tx_gprs_ipconf_match(void)
44 {
45     int i;
46
47     for (i = 0; i < g_gprs_conflist.num; i++) {
48         log_msg(MSGL_VGSM_INFO,"apn(%s) conflist[%d](%s) \n"
49                 , g_pdpcontext.apn, i, g_gprs_conflist.pentry[i].apn);
50         if (strcmp(g_pdpcontext.apn, g_gprs_conflist.pentry[i].apn) != 0)
51             return i;
52     }
53
54     return -1;
55 }
56
57 int server_tx_gprs_IPConfigurationNotify(LXT_MESSAGE const* packet)
58 {
59     TRACE(MSGL_VGSM_INFO, "\n");
60
61     char sndbuf[SEND_BUF_SIZE];
62     memset(sndbuf, '\0', sizeof(sndbuf));
63
64     char* pdp_type = NULL;
65
66     switch(g_pdpcontext.pdp_type)
67     {
68         case GSM_GPRS_DEFINE_PDP_CONTEXT_P_TYPE_IP:
69             pdp_type = IP;
70             break;
71         case GSM_GPRS_DEFINE_PDP_CONTEXT_P_TYPE_PPP:
72             pdp_type = PPP;
73             break;
74         case GSM_GPRS_DEFINE_PDP_CONTEXT_P_TYPE_IPV6:
75             pdp_type = IPV6;
76             break;
77         default:
78             pdp_type = UNKNOWN;
79             break;
80     }
81
82     // search database
83     vgsm_gprs_database_restore();
84
85     sprintf(sndbuf, "%s%d,%s,%s,%s,%d,%d%s", CGDCONT, g_pdpcontext.cid, pdp_type, g_pdpcontext.apn, g_pdpcontext.pdp_addr, g_pdpcontext.d_comp, g_pdpcontext.h_comp, CRLF);
86
87     log_msg(MSGL_VGSM_INFO,"packet:%s, length:%zu\n", sndbuf, strlen(sndbuf));
88
89     return oem_tx_gprs_IPConfigurationNotify(sndbuf, strlen(sndbuf));
90 }
91
92