Finish up bindings to most core gRPC functions (#1)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* add requested comment
* remove slice_unref binding, use sliceFree when converting buffer to bytestring
2016-05-13 18:12:37 +02:00
|
|
|
#ifndef GRPC_HASKELL
|
|
|
|
#define GRPC_HASKELL
|
|
|
|
|
2015-03-05 19:02:25 +01:00
|
|
|
#include <grpc/grpc.h>
|
Finish up bindings to most core gRPC functions (#1)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* add requested comment
* remove slice_unref binding, use sliceFree when converting buffer to bytestring
2016-05-13 18:12:37 +02:00
|
|
|
#include <grpc/impl/codegen/slice.h>
|
|
|
|
#include <grpc/impl/codegen/time.h>
|
|
|
|
#include <grpc/byte_buffer.h>
|
|
|
|
#include <grpc/byte_buffer_reader.h>
|
2015-03-05 19:02:25 +01:00
|
|
|
|
|
|
|
grpc_event *grpc_completion_queue_next_(grpc_completion_queue *cq,
|
2016-04-25 23:04:32 +02:00
|
|
|
gpr_timespec *deadline,
|
|
|
|
void *reserved);
|
2015-03-05 19:02:25 +01:00
|
|
|
|
|
|
|
grpc_event *grpc_completion_queue_pluck_(grpc_completion_queue *cq, void *tag,
|
2016-04-25 23:04:32 +02:00
|
|
|
gpr_timespec *deadline,
|
|
|
|
void *reserved);
|
2015-03-05 19:02:25 +01:00
|
|
|
|
|
|
|
grpc_call *grpc_channel_create_call_(grpc_channel *channel,
|
2016-04-21 01:02:53 +02:00
|
|
|
grpc_call *parent_call,
|
|
|
|
uint32_t propagation_mask,
|
|
|
|
grpc_completion_queue *completion_queue,
|
|
|
|
const char *method, const char *host,
|
|
|
|
gpr_timespec *deadline, void *reserved);
|
Finish up bindings to most core gRPC functions (#1)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* add requested comment
* remove slice_unref binding, use sliceFree when converting buffer to bytestring
2016-05-13 18:12:37 +02:00
|
|
|
|
|
|
|
size_t gpr_slice_length_(gpr_slice *slice);
|
|
|
|
|
|
|
|
uint8_t *gpr_slice_start_(gpr_slice *slice);
|
|
|
|
|
|
|
|
gpr_slice* gpr_slice_from_copied_string_(const char *source);
|
|
|
|
|
|
|
|
void free_slice(gpr_slice *slice);
|
|
|
|
|
|
|
|
grpc_byte_buffer **create_receiving_byte_buffer();
|
|
|
|
|
|
|
|
void destroy_receiving_byte_buffer(grpc_byte_buffer **bb);
|
|
|
|
|
|
|
|
grpc_byte_buffer_reader *byte_buffer_reader_create(grpc_byte_buffer *buffer);
|
|
|
|
|
|
|
|
void byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
|
|
|
|
|
|
|
|
gpr_slice* grpc_byte_buffer_reader_readall_(grpc_byte_buffer_reader *reader);
|
|
|
|
|
|
|
|
void timespec_destroy(gpr_timespec* t);
|
|
|
|
|
|
|
|
gpr_timespec* gpr_inf_future_(gpr_clock_type t);
|
|
|
|
|
|
|
|
gpr_timespec* gpr_now_(gpr_clock_type t);
|
|
|
|
|
|
|
|
int32_t gpr_time_to_millis_(gpr_timespec* t);
|
|
|
|
|
|
|
|
gpr_timespec* seconds_to_deadline(int64_t seconds);
|
|
|
|
|
|
|
|
gpr_timespec* millis_to_deadline(int64_t millis);
|
|
|
|
|
|
|
|
grpc_metadata_array** metadata_array_create();
|
|
|
|
|
|
|
|
void metadata_array_destroy(grpc_metadata_array **arr);
|
|
|
|
|
|
|
|
grpc_metadata* metadata_alloc(size_t n);
|
|
|
|
|
|
|
|
void metadata_free(grpc_metadata* m);
|
|
|
|
|
|
|
|
void set_metadata_key_val(char *key, char *val, grpc_metadata *arr, size_t i);
|
|
|
|
|
|
|
|
const char* get_metadata_key(grpc_metadata *arr, size_t i);
|
|
|
|
|
|
|
|
const char* get_metadata_val(grpc_metadata *arr, size_t i);
|
|
|
|
|
|
|
|
grpc_op* op_array_create(size_t n);
|
|
|
|
|
|
|
|
void op_array_destroy(grpc_op* op_array, size_t n);
|
|
|
|
|
|
|
|
void op_send_initial_metadata(grpc_op *op_array, size_t i,
|
|
|
|
grpc_metadata *arr, size_t n_metadata);
|
|
|
|
|
|
|
|
void op_send_initial_metadata_empty(grpc_op *op_array, size_t i);
|
|
|
|
|
|
|
|
void op_send_message(grpc_op *op_array, size_t i,
|
|
|
|
grpc_byte_buffer *payload);
|
|
|
|
|
|
|
|
void op_send_close_client(grpc_op *op_array, size_t i);
|
|
|
|
|
|
|
|
void op_recv_initial_metadata(grpc_op *op_array, size_t i,
|
|
|
|
grpc_metadata_array** arr);
|
|
|
|
|
|
|
|
void op_recv_message(grpc_op *op_array, size_t i,
|
|
|
|
grpc_byte_buffer **payload_recv);
|
|
|
|
|
|
|
|
void op_recv_status_client(grpc_op *op_array, size_t i,
|
|
|
|
grpc_metadata_array** arr,
|
|
|
|
grpc_status_code* status,
|
|
|
|
char **details, size_t* details_capacity);
|
|
|
|
|
|
|
|
void op_recv_close_server(grpc_op *op_array, size_t i, int *was_cancelled);
|
|
|
|
|
|
|
|
void op_send_status_server(grpc_op *op_array, size_t i,
|
|
|
|
size_t metadata_count, grpc_metadata* m,
|
|
|
|
grpc_status_code status, char *details);
|
|
|
|
|
|
|
|
grpc_status_code* create_status_code_ptr();
|
|
|
|
|
Begin safe low-level Haskell layer (#7)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* begin safe low-level facilities
* begin completion queue and server stuff
* Finish server start/stop, cq start/stop, add tests
* facilities for safely executing op batches
* reorganize LowLevel modules, begin explicit export list
* client functionality, stub payload test, various refactors
* tweak cabal file, add test
* add more documentation
* doc tweaks
* begin refactor to improve CompletionQueue safety
* export only thread-safe CQ functions, add registered call creation and other CQ utilities
* begin refactor to use GRPCIO monad, fix missing push semaphore, fix mem leak in server calls
* switch to explicit Either where needed
* add crashing tests, continue fleshing out serverHandleNormalCall
* fix haddock error, finish first draft of request handling function
* reduce GHC warnings
* non-registered client request helpers
* initial request/response test working
* don't pass tags around; generate where needed
* server call bracket functions
* correct order of semaphore acquisition and shutdown check
* simple debug flag logging, simplify Call type
* fix various registered method issues (but still not working)
* cleanup
* delete old code
* remove old todo
* use MetadataMap synonym pervasively
* more comments
* update TODOs
* tweak safety caveat
* docs tweaks
* improve haddocks
* add casts to eliminate clang warnings, remove unused function
* update options to eliminate cabal warnings
* remove outdated todo
* remove unneeded exports from CompletionQueue
* rename to GRPCIOCallError, re-add create/shutdown exports (needed for Server module)
* newtypes for hosts and method names
* more newtypes
* more debug logging
* Fix flag name collision
* instrument uses of free
* more debug
* switch to STM for completion queue stuff
* reduce warnings
* more debugging, create/destroy call tests
* refactor, fix failure cleanup for server call creation. More tests passing.
* formatting tweaks
2016-05-24 22:34:50 +02:00
|
|
|
grpc_status_code deref_status_code_ptr(grpc_status_code* p);
|
|
|
|
|
Finish up bindings to most core gRPC functions (#1)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* add requested comment
* remove slice_unref binding, use sliceFree when converting buffer to bytestring
2016-05-13 18:12:37 +02:00
|
|
|
void destroy_status_code_ptr(grpc_status_code* p);
|
|
|
|
|
|
|
|
grpc_call_details* create_call_details();
|
|
|
|
|
|
|
|
void destroy_call_details(grpc_call_details* cd);
|
|
|
|
|
|
|
|
void grpc_channel_watch_connectivity_state_(grpc_channel *channel,
|
|
|
|
grpc_connectivity_state
|
|
|
|
last_observed_state,
|
|
|
|
gpr_timespec* deadline,
|
|
|
|
grpc_completion_queue *cq,
|
|
|
|
void *tag);
|
|
|
|
|
Begin safe low-level Haskell layer (#7)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* begin safe low-level facilities
* begin completion queue and server stuff
* Finish server start/stop, cq start/stop, add tests
* facilities for safely executing op batches
* reorganize LowLevel modules, begin explicit export list
* client functionality, stub payload test, various refactors
* tweak cabal file, add test
* add more documentation
* doc tweaks
* begin refactor to improve CompletionQueue safety
* export only thread-safe CQ functions, add registered call creation and other CQ utilities
* begin refactor to use GRPCIO monad, fix missing push semaphore, fix mem leak in server calls
* switch to explicit Either where needed
* add crashing tests, continue fleshing out serverHandleNormalCall
* fix haddock error, finish first draft of request handling function
* reduce GHC warnings
* non-registered client request helpers
* initial request/response test working
* don't pass tags around; generate where needed
* server call bracket functions
* correct order of semaphore acquisition and shutdown check
* simple debug flag logging, simplify Call type
* fix various registered method issues (but still not working)
* cleanup
* delete old code
* remove old todo
* use MetadataMap synonym pervasively
* more comments
* update TODOs
* tweak safety caveat
* docs tweaks
* improve haddocks
* add casts to eliminate clang warnings, remove unused function
* update options to eliminate cabal warnings
* remove outdated todo
* remove unneeded exports from CompletionQueue
* rename to GRPCIOCallError, re-add create/shutdown exports (needed for Server module)
* newtypes for hosts and method names
* more newtypes
* more debug logging
* Fix flag name collision
* instrument uses of free
* more debug
* switch to STM for completion queue stuff
* reduce warnings
* more debugging, create/destroy call tests
* refactor, fix failure cleanup for server call creation. More tests passing.
* formatting tweaks
2016-05-24 22:34:50 +02:00
|
|
|
grpc_metadata* metadata_array_get_metadata(grpc_metadata_array* arr);
|
|
|
|
|
2016-06-02 17:55:29 +02:00
|
|
|
void metadata_array_set_metadata(grpc_metadata_array* arr, grpc_metadata* meta);
|
|
|
|
|
Begin safe low-level Haskell layer (#7)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* begin safe low-level facilities
* begin completion queue and server stuff
* Finish server start/stop, cq start/stop, add tests
* facilities for safely executing op batches
* reorganize LowLevel modules, begin explicit export list
* client functionality, stub payload test, various refactors
* tweak cabal file, add test
* add more documentation
* doc tweaks
* begin refactor to improve CompletionQueue safety
* export only thread-safe CQ functions, add registered call creation and other CQ utilities
* begin refactor to use GRPCIO monad, fix missing push semaphore, fix mem leak in server calls
* switch to explicit Either where needed
* add crashing tests, continue fleshing out serverHandleNormalCall
* fix haddock error, finish first draft of request handling function
* reduce GHC warnings
* non-registered client request helpers
* initial request/response test working
* don't pass tags around; generate where needed
* server call bracket functions
* correct order of semaphore acquisition and shutdown check
* simple debug flag logging, simplify Call type
* fix various registered method issues (but still not working)
* cleanup
* delete old code
* remove old todo
* use MetadataMap synonym pervasively
* more comments
* update TODOs
* tweak safety caveat
* docs tweaks
* improve haddocks
* add casts to eliminate clang warnings, remove unused function
* update options to eliminate cabal warnings
* remove outdated todo
* remove unneeded exports from CompletionQueue
* rename to GRPCIOCallError, re-add create/shutdown exports (needed for Server module)
* newtypes for hosts and method names
* more newtypes
* more debug logging
* Fix flag name collision
* instrument uses of free
* more debug
* switch to STM for completion queue stuff
* reduce warnings
* more debugging, create/destroy call tests
* refactor, fix failure cleanup for server call creation. More tests passing.
* formatting tweaks
2016-05-24 22:34:50 +02:00
|
|
|
size_t metadata_array_get_count(grpc_metadata_array* arr);
|
|
|
|
|
2016-06-02 17:55:29 +02:00
|
|
|
size_t metadata_array_get_capacity(grpc_metadata_array* arr);
|
|
|
|
|
Begin safe low-level Haskell layer (#7)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* begin safe low-level facilities
* begin completion queue and server stuff
* Finish server start/stop, cq start/stop, add tests
* facilities for safely executing op batches
* reorganize LowLevel modules, begin explicit export list
* client functionality, stub payload test, various refactors
* tweak cabal file, add test
* add more documentation
* doc tweaks
* begin refactor to improve CompletionQueue safety
* export only thread-safe CQ functions, add registered call creation and other CQ utilities
* begin refactor to use GRPCIO monad, fix missing push semaphore, fix mem leak in server calls
* switch to explicit Either where needed
* add crashing tests, continue fleshing out serverHandleNormalCall
* fix haddock error, finish first draft of request handling function
* reduce GHC warnings
* non-registered client request helpers
* initial request/response test working
* don't pass tags around; generate where needed
* server call bracket functions
* correct order of semaphore acquisition and shutdown check
* simple debug flag logging, simplify Call type
* fix various registered method issues (but still not working)
* cleanup
* delete old code
* remove old todo
* use MetadataMap synonym pervasively
* more comments
* update TODOs
* tweak safety caveat
* docs tweaks
* improve haddocks
* add casts to eliminate clang warnings, remove unused function
* update options to eliminate cabal warnings
* remove outdated todo
* remove unneeded exports from CompletionQueue
* rename to GRPCIOCallError, re-add create/shutdown exports (needed for Server module)
* newtypes for hosts and method names
* more newtypes
* more debug logging
* Fix flag name collision
* instrument uses of free
* more debug
* switch to STM for completion queue stuff
* reduce warnings
* more debugging, create/destroy call tests
* refactor, fix failure cleanup for server call creation. More tests passing.
* formatting tweaks
2016-05-24 22:34:50 +02:00
|
|
|
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);
|
|
|
|
|
2016-06-02 17:46:20 +02:00
|
|
|
char* call_details_get_method(grpc_call_details* details);
|
|
|
|
|
|
|
|
char* call_details_get_host(grpc_call_details* details);
|
|
|
|
|
|
|
|
gpr_timespec* call_details_get_deadline(grpc_call_details* details);
|
|
|
|
|
Finish up bindings to most core gRPC functions (#1)
* grpc_server_request_call
* basic slice functionality
* rename function to emphasize side effects
* add docs
* ByteBuffer function bindings
* replace unsafeCoerce with more specific function, add docs, tests.
* add newtypes for Tag and Reserved void pointers
* manually fix request_registered_call binding
* use nocode keyword to fix Ptr () problems
* decouple copying Slice from freeing slice
* Add time ops
* remove nocode decls
* Start Op module, fix c2hs preprocessing order
* metadata manipulation operations
* metadata free function, test
* helper functions for constructing ops of each type
* bindings for op creation functions
* finish up Op creation functions, implement Op destruction, add docs.
* tweak documentation
* rework Op creation functions to work with an array of ops, for ease of use with grpc_call_start_batch
* forgot to change return types
* wrap hook lines, fix types to op creation functions
* implement part of the payload test
* hideous, but working, end to end test
* bindings for connectivity state checks, split test into two threads
* various cleanup
* rename Core to Unsafe for emphasis, clean up tests more
* add requested comment
* remove slice_unref binding, use sliceFree when converting buffer to bytestring
2016-05-13 18:12:37 +02:00
|
|
|
#endif //GRPC_HASKELL
|