X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=include%2Flibmemcachedprotocol-0.0%2Fhandler.h;h=5f0090560716f094d6b1f29c707e63be84f76bc5;hb=aeac01630eed825d8a624e7fd7c107d47bb2e40c;hp=7a0b79eafbeed3082a2cec4e77eb470c1d243386;hpb=5bb6f975322d3da0caf082b8d890132194d0a4ea;p=m6w6%2Flibmemcached diff --git a/include/libmemcachedprotocol-0.0/handler.h b/include/libmemcachedprotocol-0.0/handler.h index 7a0b79ea..5f009056 100644 --- a/include/libmemcachedprotocol-0.0/handler.h +++ b/include/libmemcachedprotocol-0.0/handler.h @@ -1,21 +1,31 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - * - * Summary: Definition of the callback interface to the protocol handler - * - * Author: Trond Norbye - * - */ +/* + +--------------------------------------------------------------------+ + | libmemcached - C/C++ Client Library for memcached | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted under the terms of the BSD license. | + | You should have received a copy of the license in a bundled file | + | named LICENSE; in case you did not receive a copy you can review | + | the terms online at: https://opensource.org/licenses/BSD-3-Clause | + +--------------------------------------------------------------------+ + | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | + | Copyright (c) 2020 Michael Wallner | + +--------------------------------------------------------------------+ +*/ #pragma once #include -#if !defined(__cplusplus) -# include +#ifndef HAVE_SSIZE_T +typedef long int ssize_t; +#endif + +#ifndef __cplusplus +# include +# include +# include +#else +# include #endif #include "libmemcached-1.0/visibility.h" @@ -47,10 +57,8 @@ extern "C" { * @return the number of bytes copied into buf * or -1 upon error (errno should contain more information) */ -typedef ssize_t (*memcached_protocol_recv_func)(const void *cookie, - memcached_socket_t fd, - void *buf, - size_t nbuf); +typedef ssize_t (*memcached_protocol_recv_func)(const void *cookie, memcached_socket_t fd, + void *buf, size_t nbuf); /** * Function the protocol handler should call to send data. @@ -63,10 +71,8 @@ typedef ssize_t (*memcached_protocol_recv_func)(const void *cookie, * @return the number of bytes sent * or -1 upon error (errno should contain more information) */ -typedef ssize_t (*memcached_protocol_send_func)(const void *cookie, - memcached_socket_t fd, - const void *buf, - size_t nbuf); +typedef ssize_t (*memcached_protocol_send_func)(const void *cookie, memcached_socket_t fd, + const void *buf, size_t nbuf); /** * Create an instance of the protocol handler @@ -81,7 +87,8 @@ memcached_protocol_st *memcached_protocol_create_instance(void); * @return the callbacks currently used */ LIBMEMCACHED_API -memcached_binary_protocol_callback_st *memcached_binary_protocol_get_callbacks(memcached_protocol_st *instance); +memcached_binary_protocol_callback_st * +memcached_binary_protocol_get_callbacks(memcached_protocol_st *instance); /** * Set the callbacks to be used by the given protocol handler instance @@ -89,7 +96,8 @@ memcached_binary_protocol_callback_st *memcached_binary_protocol_get_callbacks(m * @param callback the callbacks to use */ LIBMEMCACHED_API -void memcached_binary_protocol_set_callbacks(memcached_protocol_st *instance, memcached_binary_protocol_callback_st *callback); +void memcached_binary_protocol_set_callbacks(memcached_protocol_st *instance, + memcached_binary_protocol_callback_st *callback); /** * Should the library inspect the packages being sent and received and verify @@ -131,7 +139,6 @@ void memached_protocol_set_io_functions(memcached_protocol_st *instance, memcached_protocol_recv_func recv, memcached_protocol_send_func send); - /** * Create a new client instance and associate it with a socket * @param instance the protocol instance to bind the client to @@ -139,7 +146,8 @@ 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, memcached_socket_t sock); +memcached_protocol_client_st *memcached_protocol_create_client(memcached_protocol_st *instance, + memcached_socket_t sock); /** * Destroy a client handle. @@ -211,7 +219,8 @@ int memcached_protocol_client_get_errno(memcached_protocol_client_st *client); * the generic callback too limiting */ LIBMEMCACHED_API -memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw_response_handler(const void *cookie); +memcached_binary_protocol_raw_response_handler +memcached_binary_protocol_get_raw_response_handler(const void *cookie); #ifdef __cplusplus }