1 /* |
|
2 * ============================================================================ |
|
3 * Name : isoconnectionmanager.h |
|
4 * Part of : isolation server. |
|
5 * Version : %version: 9 % |
|
6 * |
|
7 * Copyright © 2007-2008 Nokia. All rights reserved. |
|
8 * All rights reserved. |
|
9 * Redistribution and use in source and binary forms, with or without modification, |
|
10 * are permitted provided that the following conditions are met: |
|
11 * Redistributions of source code must retain the above copyright notice, this list |
|
12 * of conditions and the following disclaimer.Redistributions in binary form must |
|
13 * reproduce the above copyright notice, this list of conditions and the following |
|
14 * disclaimer in the documentation and/or other materials provided with the distribution. |
|
15 * Neither the name of the Nokia Corporation nor the names of its contributors may be used |
|
16 * to endorse or promote products derived from this software without specific prior written |
|
17 * permission. |
|
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
|
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
|
21 * SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
|
23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 * ============================================================================ |
|
28 * Template version: 1.0 |
|
29 */ |
|
30 |
|
31 /*! |
|
32 * \def To avoid multiple inclusion of header |
|
33 */ |
|
34 |
|
35 #ifndef __ICONNECTIONMANAGER_H__ |
|
36 #define __ICONNECTIONMANAGER_H__ |
|
37 |
|
38 #include <glib.h> |
|
39 #include <gtypes.h> |
|
40 #include "isoservermain.h" |
|
41 # include "msg_enums.h" |
|
42 |
|
43 #ifdef __WINSCW__ |
|
44 /*! \remark Should LOGIN_ARG_COUNT this be hardcoded ? |
|
45 */ |
|
46 #define LOGIN_ARG_COUNT 12 |
|
47 #else |
|
48 #define LOGIN_ARG_COUNT 10 |
|
49 #endif |
|
50 |
|
51 /*! \file |
|
52 * Connection related interfaces. |
|
53 * client anywhere in the documentation refers to anyone |
|
54 * using the isoserver |
|
55 */ |
|
56 |
|
57 /*! \typedef struct login_struct typedefed to login_struct |
|
58 */ |
|
59 typedef struct login_struct login_struct; |
|
60 |
|
61 /*! \struct login_struct isoconnectionmanager.h |
|
62 * \brief Buffer recieved from client for login request is parsed and the |
|
63 * arguments are put into this structure |
|
64 * \param hdr_req header request |
|
65 * \param strs array of strings( which are arguments for login ) |
|
66 */ |
|
67 struct login_struct |
|
68 { |
|
69 message_hdr_req* hdr_req; |
|
70 char *strs[LOGIN_ARG_COUNT]; |
|
71 }; |
|
72 |
|
73 /*! \brief This does things after login is successful. Now it sets the isConnected |
|
74 * variable to ETrue |
|
75 */ |
|
76 void action_logedin( ) ; |
|
77 |
|
78 /*! \brief This function is registered in action_login for statuschanged signal. |
|
79 * This function is called by telepathygabble when the status of the user changes |
|
80 * Once user is connected this function registers for NewChannel signal with telepathygabble |
|
81 * client is also informed of the status change.. |
|
82 * |
|
83 * \param proxy |
|
84 * \param status status of the user ( connected/connecting/disconnected ) |
|
85 * \param reason reason for status change(server disconnected/ user requested etc.,) |
|
86 * \param user_data message header request |
|
87 * |
|
88 * \return : Boolean True on success, false on failure |
|
89 */ |
|
90 |
|
91 static gboolean status_changed_cb(DBusGProxy *proxy, |
|
92 guint status, guint reason, |
|
93 gpointer user_data) ; |
|
94 |
|
95 /*! \brief new_channel_handler is registered as a callback for any new |
|
96 * channels craetion request, in function status_changed_cb after status is changed |
|
97 * to log in. new_channel_handler creates channel and also registers for the signals |
|
98 * MembersChanged for contact related channels and Recieved and SendError for IM |
|
99 * related channels. |
|
100 * |
|
101 * \param proxy unused |
|
102 * \param object_path object path of the channel |
|
103 * \param channel_type used to get a new channel |
|
104 * \param handle_type used to get a new channel, channel handle type |
|
105 * \param handle used to get a new channel, channel handle |
|
106 * \param suppress_handler unused |
|
107 * \param user_data unused |
|
108 * |
|
109 * \return void |
|
110 */ |
|
111 |
|
112 static void new_channel_handler( DBusGProxy *proxy, const char *object_path, |
|
113 const char *channel_type, guint handle_type, |
|
114 guint handle, gboolean suppress_handler, |
|
115 gpointer user_data ) ; |
|
116 |
|
117 |
|
118 /*! \brief Is called after logout.. Any cleanup operations to |
|
119 * be performed here. Setting conn_stat to disconnected, cleaning up |
|
120 * of resources is done |
|
121 */ |
|
122 void action_logedout() ; |
|
123 |
|
124 /*! \brief Callback for the logout |
|
125 * |
|
126 * \param proxy : unused |
|
127 * \param error : unused |
|
128 * \param userdata : unused |
|
129 * \return : void |
|
130 */ |
|
131 void logout_cb( DBusGProxy *proxy, GError *error, gpointer userdata ); |
|
132 |
|
133 /*! \brief requests for closing of session. Also closes the search channel. |
|
134 * \remark should not close the search channel |
|
135 * |
|
136 * Request for log - out |
|
137 * \param pc - message which has the request header |
|
138 * \return : MEM_ALLOCATION_ERROR or 0 |
|
139 */ |
|
140 int action_logout( char* pc ) ; |
|
141 |
|
142 /*! \brief validates params, gets a dbus, creates a connection manager, |
|
143 * and connection. Registers for the statuschange |
|
144 * |
|
145 * \param ls_hdr login struct |
|
146 * \return Errors if invalid param or getting dbus, conn mgr or conn fails else 0 |
|
147 */ |
|
148 gint action_login( login_struct* ls_hdr ) ; |
|
149 |
|
150 /*! \brief parses the message buffer and validates the parameters. The values are written |
|
151 * to ls_hdr |
|
152 * |
|
153 * \param aMsgBuffer - buf to be parsed |
|
154 * \param ls_hdr - login_struct struct to which values are written |
|
155 * \param msg_len - no. of bytes in the message buffer aMsgBuffer |
|
156 * |
|
157 */ |
|
158 gint parse_for_login( gchar* aMsgBuffer, login_struct** ls_hdr, int msg_len ) ; |
|
159 |
|
160 /*! \brief Calls parse_for_login to parse and validate the arguments |
|
161 * And then calls action_login for to do actual login |
|
162 * |
|
163 * \param aMsgBuf message buffer |
|
164 * \param msg_len - len of the message |
|
165 */ |
|
166 gint action_parse_login( char* aMsgBuf, int msg_len ) ; |
|
167 |
|
168 |
|
169 |
|
170 #endif //__ICONNECTIONMANAGER_H__ |
|
171 |
|