diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2024-01-31 02:18:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-31 02:18:20 +0200 |
| commit | 642078de8e9c277fc90d11f9976afe475ef4bac8 (patch) | |
| tree | 0a87e04fb4347d9f93aaa0739c025b15323b4a4e /lib/mgmt_msg_native.h | |
| parent | 2a572bad9189e1ed97c5d1449283b8dd249c9253 (diff) | |
| parent | ecc88c52ba15d9a1cbd625d5c54f0748393bdbe5 (diff) | |
Merge pull request #15254 from LabNConsulting/chopps/notifications
Add YANG notifications
Diffstat (limited to 'lib/mgmt_msg_native.h')
| -rw-r--r-- | lib/mgmt_msg_native.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/mgmt_msg_native.h b/lib/mgmt_msg_native.h index 069cb9b150..93a94fc15c 100644 --- a/lib/mgmt_msg_native.h +++ b/lib/mgmt_msg_native.h @@ -143,6 +143,7 @@ DECLARE_MTYPE(MSG_NATIVE_ERROR); DECLARE_MTYPE(MSG_NATIVE_GET_TREE); DECLARE_MTYPE(MSG_NATIVE_TREE_DATA); DECLARE_MTYPE(MSG_NATIVE_GET_DATA); +DECLARE_MTYPE(MSG_NATIVE_NOTIFY); /* * Native message codes @@ -151,6 +152,7 @@ DECLARE_MTYPE(MSG_NATIVE_GET_DATA); #define MGMT_MSG_CODE_GET_TREE 1 #define MGMT_MSG_CODE_TREE_DATA 2 #define MGMT_MSG_CODE_GET_DATA 3 +#define MGMT_MSG_CODE_NOTIFY 4 /** * struct mgmt_msg_header - Header common to all native messages. @@ -257,8 +259,29 @@ _Static_assert(sizeof(struct mgmt_msg_get_data) == offsetof(struct mgmt_msg_get_data, xpath), "Size mismatch"); +/** + * struct mgmt_msg_notify_data - Message carrying notification data. + * + * @result_type: ``LYD_FORMAT`` for format of the @result value. + * @result: The tree data in @result_type format. + * + */ +struct mgmt_msg_notify_data { + struct mgmt_msg_header; + uint8_t result_type; + uint8_t resv2[7]; + + alignas(8) uint8_t result[]; +}; +_Static_assert(sizeof(struct mgmt_msg_notify_data) == + offsetof(struct mgmt_msg_notify_data, result), + "Size mismatch"); + +/* + * Validate that the message ends in a NUL terminating byte + */ #define MGMT_MSG_VALIDATE_NUL_TERM(msgp, len) \ - ((len) >= sizeof(*msg) + 1 && ((char *)msgp)[(len)-1] == 0) + ((len) >= sizeof(*msgp) + 1 && ((char *)msgp)[(len)-1] == 0) /** |
