msg.h
Go to the documentation of this file.
1 /* vim: set ts=2 expandtab: */
2 /**
3  * @file msg.h
4  * @brief a simple message serialization library
5  *
6  * @author Josh King (jheretic), jking@chambana.net
7  *
8  * @internal
9  * Created 03/07/2013
10  * Revision $Id: doxygen.commotion.templates,v 0.1 2013/01/01 09:00:00 jheretic Exp $
11  * Compiler gcc/g++
12  * Company The Open Technology Institute
13  * Copyright Copyright (c) 2013, Josh King
14  *
15  * This file is part of Commotion, Copyright (c) 2013, Josh King
16  *
17  * Commotion is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU Affero General Public License as
19  * published by the Free Software Foundation, either version 3 of the
20  * License, or (at your option) any later version.
21  *
22  * Commotion is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU Affero General Public License for more details.
26  *
27  * You should have received a copy of the GNU Affero General Public License
28  * along with Commotion. If not, see <http://www.gnu.org/licenses/>.
29  *
30  * =====================================================================================
31  */
32 
33 #ifndef _MSG_H
34 #define _MSG_H
35 
36 #include <stdlib.h>
37 #include <stddef.h>
38 #include <inttypes.h>
39 #include "obj.h"
40 
41 /**
42  * @brief allocate request
43  * @param output buffer for output
44  * @param olen output buffer length
45  * @param method name of method
46  * @param param parameters to method
47  */
48 size_t co_request_alloc(char *output, const size_t olen, const co_obj_t *method, co_obj_t *param);
49 
50 /**
51  * @brief allocate response
52  * @param output buffer for output
53  * @param olen output buffer length
54  * @param id response ID
55  * @param error error object
56  * @param result result of request
57  */
58 size_t co_response_alloc(char *output, const size_t olen, const uint32_t id, const co_obj_t *error, co_obj_t *result);
59 
60 #endif
Commotion object model.
size_t co_response_alloc(char *output, const size_t olen, const uint32_t id, const co_obj_t *error, co_obj_t *result)
allocate response
Definition: msg.c:141
Definition: obj.h:131
size_t co_request_alloc(char *output, const size_t olen, const co_obj_t *method, co_obj_t *param)
allocate request
Definition: msg.c:64