aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-01-29 12:34:28 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-01-29 12:34:28 -0800
commit86d8f5ca71ec176682281f63421852f0c16ebe91 (patch)
tree9aaf914efd15fe6bca2a6e342594193012b5eb19
parenteecd9e2d23261f953c23dd8381b2736e1c0c230e (diff)
parent07871559e1dc2e2ed352a9fd2d9772103f3722ef (diff)
Merge pull request #4965 from ctiller/api
Add {GPR,GRPC,CENSUS}_API tags to public functions
-rw-r--r--include/grpc/census.h99
-rw-r--r--include/grpc/compression.h21
-rw-r--r--include/grpc/grpc.h158
-rw-r--r--include/grpc/grpc_security.h92
-rw-r--r--include/grpc/grpc_zookeeper.h4
-rw-r--r--include/grpc/impl/codegen/alloc.h16
-rw-r--r--include/grpc/impl/codegen/byte_buffer.h27
-rw-r--r--include/grpc/impl/codegen/log.h12
-rw-r--r--include/grpc/impl/codegen/port_platform.h12
-rw-r--r--include/grpc/impl/codegen/slice.h32
-rw-r--r--include/grpc/impl/codegen/slice_buffer.h33
-rw-r--r--include/grpc/impl/codegen/sync.h44
-rw-r--r--include/grpc/impl/codegen/time.h46
-rw-r--r--include/grpc/support/avl.h14
-rw-r--r--include/grpc/support/cmdline.h28
-rw-r--r--include/grpc/support/cpu.h8
-rw-r--r--include/grpc/support/histogram.h43
-rw-r--r--include/grpc/support/host_port.h8
-rw-r--r--include/grpc/support/log_win32.h2
-rw-r--r--include/grpc/support/string_util.h6
-rw-r--r--include/grpc/support/subprocess.h14
-rw-r--r--include/grpc/support/thd.h18
22 files changed, 396 insertions, 341 deletions
diff --git a/include/grpc/census.h b/include/grpc/census.h
index f4130c7e6a..70d4f80efb 100644
--- a/include/grpc/census.h
+++ b/include/grpc/census.h
@@ -59,15 +59,15 @@ enum census_features {
* census_initialize() will return a non-zero value. It is an error to call
* census_initialize() more than once (without an intervening
* census_shutdown()). */
-int census_initialize(int features);
-void census_shutdown(void);
+CENSUS_API int census_initialize(int features);
+CENSUS_API void census_shutdown(void);
/** Return the features supported by the current census implementation (not all
* features will be available on all platforms). */
-int census_supported(void);
+CENSUS_API int census_supported(void);
/** Return the census features currently enabled. */
-int census_enabled(void);
+CENSUS_API int census_enabled(void);
/**
Context is a handle used by census to represent the current tracing and
@@ -90,8 +90,8 @@ typedef struct census_context census_context;
*
* TODO(aveitch): determine how best to communicate required/max buffer size
* so caller doesn't have to guess. */
-size_t census_context_serialize(const census_context *context, char *buffer,
- size_t buf_size);
+CENSUS_API size_t census_context_serialize(const census_context *context,
+ char *buffer, size_t buf_size);
/* Distributed traces can have a number of options. */
enum census_trace_mask_values {
@@ -101,10 +101,10 @@ enum census_trace_mask_values {
/** Get the current trace mask associated with this context. The value returned
will be the logical or of census_trace_mask_values values. */
-int census_trace_mask(const census_context *context);
+CENSUS_API int census_trace_mask(const census_context *context);
/** Set the trace mask associated with a context. */
-void census_set_trace_mask(int trace_mask);
+CENSUS_API void census_set_trace_mask(int trace_mask);
/* The concept of "operation" is a fundamental concept for Census. In an RPC
system, and operation typcially represents a single RPC, or a significant
@@ -152,7 +152,7 @@ typedef struct {
@return A timestamp representing the operation start time.
*/
-census_timestamp census_start_rpc_op_timestamp(void);
+CENSUS_API census_timestamp census_start_rpc_op_timestamp(void);
/**
Represent functions to map RPC name ID to service/method names. Census
@@ -204,7 +204,7 @@ typedef struct {
@return A new census context.
*/
-census_context *census_start_client_rpc_op(
+CENSUS_API census_context *census_start_client_rpc_op(
const census_context *context, int64_t rpc_name_id,
const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask,
const census_timestamp *start_time);
@@ -212,7 +212,8 @@ census_context *census_start_client_rpc_op(
/**
Add peer information to a context representing a client RPC operation.
*/
-void census_set_rpc_client_peer(census_context *context, const char *peer);
+CENSUS_API void census_set_rpc_client_peer(census_context *context,
+ const char *peer);
/**
Start a server RPC operation. Returns a new context to be used in future
@@ -232,7 +233,7 @@ void census_set_rpc_client_peer(census_context *context, const char *peer);
@return A new census context.
*/
-census_context *census_start_server_rpc_op(
+CENSUS_API census_context *census_start_server_rpc_op(
const char *buffer, int64_t rpc_name_id,
const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask,
census_timestamp *start_time);
@@ -262,8 +263,9 @@ census_context *census_start_server_rpc_op(
@return A new census context.
*/
-census_context *census_start_op(census_context *context, const char *family,
- const char *name, int trace_mask);
+CENSUS_API census_context *census_start_op(census_context *context,
+ const char *family, const char *name,
+ int trace_mask);
/**
End an operation started by any of the census_start_*_op*() calls. The
@@ -274,7 +276,7 @@ census_context *census_start_op(census_context *context, const char *family,
@param status status associated with the operation. Not interpreted by
census.
*/
-void census_end_op(census_context *context, int status);
+CENSUS_API void census_end_op(census_context *context, int status);
#define CENSUS_TRACE_RECORD_START_OP ((uint32_t)0)
#define CENSUS_TRACE_RECORD_END_OP ((uint32_t)1)
@@ -286,8 +288,8 @@ void census_end_op(census_context *context, int status);
@param buffer Pointer to buffer to use
@param n Number of bytes in buffer
*/
-void census_trace_print(census_context *context, uint32_t type,
- const char *buffer, size_t n);
+CENSUS_API void census_trace_print(census_context *context, uint32_t type,
+ const char *buffer, size_t n);
/** Trace record. */
typedef struct {
@@ -308,7 +310,7 @@ typedef struct {
while scanning is ongoing.
@returns 0 on success, non-zero on failure (e.g. if a scan is already ongoing)
*/
-int census_trace_scan_start(int consume);
+CENSUS_API int census_trace_scan_start(int consume);
/** Get a trace record. The data pointed to by the trace buffer is guaranteed
stable until the next census_get_trace_record() call (if the consume
@@ -319,10 +321,10 @@ int census_trace_scan_start(int consume);
census_trace_scan_start()), 0 if there is no more trace data (and
trace_record will not be modified) or 1 otherwise.
*/
-int census_get_trace_record(census_trace_record *trace_record);
+CENSUS_API int census_get_trace_record(census_trace_record *trace_record);
/** End a scan previously started by census_trace_scan_start() */
-void census_trace_scan_end();
+CENSUS_API void census_trace_scan_end();
/* A Census tag set is a collection of key:value string pairs; these form the
basis against which Census metrics will be recorded. Keys are unique within
@@ -392,16 +394,16 @@ typedef struct {
tag set and status of the tags used in its creation.
@return A new, valid census_tag_set.
*/
-census_tag_set *census_tag_set_create(
+CENSUS_API census_tag_set *census_tag_set_create(
const census_tag_set *base, const census_tag *tags, int ntags,
census_tag_set_create_status const **status);
/* Destroy a tag set created by census_tag_set_create(). Once this function
has been called, the tag set cannot be reused. */
-void census_tag_set_destroy(census_tag_set *tags);
+CENSUS_API void census_tag_set_destroy(census_tag_set *tags);
/* Get a pointer to the original status from the creation of this tag set. */
-const census_tag_set_create_status *census_tag_set_get_create_status(
+CENSUS_API const census_tag_set_create_status *census_tag_set_get_create_status(
const census_tag_set *tags);
/* Structure used for tag set iteration. API clients should not use or
@@ -416,18 +418,19 @@ typedef struct {
/* Initialize a tag set iterator. Must be called before first use of the
iterator. */
-void census_tag_set_initialize_iterator(const census_tag_set *tags,
- census_tag_set_iterator *iterator);
+CENSUS_API void census_tag_set_initialize_iterator(
+ const census_tag_set *tags, census_tag_set_iterator *iterator);
/* Get the contents of the "next" tag in the tag set. If there are no more
tags in the tag set, returns 0 (and 'tag' contents will be unchanged),
otherwise returns 1. */
-int census_tag_set_next_tag(census_tag_set_iterator *iterator, census_tag *tag);
+CENSUS_API int census_tag_set_next_tag(census_tag_set_iterator *iterator,
+ census_tag *tag);
/* Get a tag by its key. Returns 0 if the key is not present in the tag
set. */
-int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key,
- census_tag *tag);
+CENSUS_API int census_tag_set_get_tag_by_key(const census_tag_set *tags,
+ const char *key, census_tag *tag);
/* Tag set encode/decode functionality. These functionas are intended
for use by RPC systems only, for purposes of transmitting/receiving tag
@@ -449,17 +452,19 @@ int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key,
[buffer, buffer + *print_buf_size) and binary tags into
[returned-ptr, returned-ptr + *bin_buf_size) (and the return value
should be buffer + *print_buf_size) */
-char *census_tag_set_encode(const census_tag_set *tags, char *buffer,
- size_t buf_size, size_t *print_buf_size,
- size_t *bin_buf_size);
+CENSUS_API char *census_tag_set_encode(const census_tag_set *tags, char *buffer,
+ size_t buf_size, size_t *print_buf_size,
+ size_t *bin_buf_size);
/* Decode tag set buffers encoded with census_tag_set_encode_*(). Returns NULL
if there is an error in parsing either buffer. */
-census_tag_set *census_tag_set_decode(const char *buffer, size_t size,
- const char *bin_buffer, size_t bin_size);
+CENSUS_API census_tag_set *census_tag_set_decode(const char *buffer,
+ size_t size,
+ const char *bin_buffer,
+ size_t bin_size);
/* Get a contexts tag set. */
-census_tag_set *census_context_tag_set(census_context *context);
+CENSUS_API census_tag_set *census_context_tag_set(census_context *context);
/* Core stats collection API's. The following concepts are used:
* Aggregation: A collection of values. Census supports the following
@@ -490,8 +495,8 @@ typedef struct {
} census_value;
/* Record new usage values against the given context. */
-void census_record_values(census_context *context, census_value *values,
- size_t nvalues);
+CENSUS_API void census_record_values(census_context *context,
+ census_value *values, size_t nvalues);
/** Type representing a particular aggregation */
typedef struct census_aggregation_ops census_aggregation_ops;
@@ -521,24 +526,25 @@ typedef struct census_view census_view;
@return A new census view
*/
-census_view *census_view_create(uint32_t metric_id, const census_tag_set *tags,
- const census_aggregation *aggregations,
- size_t naggregations);
+CENSUS_API census_view *census_view_create(
+ uint32_t metric_id, const census_tag_set *tags,
+ const census_aggregation *aggregations, size_t naggregations);
/** Destroy a previously created view. */
-void census_view_delete(census_view *view);
+CENSUS_API void census_view_delete(census_view *view);
/** Metric ID associated with a view */
-size_t census_view_metric(const census_view *view);
+CENSUS_API size_t census_view_metric(const census_view *view);
/** Number of aggregations associated with view. */
-size_t census_view_naggregations(const census_view *view);
+CENSUS_API size_t census_view_naggregations(const census_view *view);
/** Get tags associated with view. */
-const census_tag_set *census_view_tags(const census_view *view);
+CENSUS_API const census_tag_set *census_view_tags(const census_view *view);
/** Get aggregation descriptors associated with a view. */
-const census_aggregation *census_view_aggregrations(const census_view *view);
+CENSUS_API const census_aggregation *census_view_aggregrations(
+ const census_view *view);
/** Holds all the aggregation data for a particular view instantiation. Forms
part of the data returned by census_view_data(). */
@@ -557,10 +563,11 @@ typedef struct {
@param view View from which to get data.
@return Full set of data for all aggregations for the view.
*/
-const census_view_data *census_view_get_data(const census_view *view);
+CENSUS_API const census_view_data *census_view_get_data(
+ const census_view *view);
/** Reset all view data to zero for the specified view */
-void census_view_reset(census_view *view);
+CENSUS_API void census_view_reset(census_view *view);
#ifdef __cplusplus
}
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index f0652a3034..a2b65b0e8a 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -46,32 +46,33 @@ extern "C" {
/** Parses the first \a name_length bytes of \a name as a
* grpc_compression_algorithm instance, updating \a algorithm. Returns 1 upon
* success, 0 otherwise. */
-int grpc_compression_algorithm_parse(const char *name, size_t name_length,
- grpc_compression_algorithm *algorithm);
+GRPC_API int grpc_compression_algorithm_parse(
+ const char *name, size_t name_length,
+ grpc_compression_algorithm *algorithm);
/** Updates \a name with the encoding name corresponding to a valid \a
* algorithm. Returns 1 upon success, 0 otherwise. */
-int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
- char **name);
+GRPC_API int grpc_compression_algorithm_name(
+ grpc_compression_algorithm algorithm, char **name);
/** Returns the compression algorithm corresponding to \a level.
*
* It abort()s for unknown levels . */
-grpc_compression_algorithm grpc_compression_algorithm_for_level(
- grpc_compression_level level);
+GRPC_API grpc_compression_algorithm
+grpc_compression_algorithm_for_level(grpc_compression_level level);
-void grpc_compression_options_init(grpc_compression_options *opts);
+GRPC_API void grpc_compression_options_init(grpc_compression_options *opts);
/** Mark \a algorithm as enabled in \a opts. */
-void grpc_compression_options_enable_algorithm(
+GRPC_API void grpc_compression_options_enable_algorithm(
grpc_compression_options *opts, grpc_compression_algorithm algorithm);
/** Mark \a algorithm as disabled in \a opts. */
-void grpc_compression_options_disable_algorithm(
+GRPC_API void grpc_compression_options_disable_algorithm(
grpc_compression_options *opts, grpc_compression_algorithm algorithm);
/** Returns true if \a algorithm is marked as enabled in \a opts. */
-int grpc_compression_options_is_algorithm_enabled(
+GRPC_API int grpc_compression_options_is_algorithm_enabled(
const grpc_compression_options *opts, grpc_compression_algorithm algorithm);
#ifdef __cplusplus
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index 6ebf2a3f3c..ac4c536be3 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -55,11 +55,11 @@ extern "C" {
* functionality lives in grpc_security.h.
*/
-void grpc_metadata_array_init(grpc_metadata_array *array);
-void grpc_metadata_array_destroy(grpc_metadata_array *array);
+GRPC_API void grpc_metadata_array_init(grpc_metadata_array *array);
+GRPC_API void grpc_metadata_array_destroy(grpc_metadata_array *array);
-void grpc_call_details_init(grpc_call_details *details);
-void grpc_call_details_destroy(grpc_call_details *details);
+GRPC_API void grpc_call_details_init(grpc_call_details *details);
+GRPC_API void grpc_call_details_destroy(grpc_call_details *details);
/** Registers a plugin to be initialized and destroyed with the library.
@@ -69,7 +69,7 @@ void grpc_call_details_destroy(grpc_call_details *details);
(and hence so will \a init and \a destroy).
It is safe to pass NULL to either argument. Plugins are destroyed in
the reverse order they were initialized. */
-void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
+GRPC_API void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
/** Initialize the grpc library.
@@ -77,7 +77,7 @@ void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
(To avoid overhead, little checking is done, and some things may work. We
do not warrant that they will continue to do so in future revisions of this
library). */
-void grpc_init(void);
+GRPC_API void grpc_init(void);
/** Shut down the grpc library.
@@ -85,13 +85,13 @@ void grpc_init(void);
executing within the grpc library.
Prior to calling, all application owned grpc objects must have been
destroyed. */
-void grpc_shutdown(void);
+GRPC_API void grpc_shutdown(void);
/** Return a string representing the current version of grpc */
-const char *grpc_version_string(void);
+GRPC_API const char *grpc_version_string(void);
/** Create a completion queue */
-grpc_completion_queue *grpc_completion_queue_create(void *reserved);
+GRPC_API grpc_completion_queue *grpc_completion_queue_create(void *reserved);
/** Blocks until an event is available, the completion queue is being shut down,
or deadline is reached.
@@ -101,8 +101,9 @@ grpc_completion_queue *grpc_completion_queue_create(void *reserved);
Callers must not call grpc_completion_queue_next and
grpc_completion_queue_pluck simultaneously on the same completion queue. */
-grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
- gpr_timespec deadline, void *reserved);
+GRPC_API grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
+ gpr_timespec deadline,
+ void *reserved);
/** Blocks until an event with tag 'tag' is available, the completion queue is
being shutdown or deadline is reached.
@@ -115,8 +116,9 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cq,
Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
concurrently executing plucks at any time. */
-grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
- gpr_timespec deadline, void *reserved);
+GRPC_API grpc_event
+grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
+ gpr_timespec deadline, void *reserved);
/** Maximum number of outstanding grpc_completion_queue_pluck executions per
completion queue */
@@ -129,11 +131,11 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
After calling this function applications should ensure that no
NEW work is added to be published on this completion queue. */
-void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
+GRPC_API void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
/** Destroy a completion queue. The caller must ensure that the queue is
drained and no threads are executing grpc_completion_queue_next */
-void grpc_completion_queue_destroy(grpc_completion_queue *cq);
+GRPC_API void grpc_completion_queue_destroy(grpc_completion_queue *cq);
/** Create a completion queue alarm instance associated to \a cq.
*
@@ -141,26 +143,27 @@ void grpc_completion_queue_destroy(grpc_completion_queue *cq);
* grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the
* alarm expired, the event's success bit will be true, false otherwise (ie,
* upon cancellation). */
-grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, gpr_timespec deadline,
- void *tag);
+GRPC_API grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq,
+ gpr_timespec deadline, void *tag);
/** Cancel a completion queue alarm. Calling this function over an alarm that
* has already fired has no effect. */
-void grpc_alarm_cancel(grpc_alarm *alarm);
+GRPC_API void grpc_alarm_cancel(grpc_alarm *alarm);
/** Destroy the given completion queue alarm, cancelling it in the process. */
-void grpc_alarm_destroy(grpc_alarm *alarm);
+GRPC_API void grpc_alarm_destroy(grpc_alarm *alarm);
/** Check the connectivity state of a channel. */
-grpc_connectivity_state grpc_channel_check_connectivity_state(
- grpc_channel *channel, int try_to_connect);
+GRPC_API grpc_connectivity_state
+grpc_channel_check_connectivity_state(grpc_channel *channel,
+ int try_to_connect);
/** Watch for a change in connectivity state.
Once the channel connectivity state is different from last_observed_state,
tag will be enqueued on cq with success=1.
If deadline expires BEFORE the state is changed, tag will be enqueued on cq
with success=0. */
-void grpc_channel_watch_connectivity_state(
+GRPC_API void grpc_channel_watch_connectivity_state(
grpc_channel *channel, grpc_connectivity_state last_observed_state,
gpr_timespec deadline, grpc_completion_queue *cq, void *tag);
@@ -170,24 +173,24 @@ void grpc_channel_watch_connectivity_state(
If parent_call is non-NULL, it must be a server-side call. It will be used
to propagate properties from the server call to this new client call.
*/
-grpc_call *grpc_channel_create_call(grpc_channel *channel,
- grpc_call *parent_call,
- uint32_t propagation_mask,
- grpc_completion_queue *completion_queue,
- const char *method, const char *host,
- gpr_timespec deadline, void *reserved);
+GRPC_API grpc_call *grpc_channel_create_call(
+ grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask,
+ grpc_completion_queue *completion_queue, const char *method,
+ const char *host, gpr_timespec deadline, void *reserved);
/** Ping the channels peer (load balanced channels will select one sub-channel
to ping); if the channel is not connected, posts a failed. */
-void grpc_channel_ping(grpc_channel *channel, grpc_completion_queue *cq,
- void *tag, void *reserved);
+GRPC_API void grpc_channel_ping(grpc_channel *channel,
+ grpc_completion_queue *cq, void *tag,
+ void *reserved);
/** Pre-register a method/host pair on a channel. */
-void *grpc_channel_register_call(grpc_channel *channel, const char *method,
- const char *host, void *reserved);
+GRPC_API void *grpc_channel_register_call(grpc_channel *channel,
+ const char *method, const char *host,
+ void *reserved);
/** Create a call given a handle returned from grpc_channel_register_call */
-grpc_call *grpc_channel_create_registered_call(
+GRPC_API grpc_call *grpc_channel_create_registered_call(
grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask,
grpc_completion_queue *completion_queue, void *registered_call_handle,
gpr_timespec deadline, void *reserved);
@@ -203,8 +206,9 @@ grpc_call *grpc_channel_create_registered_call(
needs to be synchronized. As an optimization, you may synchronize batches
containing just send operations independently from batches containing just
receive operations. */
-grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
- size_t nops, void *tag, void *reserved);
+GRPC_API grpc_call_error grpc_call_start_batch(grpc_call *call,
+ const grpc_op *ops, size_t nops,
+ void *tag, void *reserved);
/** Returns a newly allocated string representing the endpoint to which this
call is communicating with. The string is in the uri format accepted by
@@ -214,38 +218,36 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
WARNING: this value is never authenticated or subject to any security
related code. It must not be used for any authentication related
functionality. Instead, use grpc_auth_context. */
-char *grpc_call_get_peer(grpc_call *call);
+GRPC_API char *grpc_call_get_peer(grpc_call *call);
struct census_context;
/* Set census context for a call; Must be called before first call to
grpc_call_start_batch(). */
-void grpc_census_call_set_context(grpc_call *call,
- struct census_context *context);
+GRPC_API void grpc_census_call_set_context(grpc_call *call,
+ struct census_context *context);
/* Retrieve the calls current census context. */
-struct census_context *grpc_census_call_get_context(grpc_call *call);
+GRPC_API struct census_context *grpc_census_call_get_context(grpc_call *call);
/** Return a newly allocated string representing the target a channel was
created for. */
-char *grpc_channel_get_target(grpc_channel *channel);
+GRPC_API char *grpc_channel_get_target(grpc_channel *channel);
/** Create a client channel to 'target'. Additional channel level configuration
MAY be provided by grpc_channel_args, though the expectation is that most
clients will want to simply pass NULL. See grpc_channel_args definition for
more on this. The data in 'args' need only live through the invocation of
this function. */
-grpc_channel *grpc_insecure_channel_create(const char *target,
- const grpc_channel_args *args,
- void *reserved);
+GRPC_API grpc_channel *grpc_insecure_channel_create(
+ const char *target, const grpc_channel_args *args, void *reserved);
/** Create a lame client: this client fails every operation attempted on it. */
-grpc_channel *grpc_lame_client_channel_create(const char *target,
- grpc_status_code error_code,
- const char *error_message);
+GRPC_API grpc_channel *grpc_lame_client_channel_create(
+ const char *target, grpc_status_code error_code, const char *error_message);
/** Close and destroy a grpc channel */
-void grpc_channel_destroy(grpc_channel *channel);
+GRPC_API void grpc_channel_destroy(grpc_channel *channel);
/* Error handling for grpc_call
Most grpc_call functions return a grpc_error. If the error is not GRPC_OK
@@ -258,7 +260,7 @@ void grpc_channel_destroy(grpc_channel *channel);
THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
are thread-safe, and can be called at any point before grpc_call_destroy
is called.*/
-grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved);
+GRPC_API grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved);
/** Called by clients to cancel an RPC on the server.
Can be called multiple times, from any thread.
@@ -266,14 +268,13 @@ grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved);
and description passed in.
Importantly, this function does not send status nor description to the
remote endpoint. */
-grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
- grpc_status_code status,
- const char *description,
- void *reserved);
+GRPC_API grpc_call_error
+grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status,
+ const char *description, void *reserved);
/** Destroy a call.
THREAD SAFETY: grpc_call_destroy is thread-compatible */
-void grpc_call_destroy(grpc_call *call);
+GRPC_API void grpc_call_destroy(grpc_call *call);
/** Request notification of a new call.
Once a call is received, a notification tagged with \a tag_new is added to
@@ -283,11 +284,13 @@ void grpc_call_destroy(grpc_call *call);
to \a cq_bound_to_call.
Note that \a cq_for_notification must have been registered to the server via
\a grpc_server_register_completion_queue. */
-grpc_call_error grpc_server_request_call(
- grpc_server *server, grpc_call **call, grpc_call_details *details,
- grpc_metadata_array *request_metadata,
- grpc_completion_queue *cq_bound_to_call,
- grpc_completion_queue *cq_for_notification, void *tag_new);
+GRPC_API grpc_call_error
+grpc_server_request_call(grpc_server *server, grpc_call **call,
+ grpc_call_details *details,
+ grpc_metadata_array *request_metadata,
+ grpc_completion_queue *cq_bound_to_call,
+ grpc_completion_queue *cq_for_notification,
+ void *tag_new);
/** Registers a method in the server.
Methods to this (host, method) pair will not be reported by
@@ -296,13 +299,14 @@ grpc_call_error grpc_server_request_call(
registered_method (as returned by this function).
Must be called before grpc_server_start.
Returns NULL on failure. */
-void *grpc_server_register_method(grpc_server *server, const char *method,
- const char *host);
+GRPC_API void *grpc_server_register_method(grpc_server *server,
+ const char *method,
+ const char *host);
/** Request notification of a new pre-registered call. 'cq_for_notification'
must have been registered to the server via
grpc_server_register_completion_queue. */
-grpc_call_error grpc_server_request_registered_call(
+GRPC_API grpc_call_error grpc_server_request_registered_call(
grpc_server *server, void *registered_method, grpc_call **call,
gpr_timespec *deadline, grpc_metadata_array *request_metadata,
grpc_byte_buffer **optional_payload,
@@ -313,23 +317,25 @@ grpc_call_error grpc_server_request_registered_call(
be specified with args. If no additional configuration is needed, args can
be NULL. See grpc_channel_args for more. The data in 'args' need only live
through the invocation of this function. */
-grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved);
+GRPC_API grpc_server *grpc_server_create(const grpc_channel_args *args,
+ void *reserved);
/** Register a completion queue with the server. Must be done for any
notification completion queue that is passed to grpc_server_request_*_call
and to grpc_server_shutdown_and_notify. Must be performed prior to
grpc_server_start. */
-void grpc_server_register_completion_queue(grpc_server *server,
- grpc_completion_queue *cq,
- void *reserved);
+GRPC_API void grpc_server_register_completion_queue(grpc_server *server,
+ grpc_completion_queue *cq,
+ void *reserved);
/** Add a HTTP2 over plaintext over tcp listener.
Returns bound port number on success, 0 on failure.
REQUIRES: server not started */
-int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr);
+GRPC_API int grpc_server_add_insecure_http2_port(grpc_server *server,
+ const char *addr);
/** Start a server - tells all listeners to start listening */
-void grpc_server_start(grpc_server *server);
+GRPC_API void grpc_server_start(grpc_server *server);
/** Begin shutting down a server.
After completion, no new calls or connections will be admitted.
@@ -338,18 +344,19 @@ void grpc_server_start(grpc_server *server);
Shutdown is idempotent, and all tags will be notified at once if multiple
grpc_server_shutdown_and_notify calls are made. 'cq' must have been
registered to this server via grpc_server_register_completion_queue. */
-void grpc_server_shutdown_and_notify(grpc_server *server,
- grpc_completion_queue *cq, void *tag);
+GRPC_API void grpc_server_shutdown_and_notify(grpc_server *server,
+ grpc_completion_queue *cq,
+ void *tag);
/** Cancel all in-progress calls.
Only usable after shutdown. */
-void grpc_server_cancel_all_calls(grpc_server *server);
+GRPC_API void grpc_server_cancel_all_calls(grpc_server *server);
/** Destroy a server.
Shutdown must have completed beforehand (i.e. all tags generated by
grpc_server_shutdown_and_notify must have been received, and at least
one call to grpc_server_shutdown_and_notify must have been made). */
-void grpc_server_destroy(grpc_server *server);
+GRPC_API void grpc_server_destroy(grpc_server *server);
/** Enable or disable a tracer.
@@ -359,17 +366,18 @@ void grpc_server_destroy(grpc_server *server);
Use of this function is not strictly thread-safe, but the
thread-safety issues raised by it should not be of concern. */
-int grpc_tracer_set_enabled(const char *name, int enabled);
+GRPC_API int grpc_tracer_set_enabled(const char *name, int enabled);
/** Check whether a metadata key is legal (will be accepted by core) */
-int grpc_header_key_is_legal(const char *key, size_t length);
+GRPC_API int grpc_header_key_is_legal(const char *key, size_t length);
/** Check whether a non-binary metadata value is legal (will be accepted by
core) */
-int grpc_header_nonbin_value_is_legal(const char *value, size_t length);
+GRPC_API int grpc_header_nonbin_value_is_legal(const char *value,
+ size_t length);
/** Check whether a metadata key corresponds to a binary value */
-int grpc_is_binary_header(const char *key, size_t length);
+GRPC_API int grpc_is_binary_header(const char *key, size_t length);
#ifdef __cplusplus
}
diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h
index 655f45a29b..b50c58ce1e 100644
--- a/include/grpc/grpc_security.h
+++ b/include/grpc/grpc_security.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,37 +65,39 @@ typedef struct grpc_auth_property {
} grpc_auth_property;
/* Returns NULL when the iterator is at the end. */
-const grpc_auth_property *grpc_auth_property_iterator_next(
+GRPC_API const grpc_auth_property *grpc_auth_property_iterator_next(
grpc_auth_property_iterator *it);
/* Iterates over the auth context. */
-grpc_auth_property_iterator grpc_auth_context_property_iterator(
- const grpc_auth_context *ctx);
+GRPC_API grpc_auth_property_iterator
+grpc_auth_context_property_iterator(const grpc_auth_context *ctx);
/* Gets the peer identity. Returns an empty iterator (first _next will return
NULL) if the peer is not authenticated. */
-grpc_auth_property_iterator grpc_auth_context_peer_identity(
- const grpc_auth_context *ctx);
+GRPC_API grpc_auth_property_iterator
+grpc_auth_context_peer_identity(const grpc_auth_context *ctx);
/* Finds a property in the context. May return an empty iterator (first _next
will return NULL) if no property with this name was found in the context. */
-grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(
- const grpc_auth_context *ctx, const char *name);
+GRPC_API grpc_auth_property_iterator
+grpc_auth_context_find_properties_by_name(const grpc_auth_context *ctx,
+ const char *name);
/* Gets the name of the property that indicates the peer identity. Will return
NULL if the peer is not authenticated. */
-const char *grpc_auth_context_peer_identity_property_name(
+GRPC_API const char *grpc_auth_context_peer_identity_property_name(
const grpc_auth_context *ctx);
/* Returns 1 if the peer is authenticated, 0 otherwise. */
-int grpc_auth_context_peer_is_authenticated(const grpc_auth_context *ctx);
+GRPC_API int grpc_auth_context_peer_is_authenticated(
+ const grpc_auth_context *ctx);
/* Gets the auth context from the call. Caller needs to call
grpc_auth_context_release on the returned context. */
-grpc_auth_context *grpc_call_auth_context(grpc_call *call);
+GRPC_API grpc_auth_context *grpc_call_auth_context(grpc_call *call);
/* Releases the auth context returned from grpc_call_auth_context. */
-void grpc_auth_context_release(grpc_auth_context *context);
+GRPC_API void grpc_auth_context_release(grpc_auth_context *context);
/* --
The following auth context methods should only be called by a server metadata
@@ -103,18 +105,20 @@ void grpc_auth_context_release(grpc_auth_context *context);
-- */
/* Add a property. */
-void grpc_auth_context_add_property(grpc_auth_context *ctx, const char *name,
- const char *value, size_t value_length);
+GRPC_API void grpc_auth_context_add_property(grpc_auth_context *ctx,
+ const char *name,
+ const char *value,
+ size_t value_length);
/* Add a C string property. */
-void grpc_auth_context_add_cstring_property(grpc_auth_context *ctx,
- const char *name,
- const char *value);
+GRPC_API void grpc_auth_context_add_cstring_property(grpc_auth_context *ctx,
+ const char *name,
+ const char *value);
/* Sets the property name. Returns 1 if successful or 0 in case of failure
(which means that no property with this name exists). */
-int grpc_auth_context_set_peer_identity_property_name(grpc_auth_context *ctx,
- const char *name);
+GRPC_API int grpc_auth_context_set_peer_identity_property_name(
+ grpc_auth_context *ctx, const char *name);
/* --- grpc_channel_credentials object. ---
@@ -125,7 +129,7 @@ typedef struct grpc_channel_credentials grpc_channel_credentials;
/* Releases a channel credentials object.
The creator of the credentials object is responsible for its release. */
-void grpc_channel_credentials_release(grpc_channel_credentials *creds);
+GRPC_API void grpc_channel_credentials_release(grpc_channel_credentials *creds);
/* Environment variable that points to the google default application
credentials json key or refresh token. Used in the
@@ -135,7 +139,7 @@ void grpc_channel_credentials_release(grpc_channel_credentials *creds);
/* Creates default credentials to connect to a google gRPC service.
WARNING: Do NOT use this credentials to connect to a non-google service as
this could result in an oauth2 token leak. */
-grpc_channel_credentials *grpc_google_default_credentials_create(void);
+GRPC_API grpc_channel_credentials *grpc_google_default_credentials_create(void);
/* Environment variable that points to the default SSL roots file. This file
must be a PEM encoded file with all the roots such as the one that can be
@@ -164,7 +168,7 @@ typedef struct {
- pem_key_cert_pair is a pointer on the object containing client's private
key and certificate chain. This parameter can be NULL if the client does
not have such a key/cert pair. */
-grpc_channel_credentials *grpc_ssl_credentials_create(
+GRPC_API grpc_channel_credentials *grpc_ssl_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
void *reserved);
@@ -178,22 +182,22 @@ typedef struct grpc_call_credentials grpc_call_credentials;
/* Releases a call credentials object.
The creator of the credentials object is responsible for its release. */
-void grpc_call_credentials_release(grpc_call_credentials *creds);
+GRPC_API void grpc_call_credentials_release(grpc_call_credentials *creds);
/* Creates a composite channel credentials object. */
-grpc_channel_credentials *grpc_composite_channel_credentials_create(
+GRPC_API grpc_channel_credentials *grpc_composite_channel_credentials_create(
grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds,
void *reserved);
/* Creates a composite call credentials object. */
-grpc_call_credentials *grpc_composite_call_credentials_create(
+GRPC_API grpc_call_credentials *grpc_composite_call_credentials_create(
grpc_call_credentials *creds1, grpc_call_credentials *creds2,
void *reserved);
/* Creates a compute engine credentials object for connecting to Google.
WARNING: Do NOT use this credentials to connect to a non-google service as
this could result in an oauth2 token leak. */
-grpc_call_credentials *grpc_google_compute_engine_credentials_create(
+GRPC_API grpc_call_credentials *grpc_google_compute_engine_credentials_create(
void *reserved);
extern const gpr_timespec grpc_max_auth_token_lifetime;
@@ -203,8 +207,10 @@ extern const gpr_timespec grpc_max_auth_token_lifetime;
- token_lifetime is the lifetime of each Json Web Token (JWT) created with
this credentials. It should not exceed grpc_max_auth_token_lifetime or
will be cropped to this value. */
-grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
- const char *json_key, gpr_timespec token_lifetime, void *reserved);
+GRPC_API grpc_call_credentials *
+grpc_service_account_jwt_access_credentials_create(const char *json_key,
+ gpr_timespec token_lifetime,
+ void *reserved);
/* Creates an Oauth2 Refresh Token credentials object for connecting to Google.
May return NULL if the input is invalid.
@@ -212,16 +218,16 @@ grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
this could result in an oauth2 token leak.
- json_refresh_token is the JSON string containing the refresh token itself
along with a client_id and client_secret. */
-grpc_call_credentials *grpc_google_refresh_token_credentials_create(
+GRPC_API grpc_call_credentials *grpc_google_refresh_token_credentials_create(
const char *json_refresh_token, void *reserved);
/* Creates an Oauth2 Access Token credentials with an access token that was
aquired by an out of band mechanism. */
-grpc_call_credentials *grpc_access_token_credentials_create(
+GRPC_API grpc_call_credentials *grpc_access_token_credentials_create(
const char *access_token, void *reserved);
/* Creates an IAM credentials object for connecting to Google. */
-grpc_call_credentials *grpc_google_iam_credentials_create(
+GRPC_API grpc_call_credentials *grpc_google_iam_credentials_create(
const char *authorization_token, const char *authority_selector,
void *reserved);
@@ -283,16 +289,15 @@ typedef struct {
} grpc_metadata_credentials_plugin;
/* Creates a credentials object from a plugin. */
-grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
+GRPC_API grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin, void *reserved);
/* --- Secure channel creation. --- */
/* Creates a secure channel using the passed-in credentials. */
-grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
- const char *target,
- const grpc_channel_args *args,
- void *reserved);
+GRPC_API grpc_channel *grpc_secure_channel_create(
+ grpc_channel_credentials *creds, const char *target,
+ const grpc_channel_args *args, void *reserved);
/* --- grpc_server_credentials object. ---
@@ -303,7 +308,7 @@ typedef struct grpc_server_credentials grpc_server_credentials;
/* Releases a server_credentials object.
The creator of the server_credentials object is responsible for its release.
*/
-void grpc_server_credentials_release(grpc_server_credentials *creds);
+GRPC_API void grpc_server_credentials_release(grpc_server_credentials *creds);
/* Creates an SSL server_credentials object.
- pem_roots_cert is the NULL-terminated string containing the PEM encoding of
@@ -316,7 +321,7 @@ void grpc_server_credentials_release(grpc_server_credentials *creds);
- force_client_auth, if set to non-zero will force the client to authenticate
with an SSL cert. Note that this option is ignored if pem_root_certs is
NULL. */
-grpc_server_credentials *grpc_ssl_server_credentials_create(
+GRPC_API grpc_server_credentials *grpc_ssl_server_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth, void *reserved);
@@ -325,15 +330,16 @@ grpc_server_credentials *grpc_ssl_server_credentials_create(
/* Add a HTTP2 over an encrypted link over tcp listener.
Returns bound port number on success, 0 on failure.
REQUIRES: server not started */
-int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
- grpc_server_credentials *creds);
+GRPC_API int grpc_server_add_secure_http2_port(grpc_server *server,
+ const char *addr,
+ grpc_server_credentials *creds);
/* --- Call specific credentials. --- */
/* Sets a credentials to a call. Can only be called on the client side before
grpc_call_start_batch. */
-grpc_call_error grpc_call_set_credentials(grpc_call *call,
- grpc_call_credentials *creds);
+GRPC_API grpc_call_error
+grpc_call_set_credentials(grpc_call *call, grpc_call_credentials *creds);
/* --- Auth Metadata Processing --- */
@@ -364,7 +370,7 @@ typedef struct {
void *state;
} grpc_auth_metadata_processor;
-void grpc_server_credentials_set_auth_metadata_processor(
+GRPC_API void grpc_server_credentials_set_auth_metadata_processor(
grpc_server_credentials *creds, grpc_auth_metadata_processor processor);
#ifdef __cplusplus
diff --git a/include/grpc/grpc_zookeeper.h b/include/grpc/grpc_zookeeper.h
index 2b195c18bf..f6a5246d3a 100644
--- a/include/grpc/grpc_zookeeper.h
+++ b/include/grpc/grpc_zookeeper.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,7 @@ extern "C" {
#endif
/** Register zookeeper name resolver in grpc */
-void grpc_zookeeper_register();
+GRPC_API void grpc_zookeeper_register();
#ifdef __cplusplus
}
diff --git a/include/grpc/impl/codegen/alloc.h b/include/grpc/impl/codegen/alloc.h
index 6c3cc78730..dc7ba78846 100644
--- a/include/grpc/impl/codegen/alloc.h
+++ b/include/grpc/impl/codegen/alloc.h
@@ -36,6 +36,8 @@
#include <stddef.h>
+#include <grpc/impl/codegen/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -47,23 +49,23 @@ typedef struct gpr_allocation_functions {
} gpr_allocation_functions;
/* malloc, never returns NULL */
-void *gpr_malloc(size_t size);
+GPR_API void *gpr_malloc(size_t size);
/* free */
-void gpr_free(void *ptr);
+GPR_API void gpr_free(void *ptr);
/* realloc, never returns NULL */
-void *gpr_realloc(void *p, size_t size);
+GPR_API void *gpr_realloc(void *p, size_t size);
/* aligned malloc, never returns NULL, will align to 1 << alignment_log */
-void *gpr_malloc_aligned(size_t size, size_t alignment_log);
+GPR_API void *gpr_malloc_aligned(size_t size, size_t alignment_log);
/* free memory allocated by gpr_malloc_aligned */
-void gpr_free_aligned(void *ptr);
+GPR_API void gpr_free_aligned(void *ptr);
/** Request the family of allocation functions in \a functions be used. NOTE
* that this request will be honored in a *best effort* basis and that no
* guarantees are made about the default functions (eg, malloc) being called. */
-void gpr_set_allocation_functions(gpr_allocation_functions functions);
+GPR_API void gpr_set_allocation_functions(gpr_allocation_functions functions);
/** Return the family of allocation functions currently in effect. */
-gpr_allocation_functions gpr_get_allocation_functions();
+GPR_API gpr_allocation_functions gpr_get_allocation_functions();
#ifdef __cplusplus
}
diff --git a/include/grpc/impl/codegen/byte_buffer.h b/include/grpc/impl/codegen/byte_buffer.h
index d94c9d5d53..5049461f73 100644
--- a/include/grpc/impl/codegen/byte_buffer.h
+++ b/include/grpc/impl/codegen/byte_buffer.h
@@ -65,8 +65,8 @@ typedef struct grpc_byte_buffer grpc_byte_buffer;
*
* Increases the reference count for all \a slices processed. The user is
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
-grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
- size_t nslices);
+GRPC_API grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
+ size_t nslices);
/** Returns a *compressed* RAW byte buffer instance over the given slices (up to
* \a nslices). The \a compression argument defines the compression algorithm
@@ -74,43 +74,44 @@ grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
*
* Increases the reference count for all \a slices processed. The user is
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
-grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
+GRPC_API grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression);
/** Copies input byte buffer \a bb.
*
* Increases the reference count of all the source slices. The user is
* responsible for calling grpc_byte_buffer_destroy over the returned copy. */
-grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
+GRPC_API grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
/** Returns the size of the given byte buffer, in bytes. */
-size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
+GRPC_API size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
/** Destroys \a byte_buffer deallocating all its memory. */
-void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
+GRPC_API void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
/** Reader for byte buffers. Iterates over slices in the byte buffer */
struct grpc_byte_buffer_reader;
typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader;
/** Initialize \a reader to read over \a buffer */
-void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
- grpc_byte_buffer *buffer);
+GRPC_API void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
+ grpc_byte_buffer *buffer);
/** Cleanup and destroy \a reader */
-void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
+GRPC_API void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
/** Updates \a slice with the next piece of data from from \a reader and returns
* 1. Returns 0 at the end of the stream. Caller is responsible for calling
* gpr_slice_unref on the result. */
-int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
- gpr_slice *slice);
+GRPC_API int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
+ gpr_slice *slice);
/** Merge all data from \a reader into single slice */
-gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
+GRPC_API gpr_slice
+grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
/** Returns a RAW byte buffer instance from the output of \a reader. */
-grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
+GRPC_API grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
grpc_byte_buffer_reader *reader);
#ifdef __cplusplus
diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h
index 8445e70a89..5df91c6509 100644
--- a/include/grpc/impl/codegen/log.h
+++ b/include/grpc/impl/codegen/log.h
@@ -37,6 +37,8 @@
#include <stdlib.h> /* for abort() */
#include <stdarg.h>
+#include <grpc/impl/codegen/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -69,11 +71,11 @@ const char *gpr_log_severity_string(gpr_log_severity severity);
/* Log a message. It's advised to use GPR_xxx above to generate the context
* for each message */
-void gpr_log(const char *file, int line, gpr_log_severity severity,
- const char *format, ...);
+GPR_API void gpr_log(const char *file, int line, gpr_log_severity severity,
+ const char *format, ...);
-void gpr_log_message(const char *file, int line, gpr_log_severity severity,
- const char *message);
+GPR_API void gpr_log_message(const char *file, int line,
+ gpr_log_severity severity, const char *message);
/* Log overrides: applications can use this API to intercept logging calls
and use their own implementations */
@@ -86,7 +88,7 @@ typedef struct {
} gpr_log_func_args;
typedef void (*gpr_log_func)(gpr_log_func_args *args);
-void gpr_set_log_function(gpr_log_func func);
+GPR_API void gpr_set_log_function(gpr_log_func func);
/* abort() the process if x is zero, having written a line to the log.
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
index b5a708e7f2..7333405db3 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
@@ -337,4 +337,16 @@
} while (0)
#endif /* GPR_FORBID_UNREACHABLE_CODE */
+#ifndef GPR_API
+#define GPR_API
+#endif
+
+#ifndef GRPC_API
+#define GRPC_API GPR_API
+#endif
+
+#ifndef CENSUS_API
+#define CENSUS_API GRPC_API
+#endif
+
#endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h
index 82cd27b73d..d60a40ca35 100644
--- a/include/grpc/impl/codegen/slice.h
+++ b/include/grpc/impl/codegen/slice.h
@@ -105,7 +105,7 @@ typedef struct gpr_slice {
/* Increment the refcount of s. Requires slice is initialized.
Returns s. */
-gpr_slice gpr_slice_ref(gpr_slice s);
+GPR_API gpr_slice gpr_slice_ref(gpr_slice s);
/* Decrement the ref count of s. If the ref count of s reaches zero, all
slices sharing the ref count are destroyed, and considered no longer
@@ -113,22 +113,22 @@ gpr_slice gpr_slice_ref(gpr_slice s);
len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
ultimately derived from a call to gpr_slice_new_with_len(start, len, dest)
where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
-void gpr_slice_unref(gpr_slice s);
+GPR_API void gpr_slice_unref(gpr_slice s);
/* Create a slice pointing at some data. Calls malloc to allocate a refcount
for the object, and arranges that destroy will be called with the pointer
passed in at destruction. */
-gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *));
+GPR_API gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *));
/* Equivalent to gpr_slice_new, but with a two argument destroy function that
also takes the slice length. */
-gpr_slice gpr_slice_new_with_len(void *p, size_t len,
- void (*destroy)(void *, size_t));
+GPR_API gpr_slice
+gpr_slice_new_with_len(void *p, size_t len, void (*destroy)(void *, size_t));
/* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc()
call.
Aborts if malloc() fails. */
-gpr_slice gpr_slice_malloc(size_t length);
+GPR_API gpr_slice gpr_slice_malloc(size_t length);
/* Create a slice by copying a string.
Does not preserve null terminators.
@@ -136,44 +136,44 @@ gpr_slice gpr_slice_malloc(size_t length);
size_t len = strlen(source);
gpr_slice slice = gpr_slice_malloc(len);
memcpy(slice->data, source, len); */
-gpr_slice gpr_slice_from_copied_string(const char *source);
+GPR_API gpr_slice gpr_slice_from_copied_string(const char *source);
/* Create a slice by copying a buffer.
Equivalent to:
gpr_slice slice = gpr_slice_malloc(len);
memcpy(slice->data, source, len); */
-gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len);
+GPR_API gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len);
/* Create a slice pointing to constant memory */
-gpr_slice gpr_slice_from_static_string(const char *source);
+GPR_API gpr_slice gpr_slice_from_static_string(const char *source);
/* Return a result slice derived from s, which shares a ref count with s, where
result.data==s.data+begin, and result.length==end-begin.
The ref count of s is increased by one.
Requires s initialized, begin <= end, begin <= s.length, and
end <= source->length. */
-gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end);
+GPR_API gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end);
/* The same as gpr_slice_sub, but without altering the ref count */
-gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end);
+GPR_API gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end);
/* Splits s into two: modifies s to be s[0:split], and returns a new slice,
sharing a refcount with s, that contains s[split:s.length].
Requires s intialized, split <= s.length */
-gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
+GPR_API gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
/* Splits s into two: modifies s to be s[split:s.length], and returns a new
slice, sharing a refcount with s, that contains s[0:split].
Requires s intialized, split <= s.length */
-gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
+GPR_API gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
-gpr_slice gpr_empty_slice(void);
+GPR_API gpr_slice gpr_empty_slice(void);
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
The order is arbitrary, and is not guaranteed to be stable across different
versions of the API. */
-int gpr_slice_cmp(gpr_slice a, gpr_slice b);
-int gpr_slice_str_cmp(gpr_slice a, const char *b);
+GPR_API int gpr_slice_cmp(gpr_slice a, gpr_slice b);
+GPR_API int gpr_slice_str_cmp(gpr_slice a, const char *b);
#ifdef __cplusplus
}
diff --git a/include/grpc/impl/codegen/slice_buffer.h b/include/grpc/impl/codegen/slice_buffer.h
index ca6f91d0b8..8428c2f539 100644
--- a/include/grpc/impl/codegen/slice_buffer.h
+++ b/include/grpc/impl/codegen/slice_buffer.h
@@ -59,13 +59,13 @@ typedef struct {
} gpr_slice_buffer;
/* initialize a slice buffer */
-void gpr_slice_buffer_init(gpr_slice_buffer *sb);
+GPR_API void gpr_slice_buffer_init(gpr_slice_buffer *sb);
/* destroy a slice buffer - unrefs any held elements */
-void gpr_slice_buffer_destroy(gpr_slice_buffer *sb);
+GPR_API void gpr_slice_buffer_destroy(gpr_slice_buffer *sb);
/* Add an element to a slice buffer - takes ownership of the slice.
This function is allowed to concatenate the passed in slice to the end of
some other slice if desired by the slice buffer. */
-void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
+GPR_API void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
/* add an element to a slice buffer - takes ownership of the slice and returns
the index of the slice.
Guarantees that the slice will not be concatenated at the end of another
@@ -73,27 +73,30 @@ void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
slice at the returned index in sb->slices)
The implementation MAY decide to concatenate data at the end of a small
slice added in this fashion. */
-size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, gpr_slice slice);
-void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices, size_t n);
+GPR_API size_t
+gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, gpr_slice slice);
+GPR_API void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices,
+ size_t n);
/* add a very small (less than 8 bytes) amount of data to the end of a slice
buffer: returns a pointer into which to add the data */
-uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len);
+GPR_API uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len);
/* pop the last buffer, but don't unref it */
-void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
+GPR_API void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
/* clear a slice buffer, unref all elements */
-void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
+GPR_API void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
/* swap the contents of two slice buffers */
-void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b);
+GPR_API void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b);
/* move all of the elements of src into dst */
-void gpr_slice_buffer_move_into(gpr_slice_buffer *src, gpr_slice_buffer *dst);
+GPR_API void gpr_slice_buffer_move_into(gpr_slice_buffer *src,
+ gpr_slice_buffer *dst);
/* remove n bytes from the end of a slice buffer */
-void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n,
- gpr_slice_buffer *garbage);
+GPR_API void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n,
+ gpr_slice_buffer *garbage);
/* move the first n bytes of src into dst */
-void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
- gpr_slice_buffer *dst);
+GPR_API void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
+ gpr_slice_buffer *dst);
/* take the first slice in the slice buffer */
-gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src);
+GPR_API gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src);
#ifdef __cplusplus
}
diff --git a/include/grpc/impl/codegen/sync.h b/include/grpc/impl/codegen/sync.h
index 052e39d8a0..7086b5d371 100644
--- a/include/grpc/impl/codegen/sync.h
+++ b/include/grpc/impl/codegen/sync.h
@@ -78,26 +78,26 @@ extern "C" {
gpr_mu are uninitialized when first declared. */
/* Initialize *mu. Requires: *mu uninitialized. */
-void gpr_mu_init(gpr_mu *mu);
+GPR_API void gpr_mu_init(gpr_mu *mu);
/* Cause *mu no longer to be initialized, freeing any memory in use. Requires:
*mu initialized; no other concurrent operation on *mu. */
-void gpr_mu_destroy(gpr_mu *mu);
+GPR_API void gpr_mu_destroy(gpr_mu *mu);
/* Wait until no thread has a lock on *mu, cause the calling thread to own an
exclusive lock on *mu, then return. May block indefinitely or crash if the
calling thread has a lock on *mu. Requires: *mu initialized. */
-void gpr_mu_lock(gpr_mu *mu);
+GPR_API void gpr_mu_lock(gpr_mu *mu);
/* Release an exclusive lock on *mu held by the calling thread. Requires: *mu
initialized; the calling thread holds an exclusive lock on *mu. */
-void gpr_mu_unlock(gpr_mu *mu);
+GPR_API void gpr_mu_unlock(gpr_mu *mu);
/* Without blocking, attempt to acquire an exclusive lock on *mu for the
calling thread, then return non-zero iff success. Fail, if any thread holds
the lock; succeeds with high probability if no thread holds the lock.
Requires: *mu initialized. */
-int gpr_mu_trylock(gpr_mu *mu);
+GPR_API int gpr_mu_trylock(gpr_mu *mu);
/* --- Condition variable interface ---
@@ -106,11 +106,11 @@ int gpr_mu_trylock(gpr_mu *mu);
uninitialized when first declared. */
/* Initialize *cv. Requires: *cv uninitialized. */
-void gpr_cv_init(gpr_cv *cv);
+GPR_API void gpr_cv_init(gpr_cv *cv);
/* Cause *cv no longer to be initialized, freeing any memory in use. Requires:
*cv initialized; no other concurrent operation on *cv.*/
-void gpr_cv_destroy(gpr_cv *cv);
+GPR_API void gpr_cv_destroy(gpr_cv *cv);
/* Atomically release *mu and wait on *cv. When the calling thread is woken
from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
@@ -118,16 +118,16 @@ void gpr_cv_destroy(gpr_cv *cv);
abs_deadline==gpr_inf_future for no deadline. May return even when not
woken explicitly. Requires: *mu and *cv initialized; the calling thread
holds an exclusive lock on *mu. */
-int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline);
+GPR_API int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline);
/* If any threads are waiting on *cv, wake at least one.
Clients may treat this as an optimization of gpr_cv_broadcast()
for use in the case where waking more than one waiter is not useful.
Requires: *cv initialized. */
-void gpr_cv_signal(gpr_cv *cv);
+GPR_API void gpr_cv_signal(gpr_cv *cv);
/* Wake all threads waiting on *cv. Requires: *cv initialized. */
-void gpr_cv_broadcast(gpr_cv *cv);
+GPR_API void gpr_cv_broadcast(gpr_cv *cv);
/* --- One-time initialization ---
@@ -140,7 +140,7 @@ void gpr_cv_broadcast(gpr_cv *cv);
If multiple threads call gpr_once() on the same gpr_once instance, one of
them will call (*init_routine)(), and the others will block until that call
finishes.*/
-void gpr_once_init(gpr_once *once, void (*init_routine)(void));
+GPR_API void gpr_once_init(gpr_once *once, void (*init_routine)(void));
/* --- One-time event notification ---
@@ -150,43 +150,43 @@ void gpr_once_init(gpr_once *once, void (*init_routine)(void));
It requires no destruction. */
/* Initialize *ev. */
-void gpr_event_init(gpr_event *ev);
+GPR_API void gpr_event_init(gpr_event *ev);
/* Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
Requires: *ev initialized; value != NULL; no prior or concurrent calls to
gpr_event_set(ev, ...) since initialization. */
-void gpr_event_set(gpr_event *ev, void *value);
+GPR_API void gpr_event_set(gpr_event *ev, void *value);
/* Return the value set by gpr_event_set(ev, ...), or NULL if no such call has
completed. If the result is non-NULL, all operations that occurred prior to
the gpr_event_set(ev, ...) set will be visible after this call returns.
Requires: *ev initialized. This operation is faster than acquiring a mutex
on most platforms. */
-void *gpr_event_get(gpr_event *ev);
+GPR_API void *gpr_event_get(gpr_event *ev);
/* Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is
exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
abs_deadline==gpr_inf_future for no deadline. When the event has been
signalled before the call, this operation is faster than acquiring a mutex
on most platforms. */
-void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline);
+GPR_API void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline);
/* --- Reference counting ---
These calls act on the type gpr_refcount. It requires no destruction. */
/* Initialize *r to value n. */
-void gpr_ref_init(gpr_refcount *r, int n);
+GPR_API void gpr_ref_init(gpr_refcount *r, int n);
/* Increment the reference count *r. Requires *r initialized. */
-void gpr_ref(gpr_refcount *r);
+GPR_API void gpr_ref(gpr_refcount *r);
/* Increment the reference count *r by n. Requires *r initialized, n > 0. */
-void gpr_refn(gpr_refcount *r, int n);
+GPR_API void gpr_refn(gpr_refcount *r, int n);
/* Decrement the reference count *r and return non-zero iff it has reached
zero. . Requires *r initialized. */
-int gpr_unref(gpr_refcount *r);
+GPR_API int gpr_unref(gpr_refcount *r);
/* --- Stats counters ---
@@ -197,13 +197,13 @@ int gpr_unref(gpr_refcount *r);
synchronize other events. */
/* Initialize *c to the value n. */
-void gpr_stats_init(gpr_stats_counter *c, intptr_t n);
+GPR_API void gpr_stats_init(gpr_stats_counter *c, intptr_t n);
/* *c += inc. Requires: *c initialized. */
-void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc);
+GPR_API void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc);
/* Return *c. Requires: *c initialized. */
-intptr_t gpr_stats_read(const gpr_stats_counter *c);
+GPR_API intptr_t gpr_stats_read(const gpr_stats_counter *c);
/* ==================Example use of interface===================
A producer-consumer queue of up to N integers,
diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h
index 2248391f52..b40c2b260c 100644
--- a/include/grpc/impl/codegen/time.h
+++ b/include/grpc/impl/codegen/time.h
@@ -69,9 +69,10 @@ typedef struct gpr_timespec {
} gpr_timespec;
/* Time constants. */
-gpr_timespec gpr_time_0(gpr_clock_type type); /* The zero time interval. */
-gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */
-gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */
+GPR_API gpr_timespec
+gpr_time_0(gpr_clock_type type); /* The zero time interval. */
+GPR_API gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */
+GPR_API gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */
#define GPR_MS_PER_SEC 1000
#define GPR_US_PER_SEC 1000000
@@ -81,45 +82,46 @@ gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */
#define GPR_US_PER_MS 1000
/* initialize time subsystem */
-void gpr_time_init(void);
+GPR_API void gpr_time_init(void);
/* Return the current time measured from the given clocks epoch. */
-gpr_timespec gpr_now(gpr_clock_type clock);
+GPR_API gpr_timespec gpr_now(gpr_clock_type clock);
/* Convert a timespec from one clock to another */
-gpr_timespec gpr_convert_clock_type(gpr_timespec t,
- gpr_clock_type target_clock);
+GPR_API gpr_timespec
+gpr_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock);
/* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b
respectively. */
-int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
+GPR_API int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
-gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
-gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
+GPR_API gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
+GPR_API gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
/* Add and subtract times. Calculations saturate at infinities. */
-gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
-gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
+GPR_API gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
+GPR_API gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
/* Return a timespec representing a given number of time units. LONG_MIN is
interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */
-gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type);
-gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type);
-gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type);
-gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type);
-gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type);
-gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type);
+GPR_API gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type);
-int32_t gpr_time_to_millis(gpr_timespec timespec);
+GPR_API int32_t gpr_time_to_millis(gpr_timespec timespec);
/* Return 1 if two times are equal or within threshold of each other,
0 otherwise */
-int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold);
+GPR_API int gpr_time_similar(gpr_timespec a, gpr_timespec b,
+ gpr_timespec threshold);
/* Sleep until at least 'until' - an absolute timeout */
-void gpr_sleep_until(gpr_timespec until);
+GPR_API void gpr_sleep_until(gpr_timespec until);
-double gpr_timespec_to_micros(gpr_timespec t);
+GPR_API double gpr_timespec_to_micros(gpr_timespec t);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h
index d462f52bfe..3433124c6f 100644
--- a/include/grpc/support/avl.h
+++ b/include/grpc/support/avl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -69,23 +69,23 @@ typedef struct gpr_avl {
} gpr_avl;
/** create an immutable AVL tree */
-gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable);
+GPR_API gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable);
/** add a reference to an existing tree - returns
the tree as a convenience */
-gpr_avl gpr_avl_ref(gpr_avl avl);
+GPR_API gpr_avl gpr_avl_ref(gpr_avl avl);
/** remove a reference to a tree - destroying it if there
are no references left */
-void gpr_avl_unref(gpr_avl avl);
+GPR_API void gpr_avl_unref(gpr_avl avl);
/** return a new tree with (key, value) added to avl.
implicitly unrefs avl to allow easy chaining.
if key exists in avl, the new tree's key entry updated
(i.e. a duplicate is not created) */
-gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value);
+GPR_API gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value);
/** return a new tree with key deleted */
-gpr_avl gpr_avl_remove(gpr_avl avl, void *key);
+GPR_API gpr_avl gpr_avl_remove(gpr_avl avl, void *key);
/** lookup key, and return the associated value.
does not mutate avl.
returns NULL if key is not found. */
-void *gpr_avl_get(gpr_avl avl, void *key);
+GPR_API void *gpr_avl_get(gpr_avl avl, void *key);
#endif
diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h
index 3058cf905a..6f442e3cf2 100644
--- a/include/grpc/support/cmdline.h
+++ b/include/grpc/support/cmdline.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
#ifndef GRPC_SUPPORT_CMDLINE_H
#define GRPC_SUPPORT_CMDLINE_H
+#include <grpc/support/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -68,31 +70,31 @@ typedef struct gpr_cmdline gpr_cmdline;
/* Construct a command line parser: takes a short description of the tool
doing the parsing */
-gpr_cmdline *gpr_cmdline_create(const char *description);
+GPR_API gpr_cmdline *gpr_cmdline_create(const char *description);
/* Add an integer parameter, with a name (used on the command line) and some
helpful text (used in the command usage) */
-void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, const char *help,
- int *value);
+GPR_API void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name,
+ const char *help, int *value);
/* The same, for a boolean flag */
-void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, const char *help,
- int *value);
+GPR_API void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name,
+ const char *help, int *value);
/* And for a string */
-void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, const char *help,
- char **value);
+GPR_API void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name,
+ const char *help, char **value);
/* Set a callback for non-named arguments */
-void gpr_cmdline_on_extra_arg(
+GPR_API void gpr_cmdline_on_extra_arg(
gpr_cmdline *cl, const char *name, const char *help,
void (*on_extra_arg)(void *user_data, const char *arg), void *user_data);
/* Enable surviving failure: default behavior is to exit the process */
-void gpr_cmdline_set_survive_failure(gpr_cmdline *cl);
+GPR_API void gpr_cmdline_set_survive_failure(gpr_cmdline *cl);
/* Parse the command line; returns 1 on success, on failure either dies
(by default) or returns 0 if gpr_cmdline_set_survive_failure() has been
called */
-int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv);
+GPR_API int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv);
/* Destroy the parser */
-void gpr_cmdline_destroy(gpr_cmdline *cl);
+GPR_API void gpr_cmdline_destroy(gpr_cmdline *cl);
/* Get a string describing usage */
-char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0);
+GPR_API char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h
index 7d8af59911..db4bdd42aa 100644
--- a/include/grpc/support/cpu.h
+++ b/include/grpc/support/cpu.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
#ifndef GRPC_SUPPORT_CPU_H
#define GRPC_SUPPORT_CPU_H
+#include <grpc/support/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,13 +44,13 @@ extern "C" {
/* Return the number of CPU cores on the current system. Will return 0 if
the information is not available. */
-unsigned gpr_cpu_num_cores(void);
+GPR_API unsigned gpr_cpu_num_cores(void);
/* Return the CPU on which the current thread is executing; N.B. This should
be considered advisory only - it is possible that the thread is switched
to a different CPU at any time. Returns a value in range
[0, gpr_cpu_num_cores() - 1] */
-unsigned gpr_cpu_current_cpu(void);
+GPR_API unsigned gpr_cpu_current_cpu(void);
#ifdef __cplusplus
} // extern "C"
diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h
index 8774676f3a..9c807ea27d 100644
--- a/include/grpc/support/histogram.h
+++ b/include/grpc/support/histogram.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,31 +43,34 @@ extern "C" {
typedef struct gpr_histogram gpr_histogram;
-gpr_histogram *gpr_histogram_create(double resolution, double max_bucket_start);
-void gpr_histogram_destroy(gpr_histogram *h);
-void gpr_histogram_add(gpr_histogram *h, double x);
+GPR_API gpr_histogram *gpr_histogram_create(double resolution,
+ double max_bucket_start);
+GPR_API void gpr_histogram_destroy(gpr_histogram *h);
+GPR_API void gpr_histogram_add(gpr_histogram *h, double x);
/* The following merges the second histogram into the first. It only works
if they have the same buckets and resolution. Returns 0 on failure, 1
on success */
-int gpr_histogram_merge(gpr_histogram *dst, const gpr_histogram *src);
+GPR_API int gpr_histogram_merge(gpr_histogram *dst, const gpr_histogram *src);
-double gpr_histogram_percentile(gpr_histogram *histogram, double percentile);
-double gpr_histogram_mean(gpr_histogram *histogram);
-double gpr_histogram_stddev(gpr_histogram *histogram);
-double gpr_histogram_variance(gpr_histogram *histogram);
-double gpr_histogram_maximum(gpr_histogram *histogram);
-double gpr_histogram_minimum(gpr_histogram *histogram);
-double gpr_histogram_count(gpr_histogram *histogram);
-double gpr_histogram_sum(gpr_histogram *histogram);
-double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
+GPR_API double gpr_histogram_percentile(gpr_histogram *histogram,
+ double percentile);
+GPR_API double gpr_histogram_mean(gpr_histogram *histogram);
+GPR_API double gpr_histogram_stddev(gpr_histogram *histogram);
+GPR_API double gpr_histogram_variance(gpr_histogram *histogram);
+GPR_API double gpr_histogram_maximum(gpr_histogram *histogram);
+GPR_API double gpr_histogram_minimum(gpr_histogram *histogram);
+GPR_API double gpr_histogram_count(gpr_histogram *histogram);
+GPR_API double gpr_histogram_sum(gpr_histogram *histogram);
+GPR_API double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
-const uint32_t *gpr_histogram_get_contents(gpr_histogram *histogram,
- size_t *count);
-void gpr_histogram_merge_contents(gpr_histogram *histogram,
- const uint32_t *data, size_t data_count,
- double min_seen, double max_seen, double sum,
- double sum_of_squares, double count);
+GPR_API const uint32_t *gpr_histogram_get_contents(gpr_histogram *histogram,
+ size_t *count);
+GPR_API void gpr_histogram_merge_contents(gpr_histogram *histogram,
+ const uint32_t *data,
+ size_t data_count, double min_seen,
+ double max_seen, double sum,
+ double sum_of_squares, double count);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h
index 375d1774e6..ee9c294ebc 100644
--- a/include/grpc/support/host_port.h
+++ b/include/grpc/support/host_port.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
#ifndef GRPC_SUPPORT_HOST_PORT_H
#define GRPC_SUPPORT_HOST_PORT_H
+#include <grpc/support/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -48,14 +50,14 @@ extern "C" {
destroyed using gpr_free().
In the unlikely event of an error, returns -1 and sets *out to NULL. */
-int gpr_join_host_port(char **out, const char *host, int port);
+GPR_API int gpr_join_host_port(char **out, const char *host, int port);
/* Given a name in the form "host:port" or "[ho:st]:port", split into hostname
and port number, into newly allocated strings, which must later be
destroyed using gpr_free().
Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
failure. */
-int gpr_split_host_port(const char *name, char **host, char **port);
+GPR_API int gpr_split_host_port(const char *name, char **host, char **port);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h
index 3546266976..1470e5b484 100644
--- a/include/grpc/support/log_win32.h
+++ b/include/grpc/support/log_win32.h
@@ -42,7 +42,7 @@ extern "C" {
* formatted error message, corresponding to the error messageid.
* Use in conjunction with GetLastError() et al.
*/
-char *gpr_format_message(int messageid);
+GPR_API char *gpr_format_message(int messageid);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h
index 109f9ffdf7..74f2cb371a 100644
--- a/include/grpc/support/string_util.h
+++ b/include/grpc/support/string_util.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ extern "C" {
/* Returns a copy of src that can be passed to gpr_free().
If allocation fails or if src is NULL, returns NULL. */
-char *gpr_strdup(const char *src);
+GPR_API char *gpr_strdup(const char *src);
/* printf to a newly-allocated string. The set of supported formats may vary
between platforms.
@@ -52,7 +52,7 @@ char *gpr_strdup(const char *src);
On error, returns -1 and sets *strp to NULL. If the format string is bad,
the result is undefined. */
-int gpr_asprintf(char **strp, const char *format, ...);
+GPR_API int gpr_asprintf(char **strp, const char *format, ...);
#ifdef __cplusplus
}
diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h
index 654623fd09..ffbdf67357 100644
--- a/include/grpc/support/subprocess.h
+++ b/include/grpc/support/subprocess.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@
#ifndef GRPC_SUPPORT_SUBPROCESS_H
#define GRPC_SUPPORT_SUBPROCESS_H
+#include <grpc/support/port_platform.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -41,14 +43,14 @@ extern "C" {
typedef struct gpr_subprocess gpr_subprocess;
/* .exe on windows, empty on unices */
-const char *gpr_subprocess_binary_extension();
+GPR_API const char *gpr_subprocess_binary_extension();
-gpr_subprocess *gpr_subprocess_create(int argc, const char **argv);
+GPR_API gpr_subprocess *gpr_subprocess_create(int argc, const char **argv);
/* if subprocess has not been joined, kill it */
-void gpr_subprocess_destroy(gpr_subprocess *p);
+GPR_API void gpr_subprocess_destroy(gpr_subprocess *p);
/* returns exit status; can be called at most once */
-int gpr_subprocess_join(gpr_subprocess *p);
-void gpr_subprocess_interrupt(gpr_subprocess *p);
+GPR_API int gpr_subprocess_join(gpr_subprocess *p);
+GPR_API void gpr_subprocess_interrupt(gpr_subprocess *p);
#ifdef __cplusplus
} // extern "C"
diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h
index 56185cc8ea..84e964fc07 100644
--- a/include/grpc/support/thd.h
+++ b/include/grpc/support/thd.h
@@ -59,30 +59,30 @@ typedef struct {
in *t, and return true. If there are insufficient resources, return false.
If options==NULL, default options are used.
The thread is immediately runnable, and exits when (*thd_body)() returns. */
-int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg,
- const gpr_thd_options *options);
+GPR_API int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg,
+ const gpr_thd_options *options);
/* Return a gpr_thd_options struct with all fields set to defaults. */
-gpr_thd_options gpr_thd_options_default(void);
+GPR_API gpr_thd_options gpr_thd_options_default(void);
/* Set the thread to become detached on startup - this is the default. */
-void gpr_thd_options_set_detached(gpr_thd_options *options);
+GPR_API void gpr_thd_options_set_detached(gpr_thd_options *options);
/* Set the thread to become joinable - mutually exclusive with detached. */
-void gpr_thd_options_set_joinable(gpr_thd_options *options);
+GPR_API void gpr_thd_options_set_joinable(gpr_thd_options *options);
/* Returns non-zero if the option detached is set. */
-int gpr_thd_options_is_detached(const gpr_thd_options *options);
+GPR_API int gpr_thd_options_is_detached(const gpr_thd_options *options);
/* Returns non-zero if the option joinable is set. */
-int gpr_thd_options_is_joinable(const gpr_thd_options *options);
+GPR_API int gpr_thd_options_is_joinable(const gpr_thd_options *options);
/* Returns the identifier of the current thread. */
-gpr_thd_id gpr_thd_currentid(void);
+GPR_API gpr_thd_id gpr_thd_currentid(void);
/* Blocks until the specified thread properly terminates.
Calling this on a detached thread has unpredictable results. */
-void gpr_thd_join(gpr_thd_id t);
+GPR_API void gpr_thd_join(gpr_thd_id t);
#ifdef __cplusplus
}