X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fprotocol_handler.h;h=1eee5ca5ec52eb48c786bde553d6c06f54f4e6d6;hb=517d9f55399cbd61963e5cb9da6e733e6381b254;hp=3fb00c98d96b4e655232501e9366b5c162bfbfe4;hpb=c67da677fe0944d3d2d3ff46e65fc3bc775404ae;p=awesomized%2Flibmemcached diff --git a/libmemcached/protocol_handler.h b/libmemcached/protocol_handler.h index 3fb00c98..1eee5ca5 100644 --- a/libmemcached/protocol_handler.h +++ b/libmemcached/protocol_handler.h @@ -11,12 +11,14 @@ * */ -#ifndef MEMCACHED_PROTOCOL_H -#define MEMCACHED_PROTOCOL_H +#pragma once #include -#include +#if !defined(__cplusplus) +# include +#endif +#include #include #include #include @@ -30,6 +32,10 @@ typedef struct memcached_protocol_st memcached_protocol_st; typedef struct memcached_protocol_client_st memcached_protocol_client_st; +#ifdef __cplusplus +extern "C" { +#endif + /** * Function the protocol handler should call to receive data. * This function should behave exactly like read(2) @@ -42,7 +48,7 @@ typedef struct memcached_protocol_client_st memcached_protocol_client_st; * or -1 upon error (errno should contain more information) */ typedef ssize_t (*memcached_protocol_recv_func)(const void *cookie, - int fd, + memcached_socket_t fd, void *buf, size_t nbuf); @@ -58,7 +64,7 @@ typedef ssize_t (*memcached_protocol_recv_func)(const void *cookie, * or -1 upon error (errno should contain more information) */ typedef ssize_t (*memcached_protocol_send_func)(const void *cookie, - int fd, + memcached_socket_t fd, const void *buf, size_t nbuf); @@ -133,7 +139,7 @@ void memached_protocol_set_io_functions(memcached_protocol_st *instance, * @return NULL if allocation fails, otherwise an instance */ LIBMEMCACHED_API -memcached_protocol_client_st *memcached_protocol_create_client(memcached_protocol_st *instance, int sock); +memcached_protocol_client_st *memcached_protocol_create_client(memcached_protocol_st *instance, memcached_socket_t sock); /** * Destroy a client handle. @@ -185,7 +191,7 @@ memcached_protocol_event_t memcached_protocol_client_work(memcached_protocol_cli * @return the socket handle */ LIBMEMCACHED_API -int memcached_protocol_client_get_socket(memcached_protocol_client_st *client); +memcached_socket_t memcached_protocol_client_get_socket(memcached_protocol_client_st *client); /** * Get the error id socket attached to a client handle @@ -203,4 +209,7 @@ int memcached_protocol_client_get_errno(memcached_protocol_client_st *client); */ LIBMEMCACHED_API memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw_response_handler(const void *cookie); + +#ifdef __cplusplus +} #endif