memcached.h   memcached.h 
skipping to change at line 14 skipping to change at line 14
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.
* *
* Author: Brian Aker * Author: Brian Aker
*/ */
#ifndef __MEMCACHED_H__ #ifndef __MEMCACHED_H__
#define __MEMCACHED_H__ #define __MEMCACHED_H__
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <inttypes.h>
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct memcached_st memcached_st; typedef struct memcached_st memcached_st;
typedef struct memcached_stat_st memcached_stat_st; typedef struct memcached_stat_st memcached_stat_st;
typedef struct memcached_result_st memcached_result_st; typedef struct memcached_result_st memcached_result_st;
skipping to change at line 72 skipping to change at line 72
MEMCACHED_END, MEMCACHED_END,
MEMCACHED_DELETED, MEMCACHED_DELETED,
MEMCACHED_VALUE, MEMCACHED_VALUE,
MEMCACHED_STAT, MEMCACHED_STAT,
MEMCACHED_ERRNO, MEMCACHED_ERRNO,
MEMCACHED_FAIL_UNIX_SOCKET, MEMCACHED_FAIL_UNIX_SOCKET,
MEMCACHED_NOT_SUPPORTED, MEMCACHED_NOT_SUPPORTED,
MEMCACHED_NO_KEY_PROVIDED, MEMCACHED_NO_KEY_PROVIDED,
MEMCACHED_FETCH_NOTFINISHED, MEMCACHED_FETCH_NOTFINISHED,
MEMCACHED_TIMEOUT, MEMCACHED_TIMEOUT,
MEMCACHED_BUFFERED,
MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */ MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
} memcached_return; } memcached_return;
typedef enum { typedef enum {
MEMCACHED_DISTRIBUTION_MODULA, MEMCACHED_DISTRIBUTION_MODULA,
MEMCACHED_DISTRIBUTION_CONSISTENT, MEMCACHED_DISTRIBUTION_CONSISTENT,
} memcached_server_distribution; } memcached_server_distribution;
typedef enum { typedef enum {
MEMCACHED_BEHAVIOR_NO_BLOCK, MEMCACHED_BEHAVIOR_NO_BLOCK,
MEMCACHED_BEHAVIOR_TCP_NODELAY, MEMCACHED_BEHAVIOR_TCP_NODELAY,
MEMCACHED_BEHAVIOR_HASH, MEMCACHED_BEHAVIOR_HASH,
MEMCACHED_BEHAVIOR_KETAMA, MEMCACHED_BEHAVIOR_KETAMA,
MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
MEMCACHED_BEHAVIOR_CACHE_LOOKUPS, MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
MEMCACHED_BEHAVIOR_SUPPORT_CAS, MEMCACHED_BEHAVIOR_SUPPORT_CAS,
MEMCACHED_BEHAVIOR_POLL_TIMEOUT, MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_BEHAVIOR_DISTRIBUTION,
MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,
MEMCACHED_BEHAVIOR_USER_DATA,
} memcached_behavior; } memcached_behavior;
typedef enum { typedef enum {
MEMCACHED_HASH_DEFAULT= 0, MEMCACHED_HASH_DEFAULT= 0,
MEMCACHED_HASH_MD5, MEMCACHED_HASH_MD5,
MEMCACHED_HASH_CRC, MEMCACHED_HASH_CRC,
MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1_64,
MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1A_64,
MEMCACHED_HASH_FNV1_32, MEMCACHED_HASH_FNV1_32,
MEMCACHED_HASH_FNV1A_32, MEMCACHED_HASH_FNV1A_32,
skipping to change at line 122 skipping to change at line 125
typedef enum { typedef enum {
MEMCACHED_NOT_ALLOCATED, MEMCACHED_NOT_ALLOCATED,
MEMCACHED_ALLOCATED, MEMCACHED_ALLOCATED,
MEMCACHED_USED, MEMCACHED_USED,
} memcached_allocated; } memcached_allocated;
struct memcached_server_st { struct memcached_server_st {
char hostname[MEMCACHED_MAX_HOST_LENGTH]; char hostname[MEMCACHED_MAX_HOST_LENGTH];
unsigned int port; unsigned int port;
int fd; int fd;
unsigned int stack_responses;
unsigned int cursor_active; unsigned int cursor_active;
char write_buffer[MEMCACHED_MAX_BUFFER]; char write_buffer[MEMCACHED_MAX_BUFFER];
size_t write_buffer_offset; size_t write_buffer_offset;
char *write_ptr; char *write_ptr;
char read_buffer[MEMCACHED_MAX_BUFFER]; char read_buffer[MEMCACHED_MAX_BUFFER];
size_t read_data_length; size_t read_data_length;
size_t read_buffer_length; size_t read_buffer_length;
char *read_ptr; char *read_ptr;
memcached_allocated sockaddr_inited; memcached_allocated sockaddr_inited;
struct addrinfo *address_info; struct addrinfo *address_info;
skipping to change at line 182 skipping to change at line 184
size_t current_size; size_t current_size;
size_t block_size; size_t block_size;
}; };
struct memcached_result_st { struct memcached_result_st {
memcached_allocated is_allocated; memcached_allocated is_allocated;
memcached_st *root; memcached_st *root;
char key[MEMCACHED_MAX_KEY]; char key[MEMCACHED_MAX_KEY];
size_t key_length; size_t key_length;
memcached_string_st value; memcached_string_st value;
uint16_t flags; uint32_t flags;
uint64_t cas; uint64_t cas;
/* Add result callback function */
}; };
struct memcached_st { struct memcached_st {
memcached_allocated is_allocated; memcached_allocated is_allocated;
memcached_server_st *hosts; memcached_server_st *hosts;
unsigned int number_of_hosts; unsigned int number_of_hosts;
unsigned int cursor_server; unsigned int cursor_server;
char connected; char connected;
int cached_errno; int cached_errno;
unsigned long long flags; unsigned long long flags;
int send_size; int send_size;
int recv_size; int recv_size;
int32_t poll_timeout; int32_t poll_timeout;
memcached_string_st result_buffer; memcached_result_st result;
memcached_hash hash; memcached_hash hash;
memcached_server_distribution distribution; memcached_server_distribution distribution;
void *user_data;
unsigned int wheel[MEMCACHED_WHEEL_SIZE]; unsigned int wheel[MEMCACHED_WHEEL_SIZE];
#ifdef NOT_USED /* Future Use */
uint8_t replicas; uint8_t replicas;
memcached_return warning; /* Future Use */ memcached_return warning;
#endif
}; };
/* Public API */ /* Public API */
memcached_st *memcached_create(memcached_st *ptr); memcached_st *memcached_create(memcached_st *ptr);
void memcached_free(memcached_st *ptr); void memcached_free(memcached_st *ptr);
memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr); memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr);
memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_ length, memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_ length,
time_t expiration); time_t expiration);
memcached_return memcached_increment(memcached_st *ptr, memcached_return memcached_increment(memcached_st *ptr,
skipping to change at line 235 skipping to change at line 241
memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbos ity); memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbos ity);
void memcached_quit(memcached_st *ptr); void memcached_quit(memcached_st *ptr);
char *memcached_strerror(memcached_st *ptr, memcached_return rc); char *memcached_strerror(memcached_st *ptr, memcached_return rc);
memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavi or flag, void *data); memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavi or flag, void *data);
unsigned long long memcached_behavior_get(memcached_st *ptr, memcached_beha vior flag); unsigned long long memcached_behavior_get(memcached_st *ptr, memcached_beha vior flag);
/* All of the functions for adding data to the server */ /* All of the functions for adding data to the server */
memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_len gth, memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_len gth,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_add(memcached_st *ptr, char *key, size_t key_len gth, memcached_return memcached_add(memcached_st *ptr, char *key, size_t key_len gth,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_replace(memcached_st *ptr, char *key, size_t key _length, memcached_return memcached_replace(memcached_st *ptr, char *key, size_t key _length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_append(memcached_st *ptr, memcached_return memcached_append(memcached_st *ptr,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_prepend(memcached_st *ptr, memcached_return memcached_prepend(memcached_st *ptr,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_cas(memcached_st *ptr, memcached_return memcached_cas(memcached_st *ptr,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags, uint32_t flags,
uint64_t cas); uint64_t cas);
/* Get functions */ /* Get functions */
char *memcached_get(memcached_st *ptr, char *key, size_t key_length, char *memcached_get(memcached_st *ptr, char *key, size_t key_length,
size_t *value_length, size_t *value_length,
uint16_t *flags, uint32_t *flags,
memcached_return *error); memcached_return *error);
memcached_return memcached_mget(memcached_st *ptr, memcached_return memcached_mget(memcached_st *ptr,
char **keys, size_t *key_length, char **keys, size_t *key_length,
unsigned int number_of_keys); unsigned int number_of_keys);
char *memcached_fetch(memcached_st *ptr, char *key, size_t *key_length, char *memcached_fetch(memcached_st *ptr, char *key, size_t *key_length,
size_t *value_length, uint16_t *flags, size_t *value_length, uint32_t *flags,
memcached_return *error); memcached_return *error);
memcached_result_st *memcached_fetch_result(memcached_st *ptr, memcached_result_st *memcached_fetch_result(memcached_st *ptr,
memcached_result_st *result, memcached_result_st *result,
memcached_return *error); memcached_return *error);
/* Server Public functions */ /* Server Public functions */
#define memcached_server_count(A) (A)->number_of_hosts #define memcached_server_count(A) (A)->number_of_hosts
#define memcached_server_name(A,B) (B).hostname #define memcached_server_name(A,B) (B).hostname
#define memcached_server_port(A,B) (B).port #define memcached_server_port(A,B) (B).port
#define memcached_server_list(A) (A)->hosts #define memcached_server_list(A) (A)->hosts
#define memcached_server_response_count(A,B) (A)->hosts[B].stack_responses #define memcached_server_response_count(A,B) (A)->hosts[B].cursor_active
memcached_return memcached_server_add_udp(memcached_st *ptr, memcached_return memcached_server_add_udp(memcached_st *ptr,
char *hostname, char *hostname,
unsigned int port); unsigned int port);
memcached_return memcached_server_add_unix_socket(memcached_st *ptr, memcached_return memcached_server_add_unix_socket(memcached_st *ptr,
char *filename); char *filename);
memcached_return memcached_server_add(memcached_st *ptr, char *hostname, memcached_return memcached_server_add(memcached_st *ptr, char *hostname,
unsigned int port); unsigned int port);
void memcached_server_list_free(memcached_server_st *ptr); void memcached_server_list_free(memcached_server_st *ptr);
memcached_return memcached_server_push(memcached_st *ptr, memcached_server_ st *list); memcached_return memcached_server_push(memcached_st *ptr, memcached_server_ st *list);
skipping to change at line 308 skipping to change at line 314
char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *stat, char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *stat,
char *key, memcached_return *error); char *key, memcached_return *error);
char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *stat, char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *stat,
memcached_return *error); memcached_return *error);
char *memcached_get_by_key(memcached_st *ptr, char *memcached_get_by_key(memcached_st *ptr,
char *master_key, size_t master_key_length, char *master_key, size_t master_key_length,
char *key, size_t key_length, char *key, size_t key_length,
size_t *value_length, size_t *value_length,
uint16_t *flags, uint32_t *flags,
memcached_return *error); memcached_return *error);
memcached_return memcached_mget_by_key(memcached_st *ptr, memcached_return memcached_mget_by_key(memcached_st *ptr,
char *master_key, size_t master_key_ length, char *master_key, size_t master_key_ length,
char **keys, size_t *key_length, char **keys, size_t *key_length,
unsigned int number_of_keys); unsigned int number_of_keys);
memcached_return memcached_set_by_key(memcached_st *ptr, memcached_return memcached_set_by_key(memcached_st *ptr,
char *master_key, size_t master_key_l ength, char *master_key, size_t master_key_l ength,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_add_by_key(memcached_st *ptr, memcached_return memcached_add_by_key(memcached_st *ptr,
char *master_key, size_t master_key_l ength, char *master_key, size_t master_key_l ength,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_replace_by_key(memcached_st *ptr, memcached_return memcached_replace_by_key(memcached_st *ptr,
char *master_key, size_t master_k ey_length, char *master_key, size_t master_k ey_length,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_prepend_by_key(memcached_st *ptr, memcached_return memcached_prepend_by_key(memcached_st *ptr,
char *master_key, size_t master_k ey_length, char *master_key, size_t master_k ey_length,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_append_by_key(memcached_st *ptr, memcached_return memcached_append_by_key(memcached_st *ptr,
char *master_key, size_t master_ke y_length, char *master_key, size_t master_ke y_length,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags); uint32_t flags);
memcached_return memcached_cas_by_key(memcached_st *ptr, memcached_return memcached_cas_by_key(memcached_st *ptr,
char *master_key, size_t master_key_l ength, char *master_key, size_t master_key_l ength,
char *key, size_t key_length, char *key, size_t key_length,
char *value, size_t value_length, char *value, size_t value_length,
time_t expiration, time_t expiration,
uint16_t flags, uint32_t flags,
uint64_t cas); uint64_t cas);
memcached_return memcached_delete_by_key(memcached_st *ptr, memcached_return memcached_delete_by_key(memcached_st *ptr,
char *master_key, size_t master_ke y_length, char *master_key, size_t master_ke y_length,
char *key, size_t key_length, char *key, size_t key_length,
time_t expiration); time_t expiration);
memcached_return memcached_mdelete(memcached_st *ptr,
char **key, size_t *key_length,
unsigned int number_of_keys,
time_t expiration);
memcached_return memcached_mdelete_by_key(memcached_st *ptr,
char *master_key, size_t master_k
ey_length,
char **key, size_t *key_length,
unsigned int number_of_keys,
time_t expiration);
memcached_return memcached_fetch_execute(memcached_st *ptr,
unsigned int (*callback[])(mem
cached_st *ptr, memcached_result_st *result, void *context),
void *context,
unsigned int number_of_callbac
ks
);
/* Result Struct */ /* Result Struct */
void memcached_result_free(memcached_result_st *result); void memcached_result_free(memcached_result_st *result);
memcached_result_st *memcached_result_create(memcached_st *ptr, memcached_result_st *memcached_result_create(memcached_st *ptr,
memcached_result_st *result); memcached_result_st *result);
#define memcached_result_key_value(A) A->key #define memcached_result_key_value(A) (A)->key
#define memcached_result_key_length(A) A->key_length #define memcached_result_key_length(A) (A)->key_length
#ifdef FIX #ifdef FIX
#define memcached_result_value(A) memcached_string_value(A->value) #define memcached_result_value(A) memcached_string_value((A)->value)
#define memcached_result_length(A) memcached_string_length(A->value) #define memcached_result_length(A) memcached_string_length((A)->value)
#else #else
char *memcached_result_value(memcached_result_st *ptr); char *memcached_result_value(memcached_result_st *ptr);
size_t memcached_result_length(memcached_result_st *ptr); size_t memcached_result_length(memcached_result_st *ptr);
#endif #endif
#define memcached_result_flags(A) A->flags #define memcached_result_flags(A) (A)->flags
#define memcached_result_cas(A) A->cas #define memcached_result_cas(A) (A)->cas
#ifndef __WATCHPOINT_H__ #ifndef __WATCHPOINT_H__
#define __WATCHPOINT_H__ #define __WATCHPOINT_H__
/* Some personal debugging functions */ /* Some personal debugging functions */
#ifdef HAVE_DEBUG #ifdef HAVE_DEBUG
#define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, _ _LINE__,__func__);fflush(stdout); #define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, _ _LINE__,__func__);fflush(stdout);
#ifdef __MEMCACHED_H__ #ifdef __MEMCACHED_H__
#define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FI LE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); #define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FI LE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout);
#define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\n WATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));ff lush(stdout); #define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\n WATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));ff lush(stdout);
#endif #endif
 End of changes. 30 change blocks. 
27 lines changed or deleted 53 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/