memcached.h   memcached.h 
skipping to change at line 23 skipping to change at line 23
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.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_string_st memcached_string_st; typedef struct memcached_string_st memcached_string_st;
typedef struct memcached_server_st memcached_server_st; typedef struct memcached_server_st memcached_server_st;
#define MEMCACHED_DEFAULT_PORT 11211 #define MEMCACHED_DEFAULT_PORT 11211
#define MEMCACHED_DEFAULT_COMMAND_SIZE 350 #define MEMCACHED_DEFAULT_COMMAND_SIZE 350
#define SMALL_STRING_LEN 1024 #define SMALL_STRING_LEN 1024
#define HUGE_STRING_LEN 8196 #define HUGE_STRING_LEN 8196
#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
//#define MEMCACHED_MAX_BUFFER 8196
#define MEMCACHED_MAX_BUFFER HUGE_STRING_LEN #define MEMCACHED_MAX_BUFFER HUGE_STRING_LEN
typedef enum { typedef enum {
MEMCACHED_SUCCESS, MEMCACHED_SUCCESS,
MEMCACHED_FAILURE, MEMCACHED_FAILURE,
MEMCACHED_HOST_LOCKUP_FAILURE, MEMCACHED_HOST_LOCKUP_FAILURE,
MEMCACHED_CONNECTION_FAILURE, MEMCACHED_CONNECTION_FAILURE,
MEMCACHED_CONNECTION_BIND_FAILURE, MEMCACHED_CONNECTION_BIND_FAILURE,
MEMCACHED_WRITE_FAILURE, MEMCACHED_WRITE_FAILURE,
MEMCACHED_READ_FAILURE, MEMCACHED_READ_FAILURE,
skipping to change at line 61 skipping to change at line 61
MEMCACHED_NOTFOUND, MEMCACHED_NOTFOUND,
MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_MEMORY_ALLOCATION_FAILURE,
MEMCACHED_PARTIAL_READ, MEMCACHED_PARTIAL_READ,
MEMCACHED_SOME_ERRORS, MEMCACHED_SOME_ERRORS,
MEMCACHED_NO_SERVERS, MEMCACHED_NO_SERVERS,
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_NOT_SUPPORTED,
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_BEHAVIOR_NO_BLOCK, MEMCACHED_BEHAVIOR_NO_BLOCK,
MEMCACHED_BEHAVIOR_TCP_NODELAY, MEMCACHED_BEHAVIOR_TCP_NODELAY,
MEMCACHED_BEHAVIOR_MD5_HASHING, 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; } memcached_behavior;
typedef enum { typedef enum {
MEMCACHED_NOT_ALLOCATED= 0, MEMCACHED_HASH_DEFAULT= 0,
MEMCACHED_ALLOCATED= 1, MEMCACHED_HASH_MD5,
MEMCACHED_HASH_CRC,
MEMCACHED_HASH_FNV1_64,
MEMCACHED_HASH_FNV1A_64,
MEMCACHED_HASH_FNV1_32,
MEMCACHED_HASH_FNV1A_32,
MEMCACHED_HASH_KETAMA,
} memcached_hash;
typedef enum {
MEMCACHED_CONNECTION_UNKNOWN,
MEMCACHED_CONNECTION_TCP,
MEMCACHED_CONNECTION_UDP,
MEMCACHED_CONNECTION_UNIX_SOCKET,
} memcached_connection;
typedef enum {
MEMCACHED_NOT_ALLOCATED,
MEMCACHED_ALLOCATED,
} memcached_allocated; } memcached_allocated;
struct memcached_server_st { struct memcached_server_st {
char *hostname; char *hostname;
unsigned int port; unsigned int port;
int fd; int fd;
unsigned int stack_responses; unsigned int stack_responses;
unsigned int cursor_active; unsigned int cursor_active;
memcached_connection type;
}; };
struct memcached_stat_st { struct memcached_stat_st {
unsigned int pid; unsigned int pid;
unsigned int uptime; unsigned int uptime;
unsigned int threads; unsigned int threads;
time_t time; time_t time;
char version[8]; char version[8];
unsigned int pointer_size; unsigned int pointer_size;
unsigned int rusage_user; unsigned int rusage_user;
skipping to change at line 116 skipping to change at line 137
unsigned long long cmd_set; unsigned long long cmd_set;
unsigned long long get_hits; unsigned long long get_hits;
unsigned long long get_misses; unsigned long long get_misses;
unsigned long long evictions; unsigned long long evictions;
unsigned long long bytes_read; unsigned long long bytes_read;
unsigned long long bytes_written; unsigned long long bytes_written;
unsigned int limit_maxbytes; unsigned int limit_maxbytes;
}; };
struct memcached_string_st { struct memcached_string_st {
memcached_st *root;
memcached_allocated is_allocated;
char *string; char *string;
char *end; char *end;
size_t current_size; size_t current_size;
size_t block_size; size_t block_size;
}; };
struct memcached_result_st {
memcached_allocated is_allocated;
memcached_st *root;
char key[MEMCACHED_MAX_KEY];
size_t key_length;
memcached_string_st value;
uint16_t flags;
uint64_t cas;
};
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 read_buffer[MEMCACHED_MAX_BUFFER]; char read_buffer[MEMCACHED_MAX_BUFFER];
size_t read_buffer_length; size_t read_buffer_length;
char *read_ptr; char *read_ptr;
char write_buffer[MEMCACHED_MAX_BUFFER]; char write_buffer[MEMCACHED_MAX_BUFFER];
size_t write_buffer_offset; size_t write_buffer_offset;
char connected; char connected;
int my_errno; int cached_errno;
unsigned long long flags; unsigned long long flags;
int send_size; int send_size;
int recv_size; int recv_size;
memcached_string_st result_buffer;
memcached_hash hash;
memcached_return warning; /* Future Use */ memcached_return warning; /* Future Use */
}; };
/* 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,
char *key, size_t key_length, char *key, size_t key_length,
unsigned int offset, unsigned int offset,
unsigned int *value); unsigned int *value);
memcached_return memcached_decrement(memcached_st *ptr, memcached_return memcached_decrement(memcached_st *ptr,
char *key, size_t key_length, char *key, size_t key_length,
unsigned int offset, unsigned int offset,
unsigned int *value); unsigned int *value);
void memcached_stat_free(memcached_st *, memcached_stat_st *);
memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_ return *error); memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_ return *error);
memcached_return memcached_stat_servername(memcached_stat_st *stat, char *a rgs, memcached_return memcached_stat_servername(memcached_stat_st *stat, char *a rgs,
char *hostname, unsigned int por t); char *hostname, unsigned int por t);
memcached_return memcached_flush(memcached_st *ptr, time_t expiration); memcached_return memcached_flush(memcached_st *ptr, time_t expiration);
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);
skipping to change at line 190 skipping to change at line 226
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, uint16_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, uint16_t *flags,
memcached_return *error); memcached_return *error);
memcached_result_st *memcached_fetch_result(memcached_st *ptr,
memcached_result_st *result,
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].stack_responses
memcached_return memcached_server_add_unix_socket(memcached_st *ptr,
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);
memcached_server_st *memcached_server_list_append(memcached_server_st *ptr, memcached_server_st *memcached_server_list_append(memcached_server_st *ptr,
char *hostname, unsigned int p ort, char *hostname, unsigned int p ort,
memcached_return *error); memcached_return *error);
unsigned int memcached_server_list_count(memcached_server_st *ptr); unsigned int memcached_server_list_count(memcached_server_st *ptr);
memcached_server_st *memcached_servers_parse(char *server_strings); memcached_server_st *memcached_servers_parse(char *server_strings);
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);
/* Result Struct */
void memcached_result_free(memcached_result_st *result);
memcached_result_st *memcached_result_create(memcached_st *ptr,
memcached_result_st *result);
#define memcached_result_key_value(A) A->key
#define memcached_result_key_length(A) A->key_length
#ifdef FIX
#define memcached_result_value(A) memcached_string_value(A->value)
#define memcached_result_length(A) memcached_string_length(A->value)
#else
char *memcached_result_value(memcached_result_st *ptr);
size_t memcached_result_length(memcached_result_st *ptr);
#endif
#define memcached_result_flags(A) A->flags
#define memcached_result_cas(A) A->cas
#ifndef __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__
#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);
#endif
#define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n" , __FILE__, __LINE__,__func__,A);fflush(stdout); #define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n" , __FILE__, __LINE__,__func__,A);fflush(stdout);
#define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n ", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout); #define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n ", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout);
#define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));A= 0;fflush(stdout); #define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));A= 0;fflush(stdout);
#define WATCHPOINT_ASSERT(A) assert((A)); #define WATCHPOINT_ASSERT(A) assert((A));
#else #else
/* /*
#define WATCHPOINT { 1; }; #define WATCHPOINT { 1; };
#define WATCHPOINT_ERROR(A) { 1; }; #define WATCHPOINT_ERROR(A) { 1; };
#define WATCHPOINT_STRING(A) { 1; }; #define WATCHPOINT_STRING(A) { 1; };
#define WATCHPOINT_NUMBER(A) { 1; }; #define WATCHPOINT_NUMBER(A) { 1; };
#define WATCHPOINT_ERRNO(A) { 1; }; #define WATCHPOINT_ERRNO(A) { 1; };
#define WATCHPOINT_ASSERT(A) { 1; }; #define WATCHPOINT_ASSERT(A) { 1; };
*/ */
#define WATCHPOINT #define WATCHPOINT
#ifdef __MEMCACHED_H__
#define WATCHPOINT_ERROR(A) #define WATCHPOINT_ERROR(A)
#endif
#define WATCHPOINT_STRING(A) #define WATCHPOINT_STRING(A)
#define WATCHPOINT_NUMBER(A) #define WATCHPOINT_NUMBER(A)
#define WATCHPOINT_ERRNO(A) #define WATCHPOINT_ERRNO(A)
#define WATCHPOINT_ASSERT(A) #define WATCHPOINT_ASSERT(A)
#endif #endif
#endif /* __WATCHPOINT_H__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __MEMCACHED_H__ */ #endif /* __MEMCACHED_H__ */
 End of changes. 19 change blocks. 
5 lines changed or deleted 70 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/