Fix code formatting and naming

This commit is contained in:
Mico Micic 2024-07-29 07:48:09 +02:00 committed by Olof Hagsand
parent 7d70325125
commit 8ee9b82152

View file

@ -55,14 +55,13 @@
#include "snmp_lib.h"
/*
* SNMP v2 notification OID
/* SNMP v2 notification OID
*/
static oid notificationOid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
struct stream_socket{
qelem_t sc_q; /* queue header */
int socket; /* socket */
int sc_socket; /* socket */
};
/* Linked list of sockets used to listen for events
*/
@ -77,7 +76,9 @@ static struct stream_socket *STREAM_SOCKETS = NULL;
* @retval -1 Error
*/
int
get_oid_for_yang_node(yang_stmt *ys, oid *objid, size_t *objidlen)
get_oid_for_yang_node(yang_stmt *ys,
oid *objid,
size_t *objidlen)
{
int retval = -1;
int exist = 0;
@ -106,7 +107,9 @@ done:
* @param[in] oid_len Length of notify_oid
*/
void
add_snmp_trapv2_oid(netsnmp_variable_list **var_list, oid *notify_oid, int oid_len)
add_snmp_trapv2_oid(netsnmp_variable_list **var_list,
oid *notify_oid,
int oid_len)
{
snmp_varlist_add_variable(
var_list,
@ -127,7 +130,9 @@ add_snmp_trapv2_oid(netsnmp_variable_list **var_list, oid *notify_oid, int oid_l
* @param[in] ys YANG node
*/
int
add_snmp_var_bindings(netsnmp_variable_list **var_list, cxobj *cxparent, yang_stmt *ys)
add_snmp_var_bindings(netsnmp_variable_list **var_list,
cxobj *cxparent,
yang_stmt *ys)
{
int retval = -1;
int ret;
@ -201,7 +206,8 @@ done:
* @retval -1 Error
*/
static int
snmp_publish_notification(clixon_handle h, cxobj *xn)
snmp_publish_notification(clixon_handle h,
cxobj *xn)
{
int retval = -1;
cxobj *xncont = NULL; /* notification content xml */
@ -249,7 +255,8 @@ snmp_publish_notification(clixon_handle h, cxobj *xn)
* @retval -1 Error
*/
static int
snmp_stream_cb(int s, void *arg)
snmp_stream_cb(int s,
void *arg)
{
int retval = -1;
clixon_handle h = (clixon_handle)arg;
@ -302,7 +309,9 @@ snmp_stream_cb(int s, void *arg)
* @retval -1 Error
*/
static int
snmp_stream_subscribe(clixon_handle h, char *stream, int *socket)
snmp_stream_subscribe(clixon_handle h,
char *stream,
int *socket)
{
int retval = -1;
cxobj *xret = NULL;
@ -343,8 +352,8 @@ clixon_snmp_stream_shutdown(clixon_handle h)
while ((sc = STREAM_SOCKETS) != NULL){
DELQ(sc, STREAM_SOCKETS, struct stream_socket *);
clixon_event_unreg_fd(sc->socket, snmp_stream_cb);
close(sc->socket);
clixon_event_unreg_fd(sc->sc_socket, snmp_stream_cb);
close(sc->sc_socket);
free(sc);
}
return 0;
@ -359,7 +368,9 @@ clixon_snmp_stream_shutdown(clixon_handle h)
* @retval -1 Error
*/
int
get_all_streams_from_backend(clixon_handle h, char ***streams, int *count)
get_all_streams_from_backend(clixon_handle h,
char ***streams,
int *count)
{
int retval = -1;
cxobj *xret = NULL;
@ -457,7 +468,7 @@ clixon_snmp_stream_init(clixon_handle h)
clixon_err(OE_SNMP, errno, "malloc");
goto done;
}
stream_socket->socket = socket;
stream_socket->sc_socket = socket;
ADDQ(stream_socket, STREAM_SOCKETS);
}
}
@ -470,7 +481,6 @@ clixon_snmp_stream_init(clixon_handle h)
free(streams[i]);
free(streams);
}
clixon_debug(CLIXON_DBG_SNMP, "retval: %d", retval);
return retval;
}