Sync with tizen 2.4
[platform/core/messaging/msg-service.git] / include / framework / MsgTransManager.h
index 153d393..f9eeb94 100755 (executable)
@@ -1,20 +1,17 @@
 /*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
 */
 
 #ifndef MSG_TRANSACTION_MANAGER_H
@@ -28,6 +25,7 @@
 #include <map>
 
 #include "MsgMutex.h"
+#include "MsgQueue.h"
 #include "MsgIpcSocket.h"
 #include "MsgCmdTypes.h"
 #include "MsgInternalTypes.h"
 
 
 
+
 /*==================================================================================================
                                          DEFINITION
 ==================================================================================================*/
 typedef std::map<MSG_CMD_TYPE_T, int (*)(const MSG_CMD_S*, char**)> handler_map;
 typedef std::map<int, MSG_PROXY_INFO_S> sentmsg_map;
+#ifdef MSG_PENDING_PUSH_MESSAGE
+typedef std::list<MSG_PUSH_MESSAGE_DATA_S> pushpending_list;
+#endif
 typedef std::map<int, bool> fd_map;
 typedef std::list<MSG_CMD_REG_INCOMING_MSG_CB_S> newmsg_list;
 typedef std::list<MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S>      mmsconf_list;
@@ -52,11 +54,6 @@ typedef std::list<MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S> syncmlop_list;
 
 
 /*==================================================================================================
-                                     FUNCTION PROTOTYPES
-==================================================================================================*/
-void MsgContactChangedCallback();
-
-/*==================================================================================================
                                      CLASS DEFINITIONS
 ==================================================================================================*/
 class MsgTransactionManager
@@ -65,6 +62,7 @@ public:
        static MsgTransactionManager* instance();
 
        void run();
+      void workerEventQueue();
        void write(int fd, const char* buf, int len);
 
        // methods for sent status event
@@ -82,6 +80,10 @@ public:
        void setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId);
        void setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCbinfo);
        void setStorageChangeCB(int listenerFd);
+       void setReportMsgCB(int listenerFd);
+#ifdef MSG_PENDING_PUSH_MESSAGE
+       void sendPendingPushMsg(void);
+#endif
 
        javamms_list& getJavaMMSList();
 
@@ -93,7 +95,7 @@ public:
        void broadcastLBSMsgCB(const msg_error_t err, const MSG_LBS_MESSAGE_DATA_S *lbsData);
        void broadcastSyncMLMsgOperationCB(const msg_error_t err, const int msgId, const int extId);
        void broadcastStorageChangeCB(const msg_error_t err, const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList);
-
+       void broadcastReportMsgCB(const msg_error_t err, const msg_report_type_t reportMsgType, const MSG_MESSAGE_INFO_S *pMsgInfo);
        void setTMStatus();
        void getTMStatus();
 
@@ -103,6 +105,7 @@ private:
 
        void handleRequest(int fd);
        void cleanup(int fd);
+//     bool checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie);
        bool checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType);
 
        static MsgTransactionManager* pInstance;
@@ -111,7 +114,9 @@ private:
        bool running;
 
        handler_map handlerMap;
-
+#ifdef MSG_PENDING_PUSH_MESSAGE
+       pushpending_list pushMsgList;
+#endif
        sentmsg_map sentMsgMap;                 // req_id, listener_fd, msghandle_addr
        fd_map statusCBFdMap;           // src_fd, true if registered
 
@@ -125,9 +130,11 @@ private:
        syncmlop_list operationSyncMLMsgCBList;         // src_fd, msgType, port if registered
 
        fd_map storageChangeFdMap;      // src_fd, true if registered
+       fd_map reportMsgCBFdMap;        // src_fd, true if registered
 
        Mutex mx;
        CndVar cv;
+       MsgSimpleQ<MSG_CMD_S*> eventQueue;
 };
 
 #endif //MSG_TRANSACTION_MANAGER_H