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