1 /* Generated by the protocol buffer compiler. DO NOT EDIT! */ 2 /* Generated from: intercept.proto */ 3 4 #ifndef PROTOBUF_C_intercept_2eproto__INCLUDED 5 #define PROTOBUF_C_intercept_2eproto__INCLUDED 6 7 #include <protobuf-c/protobuf-c.h> 8 9 PROTOBUF_C__BEGIN_DECLS 10 11 #if PROTOBUF_C_VERSION_NUMBER < 1003000 12 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. 13 #elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION 14 # 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. 15 #endif 16 17 18 typedef struct _InterceptRequest InterceptRequest; 19 typedef struct _InterceptHello InterceptHello; 20 typedef struct _HelloResponse HelloResponse; 21 typedef struct _PolicyCheckRequest PolicyCheckRequest; 22 typedef struct _PolicyAcceptMessage PolicyAcceptMessage; 23 typedef struct _PolicyRejectMessage PolicyRejectMessage; 24 typedef struct _PolicyErrorMessage PolicyErrorMessage; 25 typedef struct _InterceptResponse InterceptResponse; 26 27 28 /* --- enums --- */ 29 30 31 /* --- messages --- */ 32 33 typedef enum { 34 INTERCEPT_REQUEST__TYPE__NOT_SET = 0, 35 INTERCEPT_REQUEST__TYPE_POLICY_CHECK_REQ = 1, 36 INTERCEPT_REQUEST__TYPE_HELLO = 2 37 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_REQUEST__TYPE) 38 } InterceptRequest__TypeCase; 39 40 /* 41 * Intercept message from sudo_intercept.so. Messages on the 42 * wire are prefixed with a 32-bit size in network byte order. 43 */ 44 struct _InterceptRequest 45 { 46 ProtobufCMessage base; 47 InterceptRequest__TypeCase type_case; 48 union { 49 PolicyCheckRequest *policy_check_req; 50 InterceptHello *hello; 51 } u; 52 }; 53 #define INTERCEPT_REQUEST__INIT \ 54 { PROTOBUF_C_MESSAGE_INIT (&intercept_request__descriptor) \ 55 , INTERCEPT_REQUEST__TYPE__NOT_SET, {0} } 56 57 58 /* 59 * Hello message from sudo_intercept.so to main sudo process. 60 * Sudo sends back the token and localhost port number. 61 */ 62 struct _InterceptHello 63 { 64 ProtobufCMessage base; 65 int32_t pid; 66 }; 67 #define INTERCEPT_HELLO__INIT \ 68 { PROTOBUF_C_MESSAGE_INIT (&intercept_hello__descriptor) \ 69 , 0 } 70 71 72 /* 73 * Sudo response to an InterceptHello from sudo_intercept.so. 74 * The client uses the port number and token to connect back to sudo. 75 */ 76 struct _HelloResponse 77 { 78 ProtobufCMessage base; 79 uint64_t token_lo; 80 uint64_t token_hi; 81 int32_t portno; 82 }; 83 #define HELLO_RESPONSE__INIT \ 84 { PROTOBUF_C_MESSAGE_INIT (&hello_response__descriptor) \ 85 , 0, 0, 0 } 86 87 88 /* 89 * Policy check request from sudo_intercept.so. 90 * Note that the plugin API only currently supports passing 91 * the new environment in to the open() function. 92 */ 93 struct _PolicyCheckRequest 94 { 95 ProtobufCMessage base; 96 char *command; 97 char *cwd; 98 size_t n_argv; 99 char **argv; 100 size_t n_envp; 101 char **envp; 102 int32_t intercept_fd; 103 }; 104 #define POLICY_CHECK_REQUEST__INIT \ 105 { PROTOBUF_C_MESSAGE_INIT (&policy_check_request__descriptor) \ 106 , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, 0,NULL, 0 } 107 108 109 struct _PolicyAcceptMessage 110 { 111 ProtobufCMessage base; 112 char *run_command; 113 size_t n_run_argv; 114 char **run_argv; 115 size_t n_run_envp; 116 char **run_envp; 117 }; 118 #define POLICY_ACCEPT_MESSAGE__INIT \ 119 { PROTOBUF_C_MESSAGE_INIT (&policy_accept_message__descriptor) \ 120 , (char *)protobuf_c_empty_string, 0,NULL, 0,NULL } 121 122 123 struct _PolicyRejectMessage 124 { 125 ProtobufCMessage base; 126 char *reject_message; 127 }; 128 #define POLICY_REJECT_MESSAGE__INIT \ 129 { PROTOBUF_C_MESSAGE_INIT (&policy_reject_message__descriptor) \ 130 , (char *)protobuf_c_empty_string } 131 132 133 struct _PolicyErrorMessage 134 { 135 ProtobufCMessage base; 136 char *error_message; 137 }; 138 #define POLICY_ERROR_MESSAGE__INIT \ 139 { PROTOBUF_C_MESSAGE_INIT (&policy_error_message__descriptor) \ 140 , (char *)protobuf_c_empty_string } 141 142 143 typedef enum { 144 INTERCEPT_RESPONSE__TYPE__NOT_SET = 0, 145 INTERCEPT_RESPONSE__TYPE_HELLO_RESP = 1, 146 INTERCEPT_RESPONSE__TYPE_ACCEPT_MSG = 2, 147 INTERCEPT_RESPONSE__TYPE_REJECT_MSG = 3, 148 INTERCEPT_RESPONSE__TYPE_ERROR_MSG = 4 149 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(INTERCEPT_RESPONSE__TYPE) 150 } InterceptResponse__TypeCase; 151 152 /* 153 * Response sent back to sudo_intercept.so. 154 */ 155 struct _InterceptResponse 156 { 157 ProtobufCMessage base; 158 InterceptResponse__TypeCase type_case; 159 union { 160 HelloResponse *hello_resp; 161 PolicyAcceptMessage *accept_msg; 162 PolicyRejectMessage *reject_msg; 163 PolicyErrorMessage *error_msg; 164 } u; 165 }; 166 #define INTERCEPT_RESPONSE__INIT \ 167 { PROTOBUF_C_MESSAGE_INIT (&intercept_response__descriptor) \ 168 , INTERCEPT_RESPONSE__TYPE__NOT_SET, {0} } 169 170 171 /* InterceptRequest methods */ 172 void intercept_request__init 173 (InterceptRequest *message); 174 size_t intercept_request__get_packed_size 175 (const InterceptRequest *message); 176 size_t intercept_request__pack 177 (const InterceptRequest *message, 178 uint8_t *out); 179 size_t intercept_request__pack_to_buffer 180 (const InterceptRequest *message, 181 ProtobufCBuffer *buffer); 182 InterceptRequest * 183 intercept_request__unpack 184 (ProtobufCAllocator *allocator, 185 size_t len, 186 const uint8_t *data); 187 void intercept_request__free_unpacked 188 (InterceptRequest *message, 189 ProtobufCAllocator *allocator); 190 /* InterceptHello methods */ 191 void intercept_hello__init 192 (InterceptHello *message); 193 size_t intercept_hello__get_packed_size 194 (const InterceptHello *message); 195 size_t intercept_hello__pack 196 (const InterceptHello *message, 197 uint8_t *out); 198 size_t intercept_hello__pack_to_buffer 199 (const InterceptHello *message, 200 ProtobufCBuffer *buffer); 201 InterceptHello * 202 intercept_hello__unpack 203 (ProtobufCAllocator *allocator, 204 size_t len, 205 const uint8_t *data); 206 void intercept_hello__free_unpacked 207 (InterceptHello *message, 208 ProtobufCAllocator *allocator); 209 /* HelloResponse methods */ 210 void hello_response__init 211 (HelloResponse *message); 212 size_t hello_response__get_packed_size 213 (const HelloResponse *message); 214 size_t hello_response__pack 215 (const HelloResponse *message, 216 uint8_t *out); 217 size_t hello_response__pack_to_buffer 218 (const HelloResponse *message, 219 ProtobufCBuffer *buffer); 220 HelloResponse * 221 hello_response__unpack 222 (ProtobufCAllocator *allocator, 223 size_t len, 224 const uint8_t *data); 225 void hello_response__free_unpacked 226 (HelloResponse *message, 227 ProtobufCAllocator *allocator); 228 /* PolicyCheckRequest methods */ 229 void policy_check_request__init 230 (PolicyCheckRequest *message); 231 size_t policy_check_request__get_packed_size 232 (const PolicyCheckRequest *message); 233 size_t policy_check_request__pack 234 (const PolicyCheckRequest *message, 235 uint8_t *out); 236 size_t policy_check_request__pack_to_buffer 237 (const PolicyCheckRequest *message, 238 ProtobufCBuffer *buffer); 239 PolicyCheckRequest * 240 policy_check_request__unpack 241 (ProtobufCAllocator *allocator, 242 size_t len, 243 const uint8_t *data); 244 void policy_check_request__free_unpacked 245 (PolicyCheckRequest *message, 246 ProtobufCAllocator *allocator); 247 /* PolicyAcceptMessage methods */ 248 void policy_accept_message__init 249 (PolicyAcceptMessage *message); 250 size_t policy_accept_message__get_packed_size 251 (const PolicyAcceptMessage *message); 252 size_t policy_accept_message__pack 253 (const PolicyAcceptMessage *message, 254 uint8_t *out); 255 size_t policy_accept_message__pack_to_buffer 256 (const PolicyAcceptMessage *message, 257 ProtobufCBuffer *buffer); 258 PolicyAcceptMessage * 259 policy_accept_message__unpack 260 (ProtobufCAllocator *allocator, 261 size_t len, 262 const uint8_t *data); 263 void policy_accept_message__free_unpacked 264 (PolicyAcceptMessage *message, 265 ProtobufCAllocator *allocator); 266 /* PolicyRejectMessage methods */ 267 void policy_reject_message__init 268 (PolicyRejectMessage *message); 269 size_t policy_reject_message__get_packed_size 270 (const PolicyRejectMessage *message); 271 size_t policy_reject_message__pack 272 (const PolicyRejectMessage *message, 273 uint8_t *out); 274 size_t policy_reject_message__pack_to_buffer 275 (const PolicyRejectMessage *message, 276 ProtobufCBuffer *buffer); 277 PolicyRejectMessage * 278 policy_reject_message__unpack 279 (ProtobufCAllocator *allocator, 280 size_t len, 281 const uint8_t *data); 282 void policy_reject_message__free_unpacked 283 (PolicyRejectMessage *message, 284 ProtobufCAllocator *allocator); 285 /* PolicyErrorMessage methods */ 286 void policy_error_message__init 287 (PolicyErrorMessage *message); 288 size_t policy_error_message__get_packed_size 289 (const PolicyErrorMessage *message); 290 size_t policy_error_message__pack 291 (const PolicyErrorMessage *message, 292 uint8_t *out); 293 size_t policy_error_message__pack_to_buffer 294 (const PolicyErrorMessage *message, 295 ProtobufCBuffer *buffer); 296 PolicyErrorMessage * 297 policy_error_message__unpack 298 (ProtobufCAllocator *allocator, 299 size_t len, 300 const uint8_t *data); 301 void policy_error_message__free_unpacked 302 (PolicyErrorMessage *message, 303 ProtobufCAllocator *allocator); 304 /* InterceptResponse methods */ 305 void intercept_response__init 306 (InterceptResponse *message); 307 size_t intercept_response__get_packed_size 308 (const InterceptResponse *message); 309 size_t intercept_response__pack 310 (const InterceptResponse *message, 311 uint8_t *out); 312 size_t intercept_response__pack_to_buffer 313 (const InterceptResponse *message, 314 ProtobufCBuffer *buffer); 315 InterceptResponse * 316 intercept_response__unpack 317 (ProtobufCAllocator *allocator, 318 size_t len, 319 const uint8_t *data); 320 void intercept_response__free_unpacked 321 (InterceptResponse *message, 322 ProtobufCAllocator *allocator); 323 /* --- per-message closures --- */ 324 325 typedef void (*InterceptRequest_Closure) 326 (const InterceptRequest *message, 327 void *closure_data); 328 typedef void (*InterceptHello_Closure) 329 (const InterceptHello *message, 330 void *closure_data); 331 typedef void (*HelloResponse_Closure) 332 (const HelloResponse *message, 333 void *closure_data); 334 typedef void (*PolicyCheckRequest_Closure) 335 (const PolicyCheckRequest *message, 336 void *closure_data); 337 typedef void (*PolicyAcceptMessage_Closure) 338 (const PolicyAcceptMessage *message, 339 void *closure_data); 340 typedef void (*PolicyRejectMessage_Closure) 341 (const PolicyRejectMessage *message, 342 void *closure_data); 343 typedef void (*PolicyErrorMessage_Closure) 344 (const PolicyErrorMessage *message, 345 void *closure_data); 346 typedef void (*InterceptResponse_Closure) 347 (const InterceptResponse *message, 348 void *closure_data); 349 350 /* --- services --- */ 351 352 353 /* --- descriptors --- */ 354 355 extern const ProtobufCMessageDescriptor intercept_request__descriptor; 356 extern const ProtobufCMessageDescriptor intercept_hello__descriptor; 357 extern const ProtobufCMessageDescriptor hello_response__descriptor; 358 extern const ProtobufCMessageDescriptor policy_check_request__descriptor; 359 extern const ProtobufCMessageDescriptor policy_accept_message__descriptor; 360 extern const ProtobufCMessageDescriptor policy_reject_message__descriptor; 361 extern const ProtobufCMessageDescriptor policy_error_message__descriptor; 362 extern const ProtobufCMessageDescriptor intercept_response__descriptor; 363 364 PROTOBUF_C__END_DECLS 365 366 367 #endif /* PROTOBUF_C_intercept_2eproto__INCLUDED */ 368