all clixon event functions prepended with clixon_

Replaced fcgi getparam code with clixon-data parameters
This commit is contained in:
Olof hagsand 2020-06-05 16:19:03 +02:00
parent a455b15f03
commit 14b03f63a3
34 changed files with 567 additions and 877 deletions

View file

@ -1,7 +1,9 @@
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
# Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
# Copyright (C) 2017-2019 Olof Hagsand
# Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgat)e
#
# This file is part of CLIXON
#
@ -63,7 +65,7 @@ NETCONF_PLUGIN = $(APPNAME)_netconf.so
RESTCONF_PLUGIN = $(APPNAME)_restconf.so
PLUGINS = $(BE_PLUGIN) $(BE2_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN)
ifeq ($(with_restconf),yes)
ifdef with_restconf
PLUGINS += $(RESTCONF_PLUGIN)
endif
@ -138,7 +140,7 @@ install: $(YANGSPECS) $(CLISPECS) $(PLUGINS) $(APPNAME).xml
install -m 0644 $(INSTALLFLAGS) $(BE_PLUGIN) $(BE2_PLUGIN) $(DESTDIR)$(libdir)/$(APPNAME)/backend
install -d -m 0755 $(DESTDIR)$(libdir)/$(APPNAME)/netconf
install -m 0644 $(INSTALLFLAGS) $(NETCONF_PLUGIN) $(DESTDIR)$(libdir)/$(APPNAME)/netconf
ifeq ($(with_restconf),yes)
ifdef with_restconf
install -d -m 0755 $(DESTDIR)$(libdir)/$(APPNAME)/restconf
install -m 0644 $(INSTALLFLAGS) $(RESTCONF_PLUGIN) $(DESTDIR)$(libdir)/$(APPNAME)/restconf
endif

View file

@ -235,7 +235,7 @@ example_stream_timer_setup(clicon_handle h)
gettimeofday(&t, NULL);
t1.tv_sec = 5; t1.tv_usec = 0;
timeradd(&t, &t1, &t);
return event_reg_timeout(t, example_stream_timer, h, "example stream timer");
return clixon_event_reg_timeout(t, example_stream_timer, h, "example stream timer");
}
/*! Smallest possible RPC declaration for test

View file

@ -2,7 +2,9 @@
*
***** BEGIN LICENSE BLOCK *****
Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
Copyright (C) 2017-2019 Olof Hagsand
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgat)e
This file is part of CLIXON.
@ -31,6 +33,8 @@
***** END LICENSE BLOCK *****
*
* This code uses WITH_RESTCONF_FCGI to identify its run with fcgi intreface for ca_auth
* This should be changed.
*/
#include <stdlib.h>
@ -39,13 +43,13 @@
#include <errno.h>
#include <ctype.h>
#include <signal.h>
#include <fcgiapp.h>
/* cligen */
#include <cligen/cligen.h>
/* clicon */
#include <clixon/clixon.h>
#include <clixon/clixon_restconf.h> /* minor use */
static const char Base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ -197,23 +201,22 @@ example_restconf_credentials(clicon_handle h,
void *arg)
{
int retval = -1;
FCGX_Request *r = (FCGX_Request *)arg;
cxobj *xt = NULL;
char *auth;
char *user = NULL;
cbuf *cb = NULL;
char *auth;
char *passwd;
char *passwd2 = "";
size_t authlen;
cbuf *cb = NULL;
int ret;
/* HTTP basic authentication not enabled, pass with user "none" */
if (basic_auth==0)
goto ok;
/* At this point in the code we must use HTTP basic authentication */
if ((auth = FCGX_GetParam("HTTP_AUTHORIZATION", r->envp)) == NULL)
if ((auth = clixon_restconf_param_get(h, "HTTP_AUTHORIZATION")) == NULL)
goto fail;
if (strlen(auth) < strlen("Basic "))
if (strlen(auth) < strlen("Basic "))
goto fail;
if (strncmp("Basic ", auth, strlen("Basic ")))
goto fail;