1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 * Copyright (c) 2008, 2021, Oracle and/or its affiliates. 4 * Use is subject to license terms 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * * Neither the name of the nor the 14 * names of its contributors may be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``AS IS'' AND ANY 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 /* 29 * Summary: Constants used by to implement the binary protocol. 30 * 31 * Copy: See Copyright for the status of this software. 32 * 33 * Author: Trond Norbye <trond.norbye@sun.com> 34 */ 35 36 #ifndef PROTOCOL_BINARY_H 37 #define PROTOCOL_BINARY_H 38 39 #include <stdint.h> 40 #include <memcached/vbucket.h> 41 42 /** 43 * \addtogroup Protocol 44 * @{ 45 */ 46 47 /** 48 * This file contains definitions of the constants and packet formats 49 * defined in the binary specification. Please note that you _MUST_ remember 50 * to convert each multibyte field to / from network byte order to / from 51 * host order. 52 */ 53 #ifdef __cplusplus 54 extern "C" 55 { 56 #endif 57 58 /** 59 * Definition of the legal "magic" values used in a packet. 60 * See section 3.1 Magic byte 61 */ 62 typedef enum { 63 PROTOCOL_BINARY_REQ = 0x80, 64 PROTOCOL_BINARY_RES = 0x81 65 } protocol_binary_magic; 66 67 /** 68 * Definition of the valid response status numbers. 69 * See section 3.2 Response Status 70 */ 71 typedef enum { 72 PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00, 73 PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01, 74 PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02, 75 PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03, 76 PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04, 77 PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05, 78 PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06, 79 PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07, 80 PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20, 81 PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21, 82 PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81, 83 PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82, 84 PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED = 0x83, 85 PROTOCOL_BINARY_RESPONSE_EINTERNAL = 0x84, 86 PROTOCOL_BINARY_RESPONSE_EBUSY = 0x85, 87 PROTOCOL_BINARY_RESPONSE_ETMPFAIL = 0x86 88 } protocol_binary_response_status; 89 90 /** 91 * Defintion of the different command opcodes. 92 * See section 3.3 Command Opcodes 93 */ 94 typedef enum { 95 PROTOCOL_BINARY_CMD_GET = 0x00, 96 PROTOCOL_BINARY_CMD_SET = 0x01, 97 PROTOCOL_BINARY_CMD_ADD = 0x02, 98 PROTOCOL_BINARY_CMD_REPLACE = 0x03, 99 PROTOCOL_BINARY_CMD_DELETE = 0x04, 100 PROTOCOL_BINARY_CMD_INCREMENT = 0x05, 101 PROTOCOL_BINARY_CMD_DECREMENT = 0x06, 102 PROTOCOL_BINARY_CMD_QUIT = 0x07, 103 PROTOCOL_BINARY_CMD_FLUSH = 0x08, 104 PROTOCOL_BINARY_CMD_GETQ = 0x09, 105 PROTOCOL_BINARY_CMD_NOOP = 0x0a, 106 PROTOCOL_BINARY_CMD_VERSION = 0x0b, 107 PROTOCOL_BINARY_CMD_GETK = 0x0c, 108 PROTOCOL_BINARY_CMD_GETKQ = 0x0d, 109 PROTOCOL_BINARY_CMD_APPEND = 0x0e, 110 PROTOCOL_BINARY_CMD_PREPEND = 0x0f, 111 PROTOCOL_BINARY_CMD_STAT = 0x10, 112 PROTOCOL_BINARY_CMD_SETQ = 0x11, 113 PROTOCOL_BINARY_CMD_ADDQ = 0x12, 114 PROTOCOL_BINARY_CMD_REPLACEQ = 0x13, 115 PROTOCOL_BINARY_CMD_DELETEQ = 0x14, 116 PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15, 117 PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16, 118 PROTOCOL_BINARY_CMD_QUITQ = 0x17, 119 PROTOCOL_BINARY_CMD_FLUSHQ = 0x18, 120 PROTOCOL_BINARY_CMD_APPENDQ = 0x19, 121 PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a, 122 PROTOCOL_BINARY_CMD_VERBOSITY = 0x1b, 123 PROTOCOL_BINARY_CMD_TOUCH = 0x1c, 124 PROTOCOL_BINARY_CMD_GAT = 0x1d, 125 PROTOCOL_BINARY_CMD_GATQ = 0x1e, 126 127 PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20, 128 PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21, 129 PROTOCOL_BINARY_CMD_SASL_STEP = 0x22, 130 131 /* These commands are used for range operations and exist within 132 * this header for use in other projects. Range operations are 133 * not expected to be implemented in the memcached server itself. 134 */ 135 PROTOCOL_BINARY_CMD_RGET = 0x30, 136 PROTOCOL_BINARY_CMD_RSET = 0x31, 137 PROTOCOL_BINARY_CMD_RSETQ = 0x32, 138 PROTOCOL_BINARY_CMD_RAPPEND = 0x33, 139 PROTOCOL_BINARY_CMD_RAPPENDQ = 0x34, 140 PROTOCOL_BINARY_CMD_RPREPEND = 0x35, 141 PROTOCOL_BINARY_CMD_RPREPENDQ = 0x36, 142 PROTOCOL_BINARY_CMD_RDELETE = 0x37, 143 PROTOCOL_BINARY_CMD_RDELETEQ = 0x38, 144 PROTOCOL_BINARY_CMD_RINCR = 0x39, 145 PROTOCOL_BINARY_CMD_RINCRQ = 0x3a, 146 PROTOCOL_BINARY_CMD_RDECR = 0x3b, 147 PROTOCOL_BINARY_CMD_RDECRQ = 0x3c, 148 /* End Range operations */ 149 150 /* VBucket commands */ 151 PROTOCOL_BINARY_CMD_SET_VBUCKET = 0x3d, 152 PROTOCOL_BINARY_CMD_GET_VBUCKET = 0x3e, 153 PROTOCOL_BINARY_CMD_DEL_VBUCKET = 0x3f, 154 /* End VBucket commands */ 155 156 /* TAP commands */ 157 PROTOCOL_BINARY_CMD_TAP_CONNECT = 0x40, 158 PROTOCOL_BINARY_CMD_TAP_MUTATION = 0x41, 159 PROTOCOL_BINARY_CMD_TAP_DELETE = 0x42, 160 PROTOCOL_BINARY_CMD_TAP_FLUSH = 0x43, 161 PROTOCOL_BINARY_CMD_TAP_OPAQUE = 0x44, 162 PROTOCOL_BINARY_CMD_TAP_VBUCKET_SET = 0x45, 163 PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_START = 0x46, 164 PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_END = 0x47, 165 /* End TAP */ 166 167 PROTOCOL_BINARY_CMD_LAST_RESERVED = 0x8f, 168 169 /* Scrub the data */ 170 PROTOCOL_BINARY_CMD_SCRUB = 0xf0 171 } protocol_binary_command; 172 173 /** 174 * Definition of the data types in the packet 175 * See section 3.4 Data Types 176 */ 177 typedef enum { 178 PROTOCOL_BINARY_RAW_BYTES = 0x00 179 } protocol_binary_datatypes; 180 181 /** 182 * Definition of the header structure for a request packet. 183 * See section 2 184 */ 185 typedef union { 186 struct { 187 uint8_t magic; 188 uint8_t opcode; 189 uint16_t keylen; 190 uint8_t extlen; 191 uint8_t datatype; 192 uint16_t vbucket; 193 uint32_t bodylen; 194 uint32_t opaque; 195 uint64_t cas; 196 } request; 197 uint8_t bytes[24]; 198 } protocol_binary_request_header; 199 200 /** 201 * Definition of the header structure for a response packet. 202 * See section 2 203 */ 204 typedef union { 205 struct { 206 uint8_t magic; 207 uint8_t opcode; 208 uint16_t keylen; 209 uint8_t extlen; 210 uint8_t datatype; 211 uint16_t status; 212 uint32_t bodylen; 213 uint32_t opaque; 214 uint64_t cas; 215 } response; 216 uint8_t bytes[24]; 217 } protocol_binary_response_header; 218 219 /** 220 * Definition of a request-packet containing no extras 221 */ 222 typedef union { 223 struct { 224 protocol_binary_request_header header; 225 } message; 226 uint8_t bytes[sizeof(protocol_binary_request_header)]; 227 } protocol_binary_request_no_extras; 228 229 /** 230 * Definition of a response-packet containing no extras 231 */ 232 typedef union { 233 struct { 234 protocol_binary_response_header header; 235 } message; 236 uint8_t bytes[sizeof(protocol_binary_response_header)]; 237 } protocol_binary_response_no_extras; 238 239 /** 240 * Definition of the packet used by the get, getq, getk and getkq command. 241 * See section 4 242 */ 243 typedef protocol_binary_request_no_extras protocol_binary_request_get; 244 typedef protocol_binary_request_no_extras protocol_binary_request_getq; 245 typedef protocol_binary_request_no_extras protocol_binary_request_getk; 246 typedef protocol_binary_request_no_extras protocol_binary_request_getkq; 247 248 /** 249 * Definition of the packet returned from a successful get, getq, getk and 250 * getkq. 251 * See section 4 252 */ 253 typedef union { 254 struct { 255 protocol_binary_response_header header; 256 struct { 257 uint32_t flags; 258 } body; 259 } message; 260 uint8_t bytes[sizeof(protocol_binary_response_header) + 4]; 261 } protocol_binary_response_get; 262 263 typedef protocol_binary_response_get protocol_binary_response_getq; 264 typedef protocol_binary_response_get protocol_binary_response_getk; 265 typedef protocol_binary_response_get protocol_binary_response_getkq; 266 267 /** 268 * Definition of the packet used by the delete command 269 * See section 4 270 */ 271 typedef protocol_binary_request_no_extras protocol_binary_request_delete; 272 273 /** 274 * Definition of the packet returned by the delete command 275 * See section 4 276 */ 277 typedef protocol_binary_response_no_extras protocol_binary_response_delete; 278 279 /** 280 * Definition of the packet used by the flush command 281 * See section 4 282 * Please note that the expiration field is optional, so remember to see 283 * check the header.bodysize to see if it is present. 284 */ 285 typedef union { 286 struct { 287 protocol_binary_request_header header; 288 struct { 289 uint32_t expiration; 290 } body; 291 } message; 292 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 293 } protocol_binary_request_flush; 294 295 /** 296 * Definition of the packet returned by the flush command 297 * See section 4 298 */ 299 typedef protocol_binary_response_no_extras protocol_binary_response_flush; 300 301 /** 302 * Definition of the packet used by set, add and replace 303 * See section 4 304 */ 305 typedef union { 306 struct { 307 protocol_binary_request_header header; 308 struct { 309 uint32_t flags; 310 uint32_t expiration; 311 } body; 312 } message; 313 uint8_t bytes[sizeof(protocol_binary_request_header) + 8]; 314 } protocol_binary_request_set; 315 typedef protocol_binary_request_set protocol_binary_request_add; 316 typedef protocol_binary_request_set protocol_binary_request_replace; 317 318 /** 319 * Definition of the packet returned by set, add and replace 320 * See section 4 321 */ 322 typedef protocol_binary_response_no_extras protocol_binary_response_set; 323 typedef protocol_binary_response_no_extras protocol_binary_response_add; 324 typedef protocol_binary_response_no_extras protocol_binary_response_replace; 325 326 /** 327 * Definition of the noop packet 328 * See section 4 329 */ 330 typedef protocol_binary_request_no_extras protocol_binary_request_noop; 331 332 /** 333 * Definition of the packet returned by the noop command 334 * See section 4 335 */ 336 typedef protocol_binary_response_no_extras protocol_binary_response_noop; 337 338 /** 339 * Definition of the structure used by the increment and decrement 340 * command. 341 * See section 4 342 */ 343 typedef union { 344 struct { 345 protocol_binary_request_header header; 346 struct { 347 uint64_t delta; 348 uint64_t initial; 349 uint32_t expiration; 350 } body; 351 } message; 352 uint8_t bytes[sizeof(protocol_binary_request_header) + 20]; 353 } protocol_binary_request_incr; 354 typedef protocol_binary_request_incr protocol_binary_request_decr; 355 356 /** 357 * Definition of the response from an incr or decr command 358 * command. 359 * See section 4 360 */ 361 typedef union { 362 struct { 363 protocol_binary_response_header header; 364 struct { 365 uint64_t value; 366 } body; 367 } message; 368 uint8_t bytes[sizeof(protocol_binary_response_header) + 8]; 369 } protocol_binary_response_incr; 370 typedef protocol_binary_response_incr protocol_binary_response_decr; 371 372 /** 373 * Definition of the quit 374 * See section 4 375 */ 376 typedef protocol_binary_request_no_extras protocol_binary_request_quit; 377 378 /** 379 * Definition of the packet returned by the quit command 380 * See section 4 381 */ 382 typedef protocol_binary_response_no_extras protocol_binary_response_quit; 383 384 /** 385 * Definition of the packet used by append and prepend command 386 * See section 4 387 */ 388 typedef protocol_binary_request_no_extras protocol_binary_request_append; 389 typedef protocol_binary_request_no_extras protocol_binary_request_prepend; 390 391 /** 392 * Definition of the packet returned from a successful append or prepend 393 * See section 4 394 */ 395 typedef protocol_binary_response_no_extras protocol_binary_response_append; 396 typedef protocol_binary_response_no_extras protocol_binary_response_prepend; 397 398 /** 399 * Definition of the packet used by the version command 400 * See section 4 401 */ 402 typedef protocol_binary_request_no_extras protocol_binary_request_version; 403 404 /** 405 * Definition of the packet returned from a successful version command 406 * See section 4 407 */ 408 typedef protocol_binary_response_no_extras protocol_binary_response_version; 409 410 411 /** 412 * Definition of the packet used by the stats command. 413 * See section 4 414 */ 415 typedef protocol_binary_request_no_extras protocol_binary_request_stats; 416 417 /** 418 * Definition of the packet returned from a successful stats command 419 * See section 4 420 */ 421 typedef protocol_binary_response_no_extras protocol_binary_response_stats; 422 423 /** 424 * Definition of the packet used by the verbosity command 425 */ 426 typedef union { 427 struct { 428 protocol_binary_request_header header; 429 struct { 430 uint32_t level; 431 } body; 432 } message; 433 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 434 } protocol_binary_request_verbosity; 435 436 /** 437 * Definition of the packet returned from the verbosity command 438 */ 439 typedef protocol_binary_response_no_extras protocol_binary_response_verbosity; 440 441 /** 442 * Definition of the packet used by the touch command. 443 */ 444 typedef union { 445 struct { 446 protocol_binary_request_header header; 447 struct { 448 uint32_t expiration; 449 } body; 450 } message; 451 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 452 } protocol_binary_request_touch; 453 454 /** 455 * Definition of the packet returned from the touch command 456 */ 457 typedef protocol_binary_response_no_extras protocol_binary_response_touch; 458 459 /** 460 * Definition of the packet used by the GAT(Q) command. 461 */ 462 typedef union { 463 struct { 464 protocol_binary_request_header header; 465 struct { 466 uint32_t expiration; 467 } body; 468 } message; 469 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 470 } protocol_binary_request_gat; 471 472 typedef protocol_binary_request_gat protocol_binary_request_gatq; 473 474 /** 475 * Definition of the packet returned from the GAT(Q) 476 */ 477 typedef protocol_binary_response_get protocol_binary_response_gat; 478 typedef protocol_binary_response_get protocol_binary_response_gatq; 479 480 481 /** 482 * Definition of a request for a range operation. 483 * See http://code.google.com/p/memcached/wiki/RangeOps 484 * 485 * These types are used for range operations and exist within 486 * this header for use in other projects. Range operations are 487 * not expected to be implemented in the memcached server itself. 488 */ 489 typedef union { 490 struct { 491 protocol_binary_response_header header; 492 struct { 493 uint16_t size; 494 uint8_t reserved; 495 uint8_t flags; 496 uint32_t max_results; 497 } body; 498 } message; 499 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 500 } protocol_binary_request_rangeop; 501 502 typedef protocol_binary_request_rangeop protocol_binary_request_rget; 503 typedef protocol_binary_request_rangeop protocol_binary_request_rset; 504 typedef protocol_binary_request_rangeop protocol_binary_request_rsetq; 505 typedef protocol_binary_request_rangeop protocol_binary_request_rappend; 506 typedef protocol_binary_request_rangeop protocol_binary_request_rappendq; 507 typedef protocol_binary_request_rangeop protocol_binary_request_rprepend; 508 typedef protocol_binary_request_rangeop protocol_binary_request_rprependq; 509 typedef protocol_binary_request_rangeop protocol_binary_request_rdelete; 510 typedef protocol_binary_request_rangeop protocol_binary_request_rdeleteq; 511 typedef protocol_binary_request_rangeop protocol_binary_request_rincr; 512 typedef protocol_binary_request_rangeop protocol_binary_request_rincrq; 513 typedef protocol_binary_request_rangeop protocol_binary_request_rdecr; 514 typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq; 515 516 517 /** 518 * Definition of tap commands 519 * See To be written 520 * 521 */ 522 523 typedef union { 524 struct { 525 protocol_binary_request_header header; 526 struct { 527 /** 528 * flags is a bitmask used to set properties for the 529 * the connection. Please In order to be forward compatible 530 * you should set all undefined bits to 0. 531 * 532 * If the bit require extra userdata, it will be stored 533 * in the user-data field of the body (passed to the engine 534 * as enginespeciffic). That means that when you parse the 535 * flags and the engine-specific data, you have to work your 536 * way from bit 0 and upwards to find the correct offset for 537 * the data. 538 * 539 */ 540 uint32_t flags; 541 542 /** 543 * Backfill age 544 * 545 * By using this flag you can limit the amount of data being 546 * transmitted. If you don't specify a backfill age, the 547 * server will transmit everything it contains. 548 * 549 * The first 8 bytes in the engine specific data contains 550 * the oldest entry (from epoc) you're interested in. 551 * Specifying a time in the future (for the server you are 552 * connecting to), will cause it to start streaming current 553 * changes. 554 */ 555 #define TAP_CONNECT_FLAG_BACKFILL 0x01 556 /** 557 * Dump will cause the server to send the data stored on the 558 * server, but disconnect when the keys stored in the server 559 * are transmitted. 560 */ 561 #define TAP_CONNECT_FLAG_DUMP 0x02 562 /** 563 * The body contains a list of 16 bits words in network byte 564 * order specifying the vbucket ids to monitor. The first 16 565 * bit word contains the number of buckets. The number of 0 566 * means "all buckets" 567 */ 568 #define TAP_CONNECT_FLAG_LIST_VBUCKETS 0x04 569 /** 570 * The responsibility of the vbuckets is to be transferred 571 * over to the caller when all items are transferred. 572 */ 573 #define TAP_CONNECT_FLAG_TAKEOVER_VBUCKETS 0x08 574 /** 575 * The tap consumer supports ack'ing of tap messages 576 */ 577 #define TAP_CONNECT_SUPPORT_ACK 0x10 578 /** 579 * The tap consumer would prefer to just get the keys 580 * back. If the engine supports this it will set 581 * the TAP_FLAG_NO_VALUE flag in each of the 582 * tap packets returned. 583 */ 584 #define TAP_CONNECT_REQUEST_KEYS_ONLY 0x20 585 /** 586 * The body contains a list of (vbucket_id, last_checkpoint_id) 587 * pairs. This provides the checkpoint support in TAP streams. 588 * The last checkpoint id represents the last checkpoint that 589 * was successfully persisted. 590 */ 591 #define TAP_CONNECT_CHECKPOINT 0x40 592 /** 593 * The tap consumer is a registered tap client, which means that 594 * the tap server will maintain its checkpoint cursor permanently. 595 */ 596 #define TAP_CONNECT_REGISTERED_CLIENT 0x80 597 } body; 598 } message; 599 uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; 600 } protocol_binary_request_tap_connect; 601 602 typedef union { 603 struct { 604 protocol_binary_request_header header; 605 struct { 606 struct { 607 uint16_t enginespecific_length; 608 /* 609 * The flag section support the following flags 610 */ 611 /** 612 * Request that the consumer send a response packet 613 * for this packet. The opaque field must be preserved 614 * in the response. 615 */ 616 #define TAP_FLAG_ACK 0x01 617 /** 618 * The value for the key is not included in the packet 619 */ 620 #define TAP_FLAG_NO_VALUE 0x02 621 uint16_t flags; 622 uint8_t ttl; 623 uint8_t res1; 624 uint8_t res2; 625 uint8_t res3; 626 } tap; 627 struct { 628 uint32_t flags; 629 uint32_t expiration; 630 } item; 631 } body; 632 } message; 633 uint8_t bytes[sizeof(protocol_binary_request_header) + 16]; 634 } protocol_binary_request_tap_mutation; 635 636 typedef union { 637 struct { 638 protocol_binary_request_header header; 639 struct { 640 struct { 641 uint16_t enginespecific_length; 642 /** 643 * See the definition of the flags for 644 * protocol_binary_request_tap_mutation for a description 645 * of the available flags. 646 */ 647 uint16_t flags; 648 uint8_t ttl; 649 uint8_t res1; 650 uint8_t res2; 651 uint8_t res3; 652 } tap; 653 } body; 654 } message; 655 uint8_t bytes[sizeof(protocol_binary_request_header) + 8]; 656 } protocol_binary_request_tap_no_extras; 657 658 typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_delete; 659 typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_flush; 660 typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_opaque; 661 typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_vbucket_set; 662 663 664 /** 665 * Definition of the packet used by the scrub. 666 */ 667 typedef protocol_binary_request_no_extras protocol_binary_request_scrub; 668 669 /** 670 * Definition of the packet returned from scrub. 671 */ 672 typedef protocol_binary_response_no_extras protocol_binary_response_scrub; 673 674 675 /** 676 * Definition of the packet used by set vbucket 677 */ 678 typedef union { 679 struct { 680 protocol_binary_request_header header; 681 struct { 682 vbucket_state_t state; 683 } body; 684 } message; 685 uint8_t bytes[sizeof(protocol_binary_request_header) + sizeof(vbucket_state_t)]; 686 } protocol_binary_request_set_vbucket; 687 /** 688 * Definition of the packet returned from set vbucket 689 */ 690 typedef protocol_binary_response_no_extras protocol_binary_response_set_vbucket; 691 /** 692 * Definition of the packet used by del vbucket 693 */ 694 typedef protocol_binary_request_no_extras protocol_binary_request_del_vbucket; 695 /** 696 * Definition of the packet returned from del vbucket 697 */ 698 typedef protocol_binary_response_no_extras protocol_binary_response_del_vbucket; 699 700 /** 701 * Definition of the packet used by get vbucket 702 */ 703 typedef protocol_binary_request_no_extras protocol_binary_request_get_vbucket; 704 705 /** 706 * Definition of the packet returned from get vbucket 707 */ 708 typedef union { 709 struct { 710 protocol_binary_response_header header; 711 struct { 712 vbucket_state_t state; 713 } body; 714 } message; 715 uint8_t bytes[sizeof(protocol_binary_response_header) + sizeof(vbucket_state_t)]; 716 } protocol_binary_response_get_vbucket; 717 718 719 /** 720 * @} 721 */ 722 723 #ifdef __cplusplus 724 } 725 #endif 726 #endif /* PROTOCOL_BINARY_H */ 727