diff options
Diffstat (limited to 'lib/logsrv')
-rw-r--r-- | lib/logsrv/Makefile.in | 186 | ||||
-rw-r--r-- | lib/logsrv/log_server.pb-c.c | 1766 | ||||
-rw-r--r-- | lib/logsrv/log_server.proto | 136 |
3 files changed, 2088 insertions, 0 deletions
diff --git a/lib/logsrv/Makefile.in b/lib/logsrv/Makefile.in new file mode 100644 index 0000000..f81698f --- /dev/null +++ b/lib/logsrv/Makefile.in @@ -0,0 +1,186 @@ +# +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2019-2020 Todd C. Miller <Todd.Miller@sudo.ws> +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# @configure_input@ +# + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +abs_srcdir = @abs_srcdir@ +top_srcdir = @top_srcdir@ +abs_top_srcdir = @abs_top_srcdir@ +top_builddir = @top_builddir@ +abs_top_builddir = @abs_top_builddir@ +devdir = @devdir@ +scriptdir = $(top_srcdir)/scripts +incdir = $(top_srcdir)/include + +# Compiler & tools to use +CC = @CC@ +LIBTOOL = @LIBTOOL@ + +# Libraries +LT_LIBS = + +# C preprocessor flags +CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(srcdir) -I$(top_srcdir) @CPPFLAGS@ + +# Usually -O and/or -g +CFLAGS = @CFLAGS@ + +# Flags to pass to libtool +LTFLAGS = @LT_STATIC@ + +# Address sanitizer flags +ASAN_CFLAGS = @ASAN_CFLAGS@ +ASAN_LDFLAGS = @ASAN_LDFLAGS@ + +# PIE flags +PIE_CFLAGS = @PIE_CFLAGS@ +PIE_LDFLAGS = @PIE_LDFLAGS@ + +# Stack smashing protection flags +HARDENING_CFLAGS = @HARDENING_CFLAGS@ +HARDENING_LDFLAGS = @HARDENING_LDFLAGS@ + +# cppcheck options, usually set in the top-level Makefile +CPPCHECK_OPTS = -q --enable=warning,performance,portability --suppress=constStatement --suppress=compareBoolExpressionWithInt --error-exitcode=1 --inline-suppr -Dva_copy=va_copy -U__cplusplus -UQUAD_MAX -UQUAD_MIN -UUQUAD_MAX -U_POSIX_HOST_NAME_MAX -U_POSIX_PATH_MAX -U__NBBY -DNSIG=64 + +# splint options, usually set in the top-level Makefile +SPLINT_OPTS = -D__restrict= -checks + +# PVS-studio options +PVS_CFG = $(top_srcdir)/PVS-Studio.cfg +PVS_IGNORE = 'V707,V011,V002,V536' +PVS_LOG_OPTS = -a 'GA:1,2' -e -t errorfile -d $(PVS_IGNORE) + +# Set to non-empty for development mode +DEVEL = @DEVEL@ + +#### End of system configuration section. #### + +SHELL = @SHELL@ + +LIBLOGSRV_OBJS = log_server.pb-c.lo + +IOBJS = $(LIBLOGSRV_OBJS:.lo=.i) + +POBJS = $(IOBJS:.i=.plog) + +GENERATED = log_server.pb-c.h log_server.pb-c.c + +all: liblogsrv.la + +depend: + $(scriptdir)/mkdep.pl --srcdir=$(abs_top_srcdir) \ + --builddir=$(abs_top_builddir) lib/logsrv/Makefile.in + cd $(top_builddir) && ./config.status --file lib/logsrv/Makefile + +Makefile: $(srcdir)/Makefile.in + cd $(top_builddir) && ./config.status --file lib/logsrv/Makefile + +.SUFFIXES: .c .h .i .lo .plog + +.c.lo: + $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(ASAN_CFLAGS) $(PIE_CFLAGS) $(HARDENING_CFLAGS) $< + +.c.i: + $(CC) -E -o $@ $(CPPFLAGS) $< + +.i.plog: + ifile=$<; rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $${ifile%i}c --i-file $< --output-file $@ + +$(devdir)/log_server.pb-c.c: $(srcdir)/log_server.proto + @if [ -n "$(DEVEL)" ]; then \ + cmd='protoc-c --c_out=$(devdir) --proto_path=$(srcdir) $(srcdir)/log_server.proto'; \ + echo "$$cmd"; eval $$cmd; \ + cmd='$(scriptdir)/unanon $(devdir)/log_server.pb-c.h $(devdir)/log_server.pb-c.c'; \ + echo "$$cmd"; eval $$cmd; \ + if [ "$(devdir)" == "$(srcdir)" ]; then \ + cmd='mv -f $(devdir)/log_server.pb-c.h $(incdir)/log_server.pb-c.h'; \ + else \ + cmd='mv -f $(devdir)/log_server.pb-c.h $(top_builddir)/log_server.pb-c.h'; \ + fi; \ + echo "$$cmd"; eval $$cmd; \ + fi + +liblogsrv.la: $(LIBLOGSRV_OBJS) $(LT_LIBS) + $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) -o $@ $(LIBLOGSRV_OBJS) $(LT_LIBS) + +pre-install: + +install: + +install-binaries: + +install-includes: + +install-doc: + +install-plugin: + +install-fuzzer: + +uninstall: + +splint: + splint $(SPLINT_OPTS) -I$(incdir) -I$(top_builddir) -I$(top_srcdir) $(srcdir)/*.c + +cppcheck: + cppcheck $(CPPCHECK_OPTS) -I$(incdir) -I$(top_builddir) -I$(top_srcdir) $(srcdir)/*.c + +pvs-log-files: + +pvs-studio: + +fuzz: + +check-fuzzer: + +check: check-fuzzer + +check-verbose: check + +clean: + -$(LIBTOOL) $(LTFLAGS) --mode=clean rm -f *.lo *.o *.la + -rm -f *.i *.plog stamp-* core *.core core.* + +mostlyclean: clean + +distclean: clean + -rm -rf Makefile .libs + @if [ -n "$(DEVEL)" -a "$(devdir)" != "$(srcdir)" ]; then \ + cmd='rm -rf $(GENERATED)'; \ + echo "$$cmd"; eval $$cmd; \ + fi + +clobber: distclean + +realclean: distclean + rm -f TAGS tags + +cleandir: realclean + +.PHONY: clean mostlyclean distclean cleandir clobber realclean + +# Autogenerated dependencies, do not modify +log_server.pb-c.lo: $(srcdir)/log_server.pb-c.c $(incdir)/log_server.pb-c.h \ + $(incdir)/protobuf-c/protobuf-c.h + $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(ASAN_CFLAGS) $(PIE_CFLAGS) $(HARDENING_CFLAGS) $(srcdir)/log_server.pb-c.c +log_server.pb-c.plog: $(srcdir)/log_server.pb-c.c + touch $@ diff --git a/lib/logsrv/log_server.pb-c.c b/lib/logsrv/log_server.pb-c.c new file mode 100644 index 0000000..21c87b8 --- /dev/null +++ b/lib/logsrv/log_server.pb-c.c @@ -0,0 +1,1766 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: log_server.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include <log_server.pb-c.h> +void client_message__init + (ClientMessage *message) +{ + static const ClientMessage init_value = CLIENT_MESSAGE__INIT; + *message = init_value; +} +size_t client_message__get_packed_size + (const ClientMessage *message) +{ + assert(message->base.descriptor == &client_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t client_message__pack + (const ClientMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &client_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t client_message__pack_to_buffer + (const ClientMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &client_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ClientMessage * + client_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ClientMessage *) + protobuf_c_message_unpack (&client_message__descriptor, + allocator, len, data); +} +void client_message__free_unpacked + (ClientMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &client_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void time_spec__init + (TimeSpec *message) +{ + static const TimeSpec init_value = TIME_SPEC__INIT; + *message = init_value; +} +size_t time_spec__get_packed_size + (const TimeSpec *message) +{ + assert(message->base.descriptor == &time_spec__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t time_spec__pack + (const TimeSpec *message, + uint8_t *out) +{ + assert(message->base.descriptor == &time_spec__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t time_spec__pack_to_buffer + (const TimeSpec *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &time_spec__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +TimeSpec * + time_spec__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (TimeSpec *) + protobuf_c_message_unpack (&time_spec__descriptor, + allocator, len, data); +} +void time_spec__free_unpacked + (TimeSpec *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &time_spec__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void io_buffer__init + (IoBuffer *message) +{ + static const IoBuffer init_value = IO_BUFFER__INIT; + *message = init_value; +} +size_t io_buffer__get_packed_size + (const IoBuffer *message) +{ + assert(message->base.descriptor == &io_buffer__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t io_buffer__pack + (const IoBuffer *message, + uint8_t *out) +{ + assert(message->base.descriptor == &io_buffer__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t io_buffer__pack_to_buffer + (const IoBuffer *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &io_buffer__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +IoBuffer * + io_buffer__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (IoBuffer *) + protobuf_c_message_unpack (&io_buffer__descriptor, + allocator, len, data); +} +void io_buffer__free_unpacked + (IoBuffer *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &io_buffer__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void info_message__string_list__init + (InfoMessage__StringList *message) +{ + static const InfoMessage__StringList init_value = INFO_MESSAGE__STRING_LIST__INIT; + *message = init_value; +} +void info_message__number_list__init + (InfoMessage__NumberList *message) +{ + static const InfoMessage__NumberList init_value = INFO_MESSAGE__NUMBER_LIST__INIT; + *message = init_value; +} +void info_message__init + (InfoMessage *message) +{ + static const InfoMessage init_value = INFO_MESSAGE__INIT; + *message = init_value; +} +size_t info_message__get_packed_size + (const InfoMessage *message) +{ + assert(message->base.descriptor == &info_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t info_message__pack + (const InfoMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &info_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t info_message__pack_to_buffer + (const InfoMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &info_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +InfoMessage * + info_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (InfoMessage *) + protobuf_c_message_unpack (&info_message__descriptor, + allocator, len, data); +} +void info_message__free_unpacked + (InfoMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &info_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void accept_message__init + (AcceptMessage *message) +{ + static const AcceptMessage init_value = ACCEPT_MESSAGE__INIT; + *message = init_value; +} +size_t accept_message__get_packed_size + (const AcceptMessage *message) +{ + assert(message->base.descriptor == &accept_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t accept_message__pack + (const AcceptMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &accept_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t accept_message__pack_to_buffer + (const AcceptMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &accept_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +AcceptMessage * + accept_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (AcceptMessage *) + protobuf_c_message_unpack (&accept_message__descriptor, + allocator, len, data); +} +void accept_message__free_unpacked + (AcceptMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &accept_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void reject_message__init + (RejectMessage *message) +{ + static const RejectMessage init_value = REJECT_MESSAGE__INIT; + *message = init_value; +} +size_t reject_message__get_packed_size + (const RejectMessage *message) +{ + assert(message->base.descriptor == &reject_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t reject_message__pack + (const RejectMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &reject_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t reject_message__pack_to_buffer + (const RejectMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &reject_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +RejectMessage * + reject_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (RejectMessage *) + protobuf_c_message_unpack (&reject_message__descriptor, + allocator, len, data); +} +void reject_message__free_unpacked + (RejectMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &reject_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void exit_message__init + (ExitMessage *message) +{ + static const ExitMessage init_value = EXIT_MESSAGE__INIT; + *message = init_value; +} +size_t exit_message__get_packed_size + (const ExitMessage *message) +{ + assert(message->base.descriptor == &exit_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t exit_message__pack + (const ExitMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &exit_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t exit_message__pack_to_buffer + (const ExitMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &exit_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ExitMessage * + exit_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ExitMessage *) + protobuf_c_message_unpack (&exit_message__descriptor, + allocator, len, data); +} +void exit_message__free_unpacked + (ExitMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &exit_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void alert_message__init + (AlertMessage *message) +{ + static const AlertMessage init_value = ALERT_MESSAGE__INIT; + *message = init_value; +} +size_t alert_message__get_packed_size + (const AlertMessage *message) +{ + assert(message->base.descriptor == &alert_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t alert_message__pack + (const AlertMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &alert_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t alert_message__pack_to_buffer + (const AlertMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &alert_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +AlertMessage * + alert_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (AlertMessage *) + protobuf_c_message_unpack (&alert_message__descriptor, + allocator, len, data); +} +void alert_message__free_unpacked + (AlertMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &alert_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void restart_message__init + (RestartMessage *message) +{ + static const RestartMessage init_value = RESTART_MESSAGE__INIT; + *message = init_value; +} +size_t restart_message__get_packed_size + (const RestartMessage *message) +{ + assert(message->base.descriptor == &restart_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t restart_message__pack + (const RestartMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &restart_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t restart_message__pack_to_buffer + (const RestartMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &restart_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +RestartMessage * + restart_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (RestartMessage *) + protobuf_c_message_unpack (&restart_message__descriptor, + allocator, len, data); +} +void restart_message__free_unpacked + (RestartMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &restart_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void change_window_size__init + (ChangeWindowSize *message) +{ + static const ChangeWindowSize init_value = CHANGE_WINDOW_SIZE__INIT; + *message = init_value; +} +size_t change_window_size__get_packed_size + (const ChangeWindowSize *message) +{ + assert(message->base.descriptor == &change_window_size__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t change_window_size__pack + (const ChangeWindowSize *message, + uint8_t *out) +{ + assert(message->base.descriptor == &change_window_size__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t change_window_size__pack_to_buffer + (const ChangeWindowSize *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &change_window_size__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ChangeWindowSize * + change_window_size__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ChangeWindowSize *) + protobuf_c_message_unpack (&change_window_size__descriptor, + allocator, len, data); +} +void change_window_size__free_unpacked + (ChangeWindowSize *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &change_window_size__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void command_suspend__init + (CommandSuspend *message) +{ + static const CommandSuspend init_value = COMMAND_SUSPEND__INIT; + *message = init_value; +} +size_t command_suspend__get_packed_size + (const CommandSuspend *message) +{ + assert(message->base.descriptor == &command_suspend__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t command_suspend__pack + (const CommandSuspend *message, + uint8_t *out) +{ + assert(message->base.descriptor == &command_suspend__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t command_suspend__pack_to_buffer + (const CommandSuspend *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &command_suspend__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +CommandSuspend * + command_suspend__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (CommandSuspend *) + protobuf_c_message_unpack (&command_suspend__descriptor, + allocator, len, data); +} +void command_suspend__free_unpacked + (CommandSuspend *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &command_suspend__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void client_hello__init + (ClientHello *message) +{ + static const ClientHello init_value = CLIENT_HELLO__INIT; + *message = init_value; +} +size_t client_hello__get_packed_size + (const ClientHello *message) +{ + assert(message->base.descriptor == &client_hello__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t client_hello__pack + (const ClientHello *message, + uint8_t *out) +{ + assert(message->base.descriptor == &client_hello__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t client_hello__pack_to_buffer + (const ClientHello *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &client_hello__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ClientHello * + client_hello__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ClientHello *) + protobuf_c_message_unpack (&client_hello__descriptor, + allocator, len, data); +} +void client_hello__free_unpacked + (ClientHello *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &client_hello__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void server_message__init + (ServerMessage *message) +{ + static const ServerMessage init_value = SERVER_MESSAGE__INIT; + *message = init_value; +} +size_t server_message__get_packed_size + (const ServerMessage *message) +{ + assert(message->base.descriptor == &server_message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t server_message__pack + (const ServerMessage *message, + uint8_t *out) +{ + assert(message->base.descriptor == &server_message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t server_message__pack_to_buffer + (const ServerMessage *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &server_message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ServerMessage * + server_message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ServerMessage *) + protobuf_c_message_unpack (&server_message__descriptor, + allocator, len, data); +} +void server_message__free_unpacked + (ServerMessage *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &server_message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void server_hello__init + (ServerHello *message) +{ + static const ServerHello init_value = SERVER_HELLO__INIT; + *message = init_value; +} +size_t server_hello__get_packed_size + (const ServerHello *message) +{ + assert(message->base.descriptor == &server_hello__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t server_hello__pack + (const ServerHello *message, + uint8_t *out) +{ + assert(message->base.descriptor == &server_hello__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t server_hello__pack_to_buffer + (const ServerHello *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &server_hello__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ServerHello * + server_hello__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ServerHello *) + protobuf_c_message_unpack (&server_hello__descriptor, + allocator, len, data); +} +void server_hello__free_unpacked + (ServerHello *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &server_hello__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor client_message__field_descriptors[13] = +{ + { + "accept_msg", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.accept_msg), + &accept_message__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "reject_msg", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.reject_msg), + &reject_message__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exit_msg", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.exit_msg), + &exit_message__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "restart_msg", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.restart_msg), + &restart_message__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "alert_msg", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.alert_msg), + &alert_message__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ttyin_buf", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.ttyin_buf), + &io_buffer__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ttyout_buf", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.ttyout_buf), + &io_buffer__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "stdin_buf", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.stdin_buf), + &io_buffer__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "stdout_buf", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.stdout_buf), + &io_buffer__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "stderr_buf", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.stderr_buf), + &io_buffer__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "winsize_event", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.winsize_event), + &change_window_size__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "suspend_event", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.suspend_event), + &command_suspend__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "hello_msg", + 13, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ClientMessage, type_case), + offsetof(ClientMessage, u.hello_msg), + &client_hello__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned client_message__field_indices_by_name[] = { + 0, /* field[0] = accept_msg */ + 4, /* field[4] = alert_msg */ + 2, /* field[2] = exit_msg */ + 12, /* field[12] = hello_msg */ + 1, /* field[1] = reject_msg */ + 3, /* field[3] = restart_msg */ + 9, /* field[9] = stderr_buf */ + 7, /* field[7] = stdin_buf */ + 8, /* field[8] = stdout_buf */ + 11, /* field[11] = suspend_event */ + 5, /* field[5] = ttyin_buf */ + 6, /* field[6] = ttyout_buf */ + 10, /* field[10] = winsize_event */ +}; +static const ProtobufCIntRange client_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 13 } +}; +const ProtobufCMessageDescriptor client_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ClientMessage", + "ClientMessage", + "ClientMessage", + "", + sizeof(ClientMessage), + 13, + client_message__field_descriptors, + client_message__field_indices_by_name, + 1, client_message__number_ranges, + (ProtobufCMessageInit) client_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor time_spec__field_descriptors[2] = +{ + { + "tv_sec", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(TimeSpec, tv_sec), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tv_nsec", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(TimeSpec, tv_nsec), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned time_spec__field_indices_by_name[] = { + 1, /* field[1] = tv_nsec */ + 0, /* field[0] = tv_sec */ +}; +static const ProtobufCIntRange time_spec__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor time_spec__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "TimeSpec", + "TimeSpec", + "TimeSpec", + "", + sizeof(TimeSpec), + 2, + time_spec__field_descriptors, + time_spec__field_indices_by_name, + 1, time_spec__number_ranges, + (ProtobufCMessageInit) time_spec__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor io_buffer__field_descriptors[2] = +{ + { + "delay", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(IoBuffer, delay), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "data", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(IoBuffer, data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned io_buffer__field_indices_by_name[] = { + 1, /* field[1] = data */ + 0, /* field[0] = delay */ +}; +static const ProtobufCIntRange io_buffer__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor io_buffer__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "IoBuffer", + "IoBuffer", + "IoBuffer", + "", + sizeof(IoBuffer), + 2, + io_buffer__field_descriptors, + io_buffer__field_indices_by_name, + 1, io_buffer__number_ranges, + (ProtobufCMessageInit) io_buffer__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor info_message__string_list__field_descriptors[1] = +{ + { + "strings", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + offsetof(InfoMessage__StringList, n_strings), + offsetof(InfoMessage__StringList, strings), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned info_message__string_list__field_indices_by_name[] = { + 0, /* field[0] = strings */ +}; +static const ProtobufCIntRange info_message__string_list__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor info_message__string_list__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "InfoMessage.StringList", + "StringList", + "InfoMessage__StringList", + "", + sizeof(InfoMessage__StringList), + 1, + info_message__string_list__field_descriptors, + info_message__string_list__field_indices_by_name, + 1, info_message__string_list__number_ranges, + (ProtobufCMessageInit) info_message__string_list__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor info_message__number_list__field_descriptors[1] = +{ + { + "numbers", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_INT64, + offsetof(InfoMessage__NumberList, n_numbers), + offsetof(InfoMessage__NumberList, numbers), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned info_message__number_list__field_indices_by_name[] = { + 0, /* field[0] = numbers */ +}; +static const ProtobufCIntRange info_message__number_list__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor info_message__number_list__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "InfoMessage.NumberList", + "NumberList", + "InfoMessage__NumberList", + "", + sizeof(InfoMessage__NumberList), + 1, + info_message__number_list__field_descriptors, + info_message__number_list__field_indices_by_name, + 1, info_message__number_list__number_ranges, + (ProtobufCMessageInit) info_message__number_list__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor info_message__field_descriptors[5] = +{ + { + "key", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(InfoMessage, key), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "numval", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + offsetof(InfoMessage, value_case), + offsetof(InfoMessage, u.numval), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "strval", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + offsetof(InfoMessage, value_case), + offsetof(InfoMessage, u.strval), + NULL, + &protobuf_c_empty_string, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "strlistval", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(InfoMessage, value_case), + offsetof(InfoMessage, u.strlistval), + &info_message__string_list__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "numlistval", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(InfoMessage, value_case), + offsetof(InfoMessage, u.numlistval), + &info_message__number_list__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned info_message__field_indices_by_name[] = { + 0, /* field[0] = key */ + 4, /* field[4] = numlistval */ + 1, /* field[1] = numval */ + 3, /* field[3] = strlistval */ + 2, /* field[2] = strval */ +}; +static const ProtobufCIntRange info_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor info_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "InfoMessage", + "InfoMessage", + "InfoMessage", + "", + sizeof(InfoMessage), + 5, + info_message__field_descriptors, + info_message__field_indices_by_name, + 1, info_message__number_ranges, + (ProtobufCMessageInit) info_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor accept_message__field_descriptors[3] = +{ + { + "submit_time", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(AcceptMessage, submit_time), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "info_msgs", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(AcceptMessage, n_info_msgs), + offsetof(AcceptMessage, info_msgs), + &info_message__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "expect_iobufs", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(AcceptMessage, expect_iobufs), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned accept_message__field_indices_by_name[] = { + 2, /* field[2] = expect_iobufs */ + 1, /* field[1] = info_msgs */ + 0, /* field[0] = submit_time */ +}; +static const ProtobufCIntRange accept_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor accept_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "AcceptMessage", + "AcceptMessage", + "AcceptMessage", + "", + sizeof(AcceptMessage), + 3, + accept_message__field_descriptors, + accept_message__field_indices_by_name, + 1, accept_message__number_ranges, + (ProtobufCMessageInit) accept_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor reject_message__field_descriptors[3] = +{ + { + "submit_time", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(RejectMessage, submit_time), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "reason", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(RejectMessage, reason), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "info_msgs", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(RejectMessage, n_info_msgs), + offsetof(RejectMessage, info_msgs), + &info_message__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned reject_message__field_indices_by_name[] = { + 2, /* field[2] = info_msgs */ + 1, /* field[1] = reason */ + 0, /* field[0] = submit_time */ +}; +static const ProtobufCIntRange reject_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor reject_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "RejectMessage", + "RejectMessage", + "RejectMessage", + "", + sizeof(RejectMessage), + 3, + reject_message__field_descriptors, + reject_message__field_indices_by_name, + 1, reject_message__number_ranges, + (ProtobufCMessageInit) reject_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor exit_message__field_descriptors[5] = +{ + { + "run_time", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(ExitMessage, run_time), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exit_value", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(ExitMessage, exit_value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dumped_core", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ExitMessage, dumped_core), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "signal", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ExitMessage, signal), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "error", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ExitMessage, error), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned exit_message__field_indices_by_name[] = { + 2, /* field[2] = dumped_core */ + 4, /* field[4] = error */ + 1, /* field[1] = exit_value */ + 0, /* field[0] = run_time */ + 3, /* field[3] = signal */ +}; +static const ProtobufCIntRange exit_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor exit_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ExitMessage", + "ExitMessage", + "ExitMessage", + "", + sizeof(ExitMessage), + 5, + exit_message__field_descriptors, + exit_message__field_indices_by_name, + 1, exit_message__number_ranges, + (ProtobufCMessageInit) exit_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor alert_message__field_descriptors[3] = +{ + { + "alert_time", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(AlertMessage, alert_time), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "reason", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(AlertMessage, reason), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "info_msgs", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(AlertMessage, n_info_msgs), + offsetof(AlertMessage, info_msgs), + &info_message__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned alert_message__field_indices_by_name[] = { + 0, /* field[0] = alert_time */ + 2, /* field[2] = info_msgs */ + 1, /* field[1] = reason */ +}; +static const ProtobufCIntRange alert_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor alert_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "AlertMessage", + "AlertMessage", + "AlertMessage", + "", + sizeof(AlertMessage), + 3, + alert_message__field_descriptors, + alert_message__field_indices_by_name, + 1, alert_message__number_ranges, + (ProtobufCMessageInit) alert_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor restart_message__field_descriptors[2] = +{ + { + "log_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(RestartMessage, log_id), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "resume_point", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(RestartMessage, resume_point), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned restart_message__field_indices_by_name[] = { + 0, /* field[0] = log_id */ + 1, /* field[1] = resume_point */ +}; +static const ProtobufCIntRange restart_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor restart_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "RestartMessage", + "RestartMessage", + "RestartMessage", + "", + sizeof(RestartMessage), + 2, + restart_message__field_descriptors, + restart_message__field_indices_by_name, + 1, restart_message__number_ranges, + (ProtobufCMessageInit) restart_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor change_window_size__field_descriptors[3] = +{ + { + "delay", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(ChangeWindowSize, delay), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "rows", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(ChangeWindowSize, rows), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "cols", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(ChangeWindowSize, cols), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned change_window_size__field_indices_by_name[] = { + 2, /* field[2] = cols */ + 0, /* field[0] = delay */ + 1, /* field[1] = rows */ +}; +static const ProtobufCIntRange change_window_size__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor change_window_size__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ChangeWindowSize", + "ChangeWindowSize", + "ChangeWindowSize", + "", + sizeof(ChangeWindowSize), + 3, + change_window_size__field_descriptors, + change_window_size__field_indices_by_name, + 1, change_window_size__number_ranges, + (ProtobufCMessageInit) change_window_size__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor command_suspend__field_descriptors[2] = +{ + { + "delay", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(CommandSuspend, delay), + &time_spec__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "signal", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(CommandSuspend, signal), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned command_suspend__field_indices_by_name[] = { + 0, /* field[0] = delay */ + 1, /* field[1] = signal */ +}; +static const ProtobufCIntRange command_suspend__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor command_suspend__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "CommandSuspend", + "CommandSuspend", + "CommandSuspend", + "", + sizeof(CommandSuspend), + 2, + command_suspend__field_descriptors, + command_suspend__field_indices_by_name, + 1, command_suspend__number_ranges, + (ProtobufCMessageInit) command_suspend__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor client_hello__field_descriptors[1] = +{ + { + "client_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ClientHello, client_id), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned client_hello__field_indices_by_name[] = { + 0, /* field[0] = client_id */ +}; +static const ProtobufCIntRange client_hello__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor client_hello__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ClientHello", + "ClientHello", + "ClientHello", + "", + sizeof(ClientHello), + 1, + client_hello__field_descriptors, + client_hello__field_indices_by_name, + 1, client_hello__number_ranges, + (ProtobufCMessageInit) client_hello__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor server_message__field_descriptors[5] = +{ + { + "hello", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ServerMessage, type_case), + offsetof(ServerMessage, u.hello), + &server_hello__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "commit_point", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(ServerMessage, type_case), + offsetof(ServerMessage, u.commit_point), + &time_spec__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "log_id", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + offsetof(ServerMessage, type_case), + offsetof(ServerMessage, u.log_id), + NULL, + &protobuf_c_empty_string, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "error", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + offsetof(ServerMessage, type_case), + offsetof(ServerMessage, u.error), + NULL, + &protobuf_c_empty_string, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "abort", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + offsetof(ServerMessage, type_case), + offsetof(ServerMessage, u.abort), + NULL, + &protobuf_c_empty_string, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned server_message__field_indices_by_name[] = { + 4, /* field[4] = abort */ + 1, /* field[1] = commit_point */ + 3, /* field[3] = error */ + 0, /* field[0] = hello */ + 2, /* field[2] = log_id */ +}; +static const ProtobufCIntRange server_message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor server_message__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ServerMessage", + "ServerMessage", + "ServerMessage", + "", + sizeof(ServerMessage), + 5, + server_message__field_descriptors, + server_message__field_indices_by_name, + 1, server_message__number_ranges, + (ProtobufCMessageInit) server_message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor server_hello__field_descriptors[4] = +{ + { + "server_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ServerHello, server_id), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "redirect", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ServerHello, redirect), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "servers", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + offsetof(ServerHello, n_servers), + offsetof(ServerHello, servers), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "subcommands", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(ServerHello, subcommands), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned server_hello__field_indices_by_name[] = { + 1, /* field[1] = redirect */ + 0, /* field[0] = server_id */ + 2, /* field[2] = servers */ + 3, /* field[3] = subcommands */ +}; +static const ProtobufCIntRange server_hello__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor server_hello__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ServerHello", + "ServerHello", + "ServerHello", + "", + sizeof(ServerHello), + 4, + server_hello__field_descriptors, + server_hello__field_indices_by_name, + 1, server_hello__number_ranges, + (ProtobufCMessageInit) server_hello__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/lib/logsrv/log_server.proto b/lib/logsrv/log_server.proto new file mode 100644 index 0000000..23b716e --- /dev/null +++ b/lib/logsrv/log_server.proto @@ -0,0 +1,136 @@ +syntax = "proto3"; + +/* + * Client message to the server. Messages on the wire are + * prefixed with a 32-bit size in network byte order. + */ +message ClientMessage { + oneof type { + AcceptMessage accept_msg = 1; + RejectMessage reject_msg = 2; + ExitMessage exit_msg = 3; + RestartMessage restart_msg = 4; + AlertMessage alert_msg = 5; + IoBuffer ttyin_buf = 6; + IoBuffer ttyout_buf = 7; + IoBuffer stdin_buf = 8; + IoBuffer stdout_buf = 9; + IoBuffer stderr_buf = 10; + ChangeWindowSize winsize_event = 11; + CommandSuspend suspend_event = 12; + ClientHello hello_msg = 13; + } +} + +/* Equivalent of POSIX struct timespec */ +message TimeSpec { + int64 tv_sec = 1; /* seconds */ + int32 tv_nsec = 2; /* nanoseconds */ +} + +/* I/O buffer with keystroke data */ +message IoBuffer { + TimeSpec delay = 1; /* elapsed time since last record */ + bytes data = 2; /* keystroke data */ +} + +/* + * Key/value pairs, like Privilege Manager struct info. + * The value may be a number, a string, or a list of strings. + */ +message InfoMessage { + message StringList { + repeated string strings = 1; + } + message NumberList { + repeated int64 numbers = 1; + } + string key = 1; + oneof value { + int64 numval = 2; + string strval = 3; + StringList strlistval = 4; + NumberList numlistval = 5; + } +} + +/* + * Event log data for command accepted by the policy. + */ +message AcceptMessage { + TimeSpec submit_time = 1; /* when command was submitted */ + repeated InfoMessage info_msgs = 2; /* key,value event log data */ + bool expect_iobufs = 3; /* true if I/O logging enabled */ +} + +/* + * Event log data for command rejected by the policy. + */ +message RejectMessage { + TimeSpec submit_time = 1; /* when command was submitted */ + string reason = 2; /* reason command was rejected */ + repeated InfoMessage info_msgs = 3; /* key,value event log data */ +} + +/* Message sent by client when command exits. */ +/* Might revisit runtime and use end_time instead */ +message ExitMessage { + TimeSpec run_time = 1; /* total elapsed run time */ + int32 exit_value = 2; /* 0-255 */ + bool dumped_core = 3; /* true if command dumped core */ + string signal = 4; /* signal name if killed by signal */ + string error = 5; /* if killed due to other error */ +} + +/* Alert message, policy module-specific. */ +message AlertMessage { + TimeSpec alert_time = 1; /* time alert message occurred */ + string reason = 2; /* policy alert error string */ + repeated InfoMessage info_msgs = 3; /* optional key,value event log data */ +} + +/* Used to restart an existing I/O log on the server. */ +message RestartMessage { + string log_id = 1; /* ID of log being restarted */ + TimeSpec resume_point = 2; /* resume point (elapsed time) */ +} + +/* Window size change event. */ +message ChangeWindowSize { + TimeSpec delay = 1; /* elapsed time since last record */ + int32 rows = 2; /* new number of rows */ + int32 cols = 3; /* new number of columns */ +} + +/* Command suspend/resume event. */ +message CommandSuspend { + TimeSpec delay = 1; /* elapsed time since last record */ + string signal = 2; /* signal that caused suspend/resume */ +} + +/* Hello message from client when connecting to server. */ +message ClientHello { + string client_id = 1; /* free-form client description */ +} + +/* + * Server messages to the client. Messages on the wire are + * prefixed with a 32-bit size in network byte order. + */ +message ServerMessage { + oneof type { + ServerHello hello = 1; /* server hello message */ + TimeSpec commit_point = 2; /* cumulative time of records stored */ + string log_id = 3; /* ID of server-side I/O log */ + string error = 4; /* error message from server */ + string abort = 5; /* abort message, kill command */ + } +} + +/* Hello message from server when client connects. */ +message ServerHello { + string server_id = 1; /* free-form server description */ + string redirect = 2; /* optional redirect if busy */ + repeated string servers = 3; /* optional list of known servers */ + bool subcommands = 4; /* flag: server supports sub-commands */ +} |