grpc in shape
This commit is contained in:
parent
5ead099d0b
commit
b711faade9
4 changed files with 30 additions and 27 deletions
|
|
@ -452,6 +452,7 @@ text_modify(clicon_handle h,
|
||||||
* Check if namespace exists in x0 parent
|
* Check if namespace exists in x0 parent
|
||||||
* if not add new binding and replace in x0.
|
* if not add new binding and replace in x0.
|
||||||
* See also xmlns copying of attributes in the body section below
|
* See also xmlns copying of attributes in the body section below
|
||||||
|
* Note that this may add "unnecessary" namespace declarations
|
||||||
*/
|
*/
|
||||||
if (assign_namespace_element(x1, x0, x0p) < 0)
|
if (assign_namespace_element(x1, x0, x0p) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,17 @@ APPSRC += clixon_util_xpath.c
|
||||||
APPSRC += clixon_util_path.c
|
APPSRC += clixon_util_path.c
|
||||||
APPSRC += clixon_util_datastore.c
|
APPSRC += clixon_util_datastore.c
|
||||||
APPSRC += clixon_util_regexp.c
|
APPSRC += clixon_util_regexp.c
|
||||||
ifdef with_restconf
|
|
||||||
APPSRC += clixon_util_stream.c # Needs curl
|
|
||||||
endif
|
|
||||||
APPSRC += clixon_util_socket.c
|
APPSRC += clixon_util_socket.c
|
||||||
APPSRC += clixon_netconf_ssh_callhome.c
|
APPSRC += clixon_netconf_ssh_callhome.c
|
||||||
APPSRC += clixon_netconf_ssh_callhome_client.c
|
APPSRC += clixon_netconf_ssh_callhome_client.c
|
||||||
#APPSRC += clixon_util_ssl.c
|
ifdef with_restconf
|
||||||
#APPSRC += clixon_util_grpc.c
|
APPSRC += clixon_util_stream.c # Needs curl
|
||||||
|
endif
|
||||||
|
ifdef with_http2
|
||||||
|
APPSRC += clixon_util_ssl.c # requires http/2
|
||||||
|
#APPSRC += clixon_util_grpc.c # work in progress
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
APPS = $(APPSRC:.c=)
|
APPS = $(APPSRC:.c=)
|
||||||
|
|
||||||
|
|
@ -132,19 +135,19 @@ clixon_util_xml_mod: clixon_util_xml_mod.c $(LIBDEPS)
|
||||||
clixon_util_regexp: clixon_util_regexp.c $(LIBDEPS)
|
clixon_util_regexp: clixon_util_regexp.c $(LIBDEPS)
|
||||||
$(CC) $(INCLUDES) -I /usr/include/libxml2 $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
$(CC) $(INCLUDES) -I /usr/include/libxml2 $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
ifdef with_restconf
|
|
||||||
clixon_util_stream: clixon_util_stream.c $(LIBDEPS)
|
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -lcurl -o $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
clixon_util_socket: clixon_util_socket.c $(LIBDEPS)
|
clixon_util_socket: clixon_util_socket.c $(LIBDEPS)
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
#clixon_util_ssl: clixon_util_ssl.c $(LIBDEPS)
|
ifdef with_restconf
|
||||||
# $(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -lnghttp2 -lssl -lcrypto -o $@
|
clixon_util_stream: clixon_util_stream.c $(LIBDEPS)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -lcurl -o $@
|
||||||
|
|
||||||
#clixon_util_grpc: clixon_util_grpc.c $(LIBDEPS)
|
clixon_util_ssl: clixon_util_ssl.c $(LIBDEPS)
|
||||||
# $(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -lnghttp2 -lssl -lcrypto -o $@
|
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
clixon_util_grpc: clixon_util_grpc.c $(LIBDEPS)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile *~ .depend
|
rm -f Makefile *~ .depend
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,11 @@
|
||||||
|
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
* XML support functions.
|
*
|
||||||
* @see https://www.w3.org/TR/2008/REC-xml-20081126
|
* HTTP2 + OPENSSL client integrated with clixon events
|
||||||
* https://www.w3.org/TR/2009/REC-xml-names-20091208
|
* Ubuntu package:
|
||||||
* The function can do yang validation, process xml and json, etc.
|
* apt install libnghttp2-dev
|
||||||
* On success, nothing is printed and exitcode 0
|
* Example run: clixon_util_ssl -H nghttp2.org
|
||||||
* On failure, an error is printed on stderr and exitcode != 0
|
|
||||||
* Failure error prints are different, it would be nice to make them more
|
|
||||||
* uniform. (see clixon_netconf_error)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
|
|
@ -130,7 +127,7 @@ send_callback(nghttp2_session *session,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
clicon_debug(1, "%s %d:", __FUNCTION__, length);
|
clicon_debug(1, "%s %zu:", __FUNCTION__, length);
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -481,6 +478,7 @@ main(int argc,
|
||||||
int ret;
|
int ret;
|
||||||
nghttp2_session *session = NULL;
|
nghttp2_session *session = NULL;
|
||||||
session_data *sd = NULL;
|
session_data *sd = NULL;
|
||||||
|
int dbg = 0;
|
||||||
|
|
||||||
/* In the startup, logs to stderr & debug flag set later */
|
/* In the startup, logs to stderr & debug flag set later */
|
||||||
clicon_log_init(__FILE__, LOG_INFO, CLICON_LOG_STDERR);
|
clicon_log_init(__FILE__, LOG_INFO, CLICON_LOG_STDERR);
|
||||||
|
|
@ -493,7 +491,7 @@ main(int argc,
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
if (sscanf(optarg, "%d", &debug) != 1)
|
if (sscanf(optarg, "%d", &dbg) != 1)
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
break;
|
break;
|
||||||
case 'H': /* hostname */
|
case 'H': /* hostname */
|
||||||
|
|
@ -507,6 +505,7 @@ main(int argc,
|
||||||
fprintf(stderr, "-H <hostname> is mandatory\n");
|
fprintf(stderr, "-H <hostname> is mandatory\n");
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
}
|
}
|
||||||
|
clicon_debug_init(dbg, NULL);
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
if ((ctx = InitCTX()) == NULL)
|
if ((ctx = InitCTX()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@
|
||||||
|
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
*
|
* Actually HTTP2 + OPENSSL client integrated with clixon events
|
||||||
* HTTP2 + OPENSSL client integrated with clixon events
|
|
||||||
* Ubuntu package:
|
* Ubuntu package:
|
||||||
* apt install libnghttp2-dev
|
* apt install libnghttp2-dev
|
||||||
* Example run: clixon_util_ssl -H nghttp2.org
|
* Example run: clixon_util_ssl -H nghttp2.org
|
||||||
|
|
@ -54,9 +53,10 @@
|
||||||
#include <arpa/inet.h> /* inet_pton */
|
#include <arpa/inet.h> /* inet_pton */
|
||||||
#include <netinet/tcp.h> /* TCP_NODELAY */
|
#include <netinet/tcp.h> /* TCP_NODELAY */
|
||||||
|
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
#include <nghttp2/nghttp2.h>
|
#include <nghttp2/nghttp2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* cligen */
|
/* cligen */
|
||||||
#include <cligen/cligen.h>
|
#include <cligen/cligen.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue