UniMRCP  1.7.0
apt_task_msg.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APT_TASK_MSG_H
18 #define APT_TASK_MSG_H
19 
20 /**
21  * @file apt_task_msg.h
22  * @brief Task Message Base Definition
23  */
24 
25 #include "apt.h"
26 
28 
29 /** Enumeration of task message types */
30 typedef enum {
31  TASK_MSG_CORE, /**< core task message type */
32  TASK_MSG_USER /**< user defined task messages start from here */
34 
35 /** Enumeration of core task messages */
36 typedef enum {
37  CORE_TASK_MSG_NONE, /**< indefinite message */
38  CORE_TASK_MSG_START_COMPLETE, /**< start-complete message */
39  CORE_TASK_MSG_TERMINATE_REQUEST, /**< terminate-request message */
40  CORE_TASK_MSG_TERMINATE_COMPLETE, /**< terminate-complete message */
41  CORE_TASK_MSG_TAKEOFFLINE_REQUEST, /**< take-offline-request message */
42  CORE_TASK_MSG_TAKEOFFLINE_COMPLETE, /**< take-offline-complete message */
43  CORE_TASK_MSG_BRINGONLINE_REQUEST, /**< bring-online-request message */
44  CORE_TASK_MSG_BRINGONLINE_COMPLETE, /**< bring-online-complete message */
46 
47 /** Opaque task message declaration */
49 /** Opaque task message pool declaration */
51 
52 /** Task message is used for inter task communication */
54  /** Message pool the task message is allocated from */
56  /** Task msg type */
57  int type;
58  /** Task msg sub type */
59  int sub_type;
60  /** Context specific data */
61  char data[1];
62 };
63 
64 
65 /** Create pool of task messages with dynamic allocation of messages (no actual pool is created) */
66 APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool);
67 
68 /** Create pool of task messages with static allocation of messages */
69 APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool);
70 
71 /** Destroy pool of task messages */
73 
74 
75 /** Acquire task message from task message pool */
77 
78 /** Realese task message */
80 
81 
83 
84 #endif /* APT_TASK_MSG_H */
apt_task_msg_t * apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool)
apt_task_msg_type_e
Definition: apt_task_msg.h:30
Definition: apt_task_msg.h:53
apt_task_msg_pool_t * apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool)
Definition: apt_task_msg.h:41
Definition: apt_task_msg.h:32
#define APT_END_EXTERN_C
Definition: apt.h:38
Definition: apt_task_msg.h:44
apt_core_task_msg_type_e
Definition: apt_task_msg.h:36
Definition: apt_task_msg.h:42
apt_task_msg_pool_t * apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool)
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
void apt_task_msg_release(apt_task_msg_t *task_msg)
#define APT_DECLARE(type)
Definition: apt.h:53
APR Toolkit Definitions.
Definition: apt_task_msg.h:43
Definition: apt_task_msg.h:31
Definition: apt_task_msg.h:40
void apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool)
int sub_type
Definition: apt_task_msg.h:59
Definition: apt_task_msg.h:39
apt_task_msg_pool_t * msg_pool
Definition: apt_task_msg.h:55
char data[1]
Definition: apt_task_msg.h:61
Definition: apt_task_msg.h:38
Definition: apt_task_msg.h:37
struct apt_task_msg_pool_t apt_task_msg_pool_t
Definition: apt_task_msg.h:50
int type
Definition: apt_task_msg.h:57