OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * |
| 3 * Copyright 2015-2016, Google 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 |
| 8 * met: |
| 9 * |
| 10 * * Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above |
| 13 * copyright notice, this list of conditions and the following disclaimer |
| 14 * in the documentation and/or other materials provided with the |
| 15 * distribution. |
| 16 * * Neither the name of Google Inc. nor the names of its |
| 17 * contributors may be used to endorse or promote products derived from |
| 18 * this software without specific prior written permission. |
| 19 * |
| 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 32 */ |
| 33 |
| 34 #ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H |
| 35 #define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H |
| 36 |
| 37 #include <grpc/compression.h> |
| 38 #include <grpc/grpc.h> |
| 39 |
| 40 /* Copy some arguments */ |
| 41 grpc_channel_args *grpc_channel_args_copy(const grpc_channel_args *src); |
| 42 |
| 43 /* Copy some arguments, stably sorting keys */ |
| 44 grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *a); |
| 45 |
| 46 /** Copy some arguments and add the to_add parameter in the end. |
| 47 If to_add is NULL, it is equivalent to call grpc_channel_args_copy. */ |
| 48 grpc_channel_args *grpc_channel_args_copy_and_add(const grpc_channel_args *src, |
| 49 const grpc_arg *to_add, |
| 50 size_t num_to_add); |
| 51 |
| 52 /** Copy args from a then args from b into a new channel args */ |
| 53 grpc_channel_args *grpc_channel_args_merge(const grpc_channel_args *a, |
| 54 const grpc_channel_args *b); |
| 55 |
| 56 /** Destroy arguments created by grpc_channel_args_copy */ |
| 57 void grpc_channel_args_destroy(grpc_channel_args *a); |
| 58 |
| 59 /** Reads census_enabled settings from channel args. Returns 1 if census_enabled |
| 60 * is specified in channel args, otherwise returns 0. */ |
| 61 int grpc_channel_args_is_census_enabled(const grpc_channel_args *a); |
| 62 |
| 63 /** Returns the compression algorithm set in \a a. */ |
| 64 grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( |
| 65 const grpc_channel_args *a); |
| 66 |
| 67 /** Returns a channel arg instance with compression enabled. If \a a is |
| 68 * non-NULL, its args are copied. N.B. GRPC_COMPRESS_NONE disables compression |
| 69 * for the channel. */ |
| 70 grpc_channel_args *grpc_channel_args_set_compression_algorithm( |
| 71 grpc_channel_args *a, grpc_compression_algorithm algorithm); |
| 72 |
| 73 /** Sets the support for the given compression algorithm. By default, all |
| 74 * compression algorithms are enabled. It's an error to disable an algorithm set |
| 75 * by grpc_channel_args_set_compression_algorithm. |
| 76 * |
| 77 * Returns an instance with the updated algorithm states. The \a a pointer is |
| 78 * modified to point to the returned instance (which may be different from the |
| 79 * input value of \a a). */ |
| 80 grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( |
| 81 grpc_channel_args **a, grpc_compression_algorithm algorithm, int enabled); |
| 82 |
| 83 /** Returns the bitset representing the support state (true for enabled, false |
| 84 * for disabled) for compression algorithms. |
| 85 * |
| 86 * The i-th bit of the returned bitset corresponds to the i-th entry in the |
| 87 * grpc_compression_algorithm enum. */ |
| 88 int grpc_channel_args_compression_algorithm_get_states( |
| 89 const grpc_channel_args *a); |
| 90 |
| 91 int grpc_channel_args_compare(const grpc_channel_args *a, |
| 92 const grpc_channel_args *b); |
| 93 |
| 94 #endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H */ |
OLD | NEW |