yumapro  20.10-12
YumaPro SDK
ycontrol_msg_cmn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_ycontrol_msg_cmn
13 #define _H_ycontrol_msg_cmn
14 
15 /* FILE: ycontrol_msg_cmn.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 08-apr-14 abb Begun
37 */
38 
39 #ifndef _H_status_enum
40 #include "status_enum.h"
41 #endif
42 
43 #include <xmlstring.h>
44 
45 #ifndef _H_obj
46 #include "obj.h"
47 #endif
48 
49 #ifndef _H_val
50 #include "val.h"
51 #endif
52 
53 #ifndef _H_ycontrol_types
54 #include "ycontrol_types.h"
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /********************************************************************
62 * *
63 * C O N S T A N T S *
64 * *
65 *********************************************************************/
66 #define YCONTROL_SEND_FAILED (const xmlChar *)"send failed"
67 
68 
69 /********************************************************************
70 * *
71 * T Y P E S *
72 * *
73 *********************************************************************/
74 
75 
76 /********************************************************************
77 * *
78 * F U N C T I O N S *
79 * *
80 *********************************************************************/
81 
82 
106 extern const xmlChar *
107  ycontrol_msg_cmn_get_msgtype (ycontrol_msgtype_t msgtype);
108 
109 
118 extern ycontrol_msgtype_t
119  ycontrol_msg_cmn_get_msgtype_enum (val_value_t *msgval,
120  status_t *res);
121 
122 
136 extern status_t
137  ycontrol_msg_cmn_new (const xmlChar *server_id,
138  const xmlChar *subsys_id,
139  obj_template_t *msgobj,
140  uint32 msgid,
141  ycontrol_msgtype_t msgtype,
142  const xmlChar *service_id,
143  val_value_t **ret_msgval);
144 
145 
157 extern status_t
158  ycontrol_msg_cmn_reuse (val_value_t *msgval,
159  uint32 msgid,
160  ycontrol_msgtype_t msgtype,
161  const xmlChar *server_id,
162  const xmlChar *subsys_id,
163  const xmlChar *service_id);
164 
165 
175 extern status_t
176  ycontrol_msg_cmn_new_payload (obj_template_t *msgobj,
177  val_value_t **ret_payload);
178 
179 
180 
192 extern status_t
193  ycontrol_msg_cmn_new_error (obj_template_t *msgobj,
194  status_t res,
195  const xmlChar *errstr,
196  val_value_t **ret_error);
197 
198 
207 extern status_t
208  ycontrol_msg_cmn_reuse_error (val_value_t *error_val,
209  status_t res,
210  const xmlChar *errstr);
211 
212 
221 extern status_t
222  ycontrol_msg_cmn_new_ok (obj_template_t *msgobj,
223  val_value_t **ret_ok);
224 
225 
229 #ifdef __cplusplus
230 } /* end extern 'C' */
231 #endif
232 
233 #endif /* _H_ycontrol_msg */
ses.h
NETCONF Session Common definitions module.
YCONTROL_MSG_SERVER_REQUEST
@ YCONTROL_MSG_SERVER_REQUEST
server-request sent from server to subsystem
Definition: ycontrol_types.h:72
val_set_simval_obj
status_t val_set_simval_obj(val_value_t *val, obj_template_t *obj, const xmlChar *valstr)
Set an initialized val_value_t as a simple type.
Definition: val_util.c:4444
ycontrol_msg_cmn_new_ok
status_t ycontrol_msg_cmn_new_ok(obj_template_t *msgobj, val_value_t **ret_ok)
Create a new YControl OK response message.
Definition: ycontrol_msg_cmn.c:477
val_find_child
val_value_t * val_find_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8560
val.h
Value Node Basic Support.
val_make_simval_obj
val_value_t * val_make_simval_obj(obj_template_t *obj, const xmlChar *valstr, status_t *res)
Create and set a val_value_t as a simple type from an object template instead of individual fields Ca...
Definition: val_util.c:4389
VAL_UINT32
#define VAL_UINT32(V)
Access the value as an uint32 ONLY if NCX_BT_UINT32.
Definition: val.h:497
status_enum.h
global error status code enumerations
ycontrol_msg_cmn_get_msgtype
const xmlChar * ycontrol_msg_cmn_get_msgtype(ycontrol_msgtype_t msgtype)
Get the string for the message type enumeration.
Definition: ycontrol_msg_cmn.c:75
ncx_num.h
NCX Module Library Number Utility Functions.
YCONTROL_MSG_SUBSYS_REQUEST
@ YCONTROL_MSG_SUBSYS_REQUEST
subsystem-request sent from subsystem to server
Definition: ycontrol_types.h:81
ncxconst.h
Contains NCX constants.
ses_msg.h
NETCONF Session Message Common definitions module.
subsys_util.h
Thin client IO handler for YumaPro server (utility functions)
VAL_ENUM_NAME
#define VAL_ENUM_NAME(V)
Access the enum name in the value ONLY if BCX_NT_ENUM This is the macro used to check values in SIL c...
Definition: val.h:434
ycontrol_msg_cmn_new_payload
status_t ycontrol_msg_cmn_new_payload(obj_template_t *msgobj, val_value_t **ret_payload)
Create a new payload value for the message object.
Definition: ycontrol_msg_cmn.c:338
ycontrol_msg_cmn_reuse
status_t ycontrol_msg_cmn_reuse(val_value_t *msgval, uint32 msgid, ycontrol_msgtype_t msgtype, const xmlChar *server_id, const xmlChar *subsys_id, const xmlChar *service_id)
Reuse a message value struct and replace only changing fields.
Definition: ycontrol_msg_cmn.c:265
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
val_add_child
void val_add_child(val_value_t *child, val_value_t *parent)
Add a child (deprecated: use val_child_add instead)
Definition: val.c:8231
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
val_util.h
Value Node Utilities.
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
ycontrol_msg_cmn_get_msgtype_enum
ycontrol_msgtype_t ycontrol_msg_cmn_get_msgtype_enum(val_value_t *msgval, status_t *res)
Get the message type enumeration from the message.
Definition: ycontrol_msg_cmn.c:114
YCONTROL_MSG_NONE
@ YCONTROL_MSG_NONE
not set
Definition: ycontrol_types.h:66
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
subsystem.h
Thin client IO handler for YumaPro server.
YCONTROL_MSG_SERVER_RESPONSE
@ YCONTROL_MSG_SERVER_RESPONSE
server-response sent from server to subsystem
Definition: ycontrol_types.h:75
EMPTY_STRING
#define EMPTY_STRING
empty string used to get const xmlChar * cast
Definition: ncxconst.h:289
obj_find_child
obj_template_t * obj_find_child(obj_template_t *obj, const xmlChar *modname, const xmlChar *objname)
Find a child object with the specified Qname.
Definition: obj.c:6116
YCONTROL_MSG_SERVER_EVENT
@ YCONTROL_MSG_SERVER_EVENT
server-event sent from server to subsystem
Definition: ycontrol_types.h:69
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
ycontrol_msg_cmn.h
YControl Message Utilities.
YCONTROL_MSG_SUBSYS_EVENT
@ YCONTROL_MSG_SUBSYS_EVENT
subsystem-event sent from subsystem to server
Definition: ycontrol_types.h:78
ycontrol_msg_cmn_new_error
status_t ycontrol_msg_cmn_new_error(obj_template_t *msgobj, status_t res, const xmlChar *errstr, val_value_t **ret_error)
Create a new YControl error response message.
Definition: ycontrol_msg_cmn.c:372
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
ncx.h
YANG module utility functions.
obj.h
Data Object Support.
ycontrol.h
YumaPro Subsystem Control Protocol.
ycontrol_types.h
Some YControl data types.
val_init_from_template
void val_init_from_template(val_value_t *val, struct obj_template_t_ *obj)
Initialize a value node from its object template.
YCONTROL_MSG_SUBSYS_RESPONSE
@ YCONTROL_MSG_SUBSYS_RESPONSE
subsystem-response sent from subsystem to server
Definition: ycontrol_types.h:84
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
ycontrol_msg_cmn_new
status_t ycontrol_msg_cmn_new(const xmlChar *server_id, const xmlChar *subsys_id, obj_template_t *msgobj, uint32 msgid, ycontrol_msgtype_t msgtype, const xmlChar *service_id, val_value_t **ret_msgval)
Create a new YControl message.
Definition: ycontrol_msg_cmn.c:153
ycontrol_msg_cmn_reuse_error
status_t ycontrol_msg_cmn_reuse_error(val_value_t *error_val, status_t res, const xmlChar *errstr)
Reuse an error message value struct and replace only changing fields.
Definition: ycontrol_msg_cmn.c:440
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842