Initial upload to RSA
[framework/connectivity/data-router.git] / include / dr-main.h
1 /*
2  * Data-Router
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
7  *               Injun Yang <injun.yang@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *              http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24
25 #ifndef _DATA_ROUTER_H_
26 #define _DATA_ROUTER_H_
27
28 #include <sys/types.h>
29 #include <sys/un.h>
30 #include <unistd.h>
31 #include <stdio.h>
32 #include <glib.h>
33 #include <sys/socket.h>
34 #include <pthread.h>
35 #include <signal.h>
36 #include <net/if.h>
37 #include <stdarg.h>
38 #include <dlfcn.h>
39 #include <vconf.h>
40 #include <vconf-keys.h>
41
42
43
44
45 /** 
46   * @def         USB_BUFFER_SIZE
47   * Defines the maximum buffer size for the USB
48   */
49 #define USB_BUFFER_SIZE         1500
50 #define ERRMSG_SIZE                             100
51
52
53 /** @internal
54  *   This structure has information about the Modem
55  */
56
57 typedef union {
58         struct {
59                 volatile unsigned int dtr:1;
60                 volatile unsigned int rts:1;
61                 volatile unsigned int reserved:6;
62         } bits;
63         volatile unsigned char state;
64 } dr_modem_input_lines;
65
66 typedef union {
67         struct {
68                 volatile unsigned int dcd:1;
69                 volatile unsigned int dsr:1;
70                 volatile unsigned int brk:1;
71                 volatile unsigned int ri:1;
72                 volatile unsigned int reserved:4;
73         } bits;
74         volatile unsigned char state;
75 } dr_modem_output_lines;
76
77
78 /** @internal
79  *   This structure has information about modem connection lines
80  */
81 typedef struct {
82         dr_modem_output_lines output_line_state;
83         dr_modem_input_lines input_line_state;
84 } dr_line_info_t;
85
86
87 /** @internal
88  *   This structure has information about the USB connection
89  */
90 typedef struct {
91         gboolean connected;                             /**< To check whether USB is connected or not */
92         pthread_t thread_id;                            /**< USB thread id */
93         int usb_fd;                                     /**< USB file descriptor */
94         int usb_ctrl_fd;
95         int data_path;                          /**< Data path */
96         char data_buffer[USB_BUFFER_SIZE+1];    /**< Data buffer */
97 } dr_usb_info_t;
98
99
100 /** @internal
101  *   This structure has information about the DR
102  */
103 typedef struct {
104         dr_usb_info_t usb;                                              /**< Information about USB */
105         dr_line_info_t line;                                            /**< Information about modem status lines */
106 } dr_info_t;
107
108
109
110 gboolean _deinit_dr(void);
111
112
113 #endif                          //_DATA_ROUTER_H_