Merge in bug fix for lp:779837
[awesomized/libmemcached] / libmemcached / protocol_handler.h
index 78eda07745a4d86a55b214d8d49c905bfe1b3b56..1eee5ca5ec52eb48c786bde553d6c06f54f4e6d6 100644 (file)
  *
  */
 
-#ifndef __LIBMEMCACHED_PROTOCOL_H__
-#define __LIBMEMCACHED_PROTOCOL_H__
+#pragma once
 
 #include <sys/types.h>
 #if !defined(__cplusplus)
 # include <stdbool.h>
 #endif
 
+#include <libmemcached/platform.h>
 #include <libmemcached/memcached/protocol_binary.h>
 #include <libmemcached/visibility.h>
 #include <libmemcached/protocol/callback.h>
@@ -48,7 +48,7 @@ extern "C" {
  *         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);
 
@@ -64,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);
 
@@ -139,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.
@@ -191,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
@@ -213,5 +213,3 @@ memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw
 #ifdef __cplusplus
 }
 #endif
-
-#endif