mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Update to protobuf-c 1.4.0
This commit is contained in:
parent
aee276ea63
commit
71c07579ba
@ -10,19 +10,19 @@ PROTOBUF_C__BEGIN_DECLS
|
|||||||
|
|
||||||
#if PROTOBUF_C_VERSION_NUMBER < 1003000
|
#if PROTOBUF_C_VERSION_NUMBER < 1003000
|
||||||
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
||||||
#elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION
|
#elif 1004000 < PROTOBUF_C_MIN_COMPILER_VERSION
|
||||||
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct _InterceptRequest InterceptRequest;
|
typedef struct InterceptRequest InterceptRequest;
|
||||||
typedef struct _InterceptHello InterceptHello;
|
typedef struct InterceptHello InterceptHello;
|
||||||
typedef struct _HelloResponse HelloResponse;
|
typedef struct HelloResponse HelloResponse;
|
||||||
typedef struct _PolicyCheckRequest PolicyCheckRequest;
|
typedef struct PolicyCheckRequest PolicyCheckRequest;
|
||||||
typedef struct _PolicyAcceptMessage PolicyAcceptMessage;
|
typedef struct PolicyAcceptMessage PolicyAcceptMessage;
|
||||||
typedef struct _PolicyRejectMessage PolicyRejectMessage;
|
typedef struct PolicyRejectMessage PolicyRejectMessage;
|
||||||
typedef struct _PolicyErrorMessage PolicyErrorMessage;
|
typedef struct PolicyErrorMessage PolicyErrorMessage;
|
||||||
typedef struct _InterceptResponse InterceptResponse;
|
typedef struct InterceptResponse InterceptResponse;
|
||||||
|
|
||||||
|
|
||||||
/* --- enums --- */
|
/* --- enums --- */
|
||||||
@ -34,14 +34,14 @@ typedef enum {
|
|||||||
INTERCEPT_REQUEST__TYPE__NOT_SET = 0,
|
INTERCEPT_REQUEST__TYPE__NOT_SET = 0,
|
||||||
INTERCEPT_REQUEST__TYPE_POLICY_CHECK_REQ = 1,
|
INTERCEPT_REQUEST__TYPE_POLICY_CHECK_REQ = 1,
|
||||||
INTERCEPT_REQUEST__TYPE_HELLO = 2
|
INTERCEPT_REQUEST__TYPE_HELLO = 2
|
||||||
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_REQUEST__TYPE)
|
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_REQUEST__TYPE__CASE)
|
||||||
} InterceptRequest__TypeCase;
|
} InterceptRequest__TypeCase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Intercept message from sudo_intercept.so. Messages on the
|
* Intercept message from sudo_intercept.so. Messages on the
|
||||||
* wire are prefixed with a 32-bit size in network byte order.
|
* wire are prefixed with a 32-bit size in network byte order.
|
||||||
*/
|
*/
|
||||||
struct _InterceptRequest
|
struct InterceptRequest
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
InterceptRequest__TypeCase type_case;
|
InterceptRequest__TypeCase type_case;
|
||||||
@ -59,7 +59,7 @@ struct _InterceptRequest
|
|||||||
* Hello message from sudo_intercept.so to main sudo process.
|
* Hello message from sudo_intercept.so to main sudo process.
|
||||||
* Sudo sends back the token and localhost port number.
|
* Sudo sends back the token and localhost port number.
|
||||||
*/
|
*/
|
||||||
struct _InterceptHello
|
struct InterceptHello
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
int32_t pid;
|
int32_t pid;
|
||||||
@ -73,7 +73,7 @@ struct _InterceptHello
|
|||||||
* Sudo response to an InterceptHello from sudo_intercept.so.
|
* Sudo response to an InterceptHello from sudo_intercept.so.
|
||||||
* The client uses the port number and token to connect back to sudo.
|
* The client uses the port number and token to connect back to sudo.
|
||||||
*/
|
*/
|
||||||
struct _HelloResponse
|
struct HelloResponse
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
uint64_t token_lo;
|
uint64_t token_lo;
|
||||||
@ -90,7 +90,7 @@ struct _HelloResponse
|
|||||||
* Note that the plugin API only currently supports passing
|
* Note that the plugin API only currently supports passing
|
||||||
* the new environment in to the open() function.
|
* the new environment in to the open() function.
|
||||||
*/
|
*/
|
||||||
struct _PolicyCheckRequest
|
struct PolicyCheckRequest
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
char *command;
|
char *command;
|
||||||
@ -106,7 +106,7 @@ struct _PolicyCheckRequest
|
|||||||
, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL, 0 }
|
, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL, 0 }
|
||||||
|
|
||||||
|
|
||||||
struct _PolicyAcceptMessage
|
struct PolicyAcceptMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
char *run_command;
|
char *run_command;
|
||||||
@ -120,7 +120,7 @@ struct _PolicyAcceptMessage
|
|||||||
, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL }
|
, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL }
|
||||||
|
|
||||||
|
|
||||||
struct _PolicyRejectMessage
|
struct PolicyRejectMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
char *reject_message;
|
char *reject_message;
|
||||||
@ -130,7 +130,7 @@ struct _PolicyRejectMessage
|
|||||||
, (char *)protobuf_c_empty_string }
|
, (char *)protobuf_c_empty_string }
|
||||||
|
|
||||||
|
|
||||||
struct _PolicyErrorMessage
|
struct PolicyErrorMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
char *error_message;
|
char *error_message;
|
||||||
@ -146,13 +146,13 @@ typedef enum {
|
|||||||
INTERCEPT_RESPONSE__TYPE_ACCEPT_MSG = 2,
|
INTERCEPT_RESPONSE__TYPE_ACCEPT_MSG = 2,
|
||||||
INTERCEPT_RESPONSE__TYPE_REJECT_MSG = 3,
|
INTERCEPT_RESPONSE__TYPE_REJECT_MSG = 3,
|
||||||
INTERCEPT_RESPONSE__TYPE_ERROR_MSG = 4
|
INTERCEPT_RESPONSE__TYPE_ERROR_MSG = 4
|
||||||
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_RESPONSE__TYPE)
|
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_RESPONSE__TYPE__CASE)
|
||||||
} InterceptResponse__TypeCase;
|
} InterceptResponse__TypeCase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Response sent back to sudo_intercept.so.
|
* Response sent back to sudo_intercept.so.
|
||||||
*/
|
*/
|
||||||
struct _InterceptResponse
|
struct InterceptResponse
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
InterceptResponse__TypeCase type_case;
|
InterceptResponse__TypeCase type_case;
|
||||||
|
@ -10,27 +10,27 @@ PROTOBUF_C__BEGIN_DECLS
|
|||||||
|
|
||||||
#if PROTOBUF_C_VERSION_NUMBER < 1003000
|
#if PROTOBUF_C_VERSION_NUMBER < 1003000
|
||||||
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
|
||||||
#elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION
|
#elif 1004000 < PROTOBUF_C_MIN_COMPILER_VERSION
|
||||||
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct _ClientMessage ClientMessage;
|
typedef struct ClientMessage ClientMessage;
|
||||||
typedef struct _TimeSpec TimeSpec;
|
typedef struct TimeSpec TimeSpec;
|
||||||
typedef struct _IoBuffer IoBuffer;
|
typedef struct IoBuffer IoBuffer;
|
||||||
typedef struct _InfoMessage InfoMessage;
|
typedef struct InfoMessage InfoMessage;
|
||||||
typedef struct _InfoMessage__StringList InfoMessage__StringList;
|
typedef struct InfoMessage__StringList InfoMessage__StringList;
|
||||||
typedef struct _InfoMessage__NumberList InfoMessage__NumberList;
|
typedef struct InfoMessage__NumberList InfoMessage__NumberList;
|
||||||
typedef struct _AcceptMessage AcceptMessage;
|
typedef struct AcceptMessage AcceptMessage;
|
||||||
typedef struct _RejectMessage RejectMessage;
|
typedef struct RejectMessage RejectMessage;
|
||||||
typedef struct _ExitMessage ExitMessage;
|
typedef struct ExitMessage ExitMessage;
|
||||||
typedef struct _AlertMessage AlertMessage;
|
typedef struct AlertMessage AlertMessage;
|
||||||
typedef struct _RestartMessage RestartMessage;
|
typedef struct RestartMessage RestartMessage;
|
||||||
typedef struct _ChangeWindowSize ChangeWindowSize;
|
typedef struct ChangeWindowSize ChangeWindowSize;
|
||||||
typedef struct _CommandSuspend CommandSuspend;
|
typedef struct CommandSuspend CommandSuspend;
|
||||||
typedef struct _ClientHello ClientHello;
|
typedef struct ClientHello ClientHello;
|
||||||
typedef struct _ServerMessage ServerMessage;
|
typedef struct ServerMessage ServerMessage;
|
||||||
typedef struct _ServerHello ServerHello;
|
typedef struct ServerHello ServerHello;
|
||||||
|
|
||||||
|
|
||||||
/* --- enums --- */
|
/* --- enums --- */
|
||||||
@ -53,14 +53,14 @@ typedef enum {
|
|||||||
CLIENT_MESSAGE__TYPE_WINSIZE_EVENT = 11,
|
CLIENT_MESSAGE__TYPE_WINSIZE_EVENT = 11,
|
||||||
CLIENT_MESSAGE__TYPE_SUSPEND_EVENT = 12,
|
CLIENT_MESSAGE__TYPE_SUSPEND_EVENT = 12,
|
||||||
CLIENT_MESSAGE__TYPE_HELLO_MSG = 13
|
CLIENT_MESSAGE__TYPE_HELLO_MSG = 13
|
||||||
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CLIENT_MESSAGE__TYPE)
|
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(CLIENT_MESSAGE__TYPE__CASE)
|
||||||
} ClientMessage__TypeCase;
|
} ClientMessage__TypeCase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Client message to the server. Messages on the wire are
|
* Client message to the server. Messages on the wire are
|
||||||
* prefixed with a 32-bit size in network byte order.
|
* prefixed with a 32-bit size in network byte order.
|
||||||
*/
|
*/
|
||||||
struct _ClientMessage
|
struct ClientMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
ClientMessage__TypeCase type_case;
|
ClientMessage__TypeCase type_case;
|
||||||
@ -88,7 +88,7 @@ struct _ClientMessage
|
|||||||
/*
|
/*
|
||||||
* Equivalent of POSIX struct timespec
|
* Equivalent of POSIX struct timespec
|
||||||
*/
|
*/
|
||||||
struct _TimeSpec
|
struct TimeSpec
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -108,7 +108,7 @@ struct _TimeSpec
|
|||||||
/*
|
/*
|
||||||
* I/O buffer with keystroke data
|
* I/O buffer with keystroke data
|
||||||
*/
|
*/
|
||||||
struct _IoBuffer
|
struct IoBuffer
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -125,7 +125,7 @@ struct _IoBuffer
|
|||||||
, NULL, {0,NULL} }
|
, NULL, {0,NULL} }
|
||||||
|
|
||||||
|
|
||||||
struct _InfoMessage__StringList
|
struct InfoMessage__StringList
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
size_t n_strings;
|
size_t n_strings;
|
||||||
@ -136,7 +136,7 @@ struct _InfoMessage__StringList
|
|||||||
, 0,NULL }
|
, 0,NULL }
|
||||||
|
|
||||||
|
|
||||||
struct _InfoMessage__NumberList
|
struct InfoMessage__NumberList
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
size_t n_numbers;
|
size_t n_numbers;
|
||||||
@ -153,14 +153,14 @@ typedef enum {
|
|||||||
INFO_MESSAGE__VALUE_STRVAL = 3,
|
INFO_MESSAGE__VALUE_STRVAL = 3,
|
||||||
INFO_MESSAGE__VALUE_STRLISTVAL = 4,
|
INFO_MESSAGE__VALUE_STRLISTVAL = 4,
|
||||||
INFO_MESSAGE__VALUE_NUMLISTVAL = 5
|
INFO_MESSAGE__VALUE_NUMLISTVAL = 5
|
||||||
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INFO_MESSAGE__VALUE)
|
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INFO_MESSAGE__VALUE__CASE)
|
||||||
} InfoMessage__ValueCase;
|
} InfoMessage__ValueCase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Key/value pairs, like Privilege Manager struct info.
|
* Key/value pairs, like Privilege Manager struct info.
|
||||||
* The value may be a number, a string, or a list of strings.
|
* The value may be a number, a string, or a list of strings.
|
||||||
*/
|
*/
|
||||||
struct _InfoMessage
|
struct InfoMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
char *key;
|
char *key;
|
||||||
@ -180,7 +180,7 @@ struct _InfoMessage
|
|||||||
/*
|
/*
|
||||||
* Event log data for command accepted by the policy.
|
* Event log data for command accepted by the policy.
|
||||||
*/
|
*/
|
||||||
struct _AcceptMessage
|
struct AcceptMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -205,7 +205,7 @@ struct _AcceptMessage
|
|||||||
/*
|
/*
|
||||||
* Event log data for command rejected by the policy.
|
* Event log data for command rejected by the policy.
|
||||||
*/
|
*/
|
||||||
struct _RejectMessage
|
struct RejectMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -230,7 +230,7 @@ struct _RejectMessage
|
|||||||
/*
|
/*
|
||||||
* Might revisit runtime and use end_time instead
|
* Might revisit runtime and use end_time instead
|
||||||
*/
|
*/
|
||||||
struct _ExitMessage
|
struct ExitMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -262,7 +262,7 @@ struct _ExitMessage
|
|||||||
/*
|
/*
|
||||||
* Alert message, policy module-specific.
|
* Alert message, policy module-specific.
|
||||||
*/
|
*/
|
||||||
struct _AlertMessage
|
struct AlertMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -287,7 +287,7 @@ struct _AlertMessage
|
|||||||
/*
|
/*
|
||||||
* Used to restart an existing I/O log on the server.
|
* Used to restart an existing I/O log on the server.
|
||||||
*/
|
*/
|
||||||
struct _RestartMessage
|
struct RestartMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -307,7 +307,7 @@ struct _RestartMessage
|
|||||||
/*
|
/*
|
||||||
* Window size change event.
|
* Window size change event.
|
||||||
*/
|
*/
|
||||||
struct _ChangeWindowSize
|
struct ChangeWindowSize
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -331,7 +331,7 @@ struct _ChangeWindowSize
|
|||||||
/*
|
/*
|
||||||
* Command suspend/resume event.
|
* Command suspend/resume event.
|
||||||
*/
|
*/
|
||||||
struct _CommandSuspend
|
struct CommandSuspend
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -351,7 +351,7 @@ struct _CommandSuspend
|
|||||||
/*
|
/*
|
||||||
* Hello message from client when connecting to server.
|
* Hello message from client when connecting to server.
|
||||||
*/
|
*/
|
||||||
struct _ClientHello
|
struct ClientHello
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
@ -371,14 +371,14 @@ typedef enum {
|
|||||||
SERVER_MESSAGE__TYPE_LOG_ID = 3,
|
SERVER_MESSAGE__TYPE_LOG_ID = 3,
|
||||||
SERVER_MESSAGE__TYPE_ERROR = 4,
|
SERVER_MESSAGE__TYPE_ERROR = 4,
|
||||||
SERVER_MESSAGE__TYPE_ABORT = 5
|
SERVER_MESSAGE__TYPE_ABORT = 5
|
||||||
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(SERVER_MESSAGE__TYPE)
|
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(SERVER_MESSAGE__TYPE__CASE)
|
||||||
} ServerMessage__TypeCase;
|
} ServerMessage__TypeCase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Server messages to the client. Messages on the wire are
|
* Server messages to the client. Messages on the wire are
|
||||||
* prefixed with a 32-bit size in network byte order.
|
* prefixed with a 32-bit size in network byte order.
|
||||||
*/
|
*/
|
||||||
struct _ServerMessage
|
struct ServerMessage
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
ServerMessage__TypeCase type_case;
|
ServerMessage__TypeCase type_case;
|
||||||
@ -413,7 +413,7 @@ struct _ServerMessage
|
|||||||
/*
|
/*
|
||||||
* Hello message from server when client connects.
|
* Hello message from server when client connects.
|
||||||
*/
|
*/
|
||||||
struct _ServerHello
|
struct ServerHello
|
||||||
{
|
{
|
||||||
ProtobufCMessage base;
|
ProtobufCMessage base;
|
||||||
/*
|
/*
|
||||||
|
@ -238,7 +238,11 @@ PROTOBUF_C__BEGIN_DECLS
|
|||||||
#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af
|
#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af
|
||||||
|
|
||||||
/* Empty string used for initializers */
|
/* Empty string used for initializers */
|
||||||
|
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
|
||||||
|
static const char protobuf_c_empty_string[] = "";
|
||||||
|
#else
|
||||||
extern const char protobuf_c_empty_string[];
|
extern const char protobuf_c_empty_string[];
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup api Public API
|
* \defgroup api Public API
|
||||||
@ -790,13 +794,13 @@ protobuf_c_version_number(void);
|
|||||||
* The version of the protobuf-c headers, represented as a string using the same
|
* The version of the protobuf-c headers, represented as a string using the same
|
||||||
* format as protobuf_c_version().
|
* format as protobuf_c_version().
|
||||||
*/
|
*/
|
||||||
#define PROTOBUF_C_VERSION "1.3.3"
|
#define PROTOBUF_C_VERSION "1.4.0"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of the protobuf-c headers, represented as an integer using the
|
* The version of the protobuf-c headers, represented as an integer using the
|
||||||
* same format as protobuf_c_version_number().
|
* same format as protobuf_c_version_number().
|
||||||
*/
|
*/
|
||||||
#define PROTOBUF_C_VERSION_NUMBER 1003003
|
#define PROTOBUF_C_VERSION_NUMBER 1004000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The minimum protoc-c version which works with the current version of the
|
* The minimum protoc-c version which works with the current version of the
|
||||||
|
@ -86,7 +86,9 @@
|
|||||||
# define PROTOBUF_C_UNPACK_ERROR(...)
|
# define PROTOBUF_C_UNPACK_ERROR(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_WIN32) || !defined(PROTOBUF_C_USE_SHARED_LIB)
|
||||||
const char protobuf_c_empty_string[] = "";
|
const char protobuf_c_empty_string[] = "";
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal `ProtobufCMessage` manipulation macro.
|
* Internal `ProtobufCMessage` manipulation macro.
|
||||||
@ -150,12 +152,14 @@ protobuf_c_version_number(void)
|
|||||||
static void *
|
static void *
|
||||||
system_alloc(void *allocator_data, size_t size)
|
system_alloc(void *allocator_data, size_t size)
|
||||||
{
|
{
|
||||||
|
(void)allocator_data;
|
||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
system_free(void *allocator_data, void *data)
|
system_free(void *allocator_data, void *data)
|
||||||
{
|
{
|
||||||
|
(void)allocator_data;
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1620,22 +1624,19 @@ required_field_pack_to_buffer(const ProtobufCFieldDescriptor *field,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROTOBUF_C_TYPE_MESSAGE: {
|
case PROTOBUF_C_TYPE_MESSAGE: {
|
||||||
uint8_t simple_buffer_scratch[256];
|
|
||||||
size_t sublen;
|
|
||||||
const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member;
|
const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member;
|
||||||
ProtobufCBufferSimple simple_buffer =
|
|
||||||
PROTOBUF_C_BUFFER_SIMPLE_INIT(simple_buffer_scratch);
|
|
||||||
|
|
||||||
scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED;
|
scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED;
|
||||||
if (msg == NULL)
|
if (msg == NULL) {
|
||||||
sublen = 0;
|
rv += uint32_pack(0, scratch + rv);
|
||||||
else
|
buffer->append(buffer, rv, scratch);
|
||||||
sublen = protobuf_c_message_pack_to_buffer(msg, &simple_buffer.base);
|
} else {
|
||||||
|
size_t sublen = protobuf_c_message_get_packed_size(msg);
|
||||||
rv += uint32_pack(sublen, scratch + rv);
|
rv += uint32_pack(sublen, scratch + rv);
|
||||||
buffer->append(buffer, rv, scratch);
|
buffer->append(buffer, rv, scratch);
|
||||||
buffer->append(buffer, sublen, simple_buffer.data);
|
protobuf_c_message_pack_to_buffer(msg, buffer);
|
||||||
rv += sublen;
|
rv += sublen;
|
||||||
PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple_buffer);
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -2065,7 +2066,7 @@ static size_t
|
|||||||
parse_tag_and_wiretype(size_t len,
|
parse_tag_and_wiretype(size_t len,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
uint32_t *tag_out,
|
uint32_t *tag_out,
|
||||||
ProtobufCWireType *wiretype_out)
|
uint8_t *wiretype_out)
|
||||||
{
|
{
|
||||||
unsigned max_rv = len > 5 ? 5 : len;
|
unsigned max_rv = len > 5 ? 5 : len;
|
||||||
uint32_t tag = (data[0] & 0x7f) >> 3;
|
uint32_t tag = (data[0] & 0x7f) >> 3;
|
||||||
@ -2097,9 +2098,9 @@ parse_tag_and_wiretype(size_t len,
|
|||||||
|
|
||||||
/* sizeof(ScannedMember) must be <= (1UL<<BOUND_SIZEOF_SCANNED_MEMBER_LOG2) */
|
/* sizeof(ScannedMember) must be <= (1UL<<BOUND_SIZEOF_SCANNED_MEMBER_LOG2) */
|
||||||
#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2 5
|
#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2 5
|
||||||
typedef struct _ScannedMember ScannedMember;
|
typedef struct ScannedMember ScannedMember;
|
||||||
/** Field as it's being read. */
|
/** Field as it's being read. */
|
||||||
struct _ScannedMember {
|
struct ScannedMember {
|
||||||
uint32_t tag; /**< Field tag. */
|
uint32_t tag; /**< Field tag. */
|
||||||
uint8_t wire_type; /**< Field type. */
|
uint8_t wire_type; /**< Field type. */
|
||||||
uint8_t length_prefix_len; /**< Prefix length. */
|
uint8_t length_prefix_len; /**< Prefix length. */
|
||||||
@ -2134,11 +2135,13 @@ scan_length_prefixed_data(size_t len, const uint8_t *data,
|
|||||||
// Protobuf messages should always be less than 2 GiB in size.
|
// Protobuf messages should always be less than 2 GiB in size.
|
||||||
// We also want to return early here so that hdr_len + val does
|
// We also want to return early here so that hdr_len + val does
|
||||||
// not overflow on 32-bit systems.
|
// not overflow on 32-bit systems.
|
||||||
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val);
|
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large",
|
||||||
|
(unsigned long int)val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (hdr_len + val > len) {
|
if (hdr_len + val > len) {
|
||||||
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val);
|
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu",
|
||||||
|
(unsigned long int)val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return hdr_len + val;
|
return hdr_len + val;
|
||||||
@ -2500,7 +2503,7 @@ parse_required_member(ScannedMember *scanned_member,
|
|||||||
{
|
{
|
||||||
unsigned len = scanned_member->len;
|
unsigned len = scanned_member->len;
|
||||||
const uint8_t *data = scanned_member->data;
|
const uint8_t *data = scanned_member->data;
|
||||||
ProtobufCWireType wire_type = scanned_member->wire_type;
|
uint8_t wire_type = scanned_member->wire_type;
|
||||||
|
|
||||||
switch (scanned_member->field->type) {
|
switch (scanned_member->field->type) {
|
||||||
case PROTOBUF_C_TYPE_ENUM:
|
case PROTOBUF_C_TYPE_ENUM:
|
||||||
@ -2581,7 +2584,7 @@ parse_required_member(ScannedMember *scanned_member,
|
|||||||
{
|
{
|
||||||
do_free(allocator, bd->data);
|
do_free(allocator, bd->data);
|
||||||
}
|
}
|
||||||
if (len - pref_len > 0) {
|
if (len > pref_len) {
|
||||||
bd->data = do_alloc(allocator, len - pref_len);
|
bd->data = do_alloc(allocator, len - pref_len);
|
||||||
if (bd->data == NULL)
|
if (bd->data == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2749,7 +2752,9 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
|
|||||||
const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len;
|
const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len;
|
||||||
size_t rem = scanned_member->len - scanned_member->length_prefix_len;
|
size_t rem = scanned_member->len - scanned_member->length_prefix_len;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
#if defined(WORDS_BIGENDIAN)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (field->type) {
|
switch (field->type) {
|
||||||
case PROTOBUF_C_TYPE_SFIXED32:
|
case PROTOBUF_C_TYPE_SFIXED32:
|
||||||
@ -2842,13 +2847,15 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROTOBUF_C_TYPE_BOOL:
|
case PROTOBUF_C_TYPE_BOOL:
|
||||||
count = rem;
|
while (rem > 0) {
|
||||||
for (i = 0; i < count; i++) {
|
unsigned s = scan_varint(rem, at);
|
||||||
if (at[i] > 1) {
|
if (s == 0) {
|
||||||
PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value");
|
PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
((protobuf_c_boolean *) array)[i] = at[i];
|
((protobuf_c_boolean *) array)[count++] = parse_boolean(s, at);
|
||||||
|
at += s;
|
||||||
|
rem -= s;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -3082,7 +3089,7 @@ protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc,
|
|||||||
|
|
||||||
while (rem > 0) {
|
while (rem > 0) {
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
ProtobufCWireType wire_type;
|
uint8_t wire_type;
|
||||||
size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type);
|
size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type);
|
||||||
const ProtobufCFieldDescriptor *field;
|
const ProtobufCFieldDescriptor *field;
|
||||||
ScannedMember tmp;
|
ScannedMember tmp;
|
||||||
|
@ -19,7 +19,7 @@ sub unanon {
|
|||||||
|
|
||||||
# Detect and replace anonymous unions in .h file.
|
# Detect and replace anonymous unions in .h file.
|
||||||
# Assumes there is only one anonymous union in scope.
|
# Assumes there is only one anonymous union in scope.
|
||||||
while ($content =~ s/^(struct\s+_(\w+)[^}]+)(union\s+{([^}]+)}\s*);/$1$3 u;/sm) {
|
while ($content =~ s/^(struct\s+(\w+)[^}]+)(union\s+{([^}]+)}\s*);/$1$3 u;/sm) {
|
||||||
my $s = $2;
|
my $s = $2;
|
||||||
my $u = $4;
|
my $u = $4;
|
||||||
$u =~ s:/\*((?!\*/).)*\*/::sg;
|
$u =~ s:/\*((?!\*/).)*\*/::sg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user