1 /*
2  * Copyright 2008-2014 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  * $Id: mpf_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef MPF_MESSAGE_H
20 #define MPF_MESSAGE_H
21 
22 /**
23  * @file mpf_message.h
24  * @brief Media Processing Framework Message Definitions
25  */
26 
27 #include "mpf_types.h"
28 
29 APT_BEGIN_EXTERN_C
30 
31 /** Max number of messages grouped in a container */
32 #define MAX_MPF_MESSAGE_COUNT 5
33 
34 /** Enumeration of MPF message types */
35 typedef enum {
36 	MPF_MESSAGE_TYPE_REQUEST,  /**< request message */
37 	MPF_MESSAGE_TYPE_RESPONSE, /**< response message */
38 	MPF_MESSAGE_TYPE_EVENT     /**< event message */
39 } mpf_message_type_e;
40 
41 /** Enumeration of MPF status codes */
42 typedef enum {
43 	MPF_STATUS_CODE_SUCCESS,  /**< indicates success */
44 	MPF_STATUS_CODE_FAILURE   /**< indicates failure */
45 } mpf_status_code_e;
46 
47 
48 /** Enumeration of MPF commands */
49 typedef enum {
50 	MPF_ADD_TERMINATION,     /**< add termination to context */
51 	MPF_MODIFY_TERMINATION,  /**< modify termination properties */
52 	MPF_SUBTRACT_TERMINATION,/**< subtract termination from context */
53 	MPF_ADD_ASSOCIATION,     /**< add association between terminations */
54 	MPF_REMOVE_ASSOCIATION,  /**< remove association between terminations */
55 	MPF_RESET_ASSOCIATIONS,  /**< reset associations among terminations (also destroy topology) */
56 	MPF_APPLY_TOPOLOGY,      /**< apply topology based on assigned associations */
57 	MPF_DESTROY_TOPOLOGY     /**< destroy applied topology */
58 } mpf_command_type_e;
59 
60 /** MPF message declaration */
61 typedef struct mpf_message_t mpf_message_t;
62 /** MPF message container declaration */
63 typedef struct mpf_message_container_t mpf_message_container_t;
64 
65 /** MPF message definition */
66 struct mpf_message_t {
67 	/** Message type (request/response/event) */
68 	mpf_message_type_e message_type;
69 	/** Command identifier (add, modify, subtract, ...) */
70 	mpf_command_type_e command_id;
71 	/** Status code used in responses */
72 	mpf_status_code_e  status_code;
73 
74 	/** Context */
75 	mpf_context_t     *context;
76 	/** Termination */
77 	mpf_termination_t *termination;
78 	/** Associated termination */
79 	mpf_termination_t *assoc_termination;
80 	/** Termination type dependent descriptor */
81 	void              *descriptor;
82 };
83 
84 /** MPF message container definition */
85 struct mpf_message_container_t {
86 	/** Number of actual messages */
87 	apr_size_t    count;
88 	/** Array of messages */
89 	mpf_message_t messages[MAX_MPF_MESSAGE_COUNT];
90 };
91 
92 APT_END_EXTERN_C
93 
94 #endif /* MPF_MESSAGE_H */
95