This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/649 Add function to send TRAP over Control Interface Change-Id: Ic0b8d88c4f5c4d42c3f8fb754f8eabf049c9e388 Related: OS#1646 --- M include/osmocom/ctrl/control_if.h M src/ctrl/control_if.c 2 files changed, 21 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/649/1 diff --git a/include/osmocom/ctrl/control_if.h b/include/osmocom/ctrl/control_if.h index 181c60a..65603d4 100644 --- a/include/osmocom/ctrl/control_if.h +++ b/include/osmocom/ctrl/control_if.h @@ -20,6 +20,7 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); +int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, char *name, char *value); struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup); struct ctrl_handle *ctrl_interface_setup_dynip(void *data, diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index 6d9a9fb..aac6239 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -117,6 +117,26 @@ return ret; } +/*! \brief Send TRAP over given Control Interface + * \param[in] ctrl Control Interface over which TRAP will be sent + * \param[in] name Name of the TRAP variable + * \param[in] value Value of the TRAP variable + * \return Negative value on error, result of ctrl_cmd_send_to_all() otherwise + */ +int ctrl_cmd_send_trap(struct ctrl_handle *ctrl, char *name, char *value) +{ + struct ctrl_cmd *cmd = ctrl_cmd_create(NULL, CTRL_TYPE_TRAP); + if (!cmd) + return -ENOMEM; + + cmd->id = "0"; /* It's a TRAP! */ + cmd->variable = name; + cmd->reply = value; + int r = ctrl_cmd_send_to_all(ctrl, cmd); + talloc_free(cmd); + return r; +} + struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd) { struct ctrl_cmd *trap; -- To view, visit https://gerrit.osmocom.org/649 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic0b8d88c4f5c4d42c3f8fb754f8eabf049c9e388 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>