memcached.h   memcached.h 
skipping to change at line 13 skipping to change at line 13
* Description: main include file for libmemcached * Description: main include file for libmemcached
* *
* 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 <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <limits.h>
#include <assert.h>
#include <time.h>
#include <errno.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_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 8196
#define MEMCACHED_MAX_BUFFER 8196 #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,
MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_UNKNOWN_READ_FAILURE,
skipping to change at line 70 skipping to change at line 59
MEMCACHED_STORED, MEMCACHED_STORED,
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_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_MD5_HASHING,
MEMCACHED_BEHAVIOR_KETAMA, MEMCACHED_BEHAVIOR_KETAMA,
MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
} memcached_behavior; } memcached_behavior;
typedef enum { typedef enum {
MEMCACHED_NOT_ALLOCATED= 0, MEMCACHED_NOT_ALLOCATED= 0,
MEMCACHED_ALLOCATED= 1, MEMCACHED_ALLOCATED= 1,
} 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 cursor_active;
}; };
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 139 skipping to change at line 133
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 my_errno;
unsigned int stack_responses;
unsigned long long flags; unsigned long long flags;
int send_size;
int recv_size;
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_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 199 skipping to change at line 194
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);
/* 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
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);
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);
void memcached_server_list_free(memcached_server_st *ptr);
memcached_return memcached_server_push(memcached_st *ptr, memcached_server_
st *list);
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);
/* String Struct */
#define memcached_string_length(A, B) (size_t)(B->end - B->string)
#define memcached_string_size(A, B) B->current_size
#define memcached_string_value(A, B) B->string
memcached_string_st *memcached_string_create(memcached_st *ptr, size_t init
ial_size);
memcached_return memcached_string_append_character(memcached_st *ptr,
memcached_string_st *str
ing,
char character);
memcached_return memcached_string_append(memcached_st *ptr, memcached_strin
g_st *string,
char *value, size_t length);
size_t memcached_string_backspace(memcached_st *ptr, memcached_string_st *s
tring, size_t remove);
memcached_return memcached_string_reset(memcached_st *ptr, memcached_string
_st *string);
void memcached_string_free(memcached_st *ptr, memcached_string_st *string);
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);
/* Some personal debugging functions */ /* Some personal debugging functions */
#define WATCHPOINT printf("\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,_ _func__);fflush(stdout); #define WATCHPOINT printf("\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,_ _func__);fflush(stdout);
#define WATCHPOINT_ERROR(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __L INE__, memcached_strerror(NULL, A));fflush(stdout); #define WATCHPOINT_ERROR(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __L INE__, memcached_strerror(NULL, A));fflush(stdout);
#define WATCHPOINT_STRING(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __ #define WATCHPOINT_STRING(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE_
LINE__, A);fflush(stdout); _, __LINE__,__func__,A);fflush(stdout);
#define WATCHPOINT_NUMBER(A) printf("\nWATCHPOINT %s:%d %d\n", __FILE__, __ #define WATCHPOINT_NUMBER(A) printf("\nWATCHPOINT %s:%d (%s) %d\n", __FILE_
LINE__, A);fflush(stdout); _, __LINE__,__func__,A);fflush(stdout);
#define WATCHPOINT_ERRNO(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __L #define WATCHPOINT_ERRNO(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE__
INE__, strerror(A));A= 0;fflush(stdout); , __LINE__,__func__, strerror(A));A= 0;fflush(stdout);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __MEMCACHED_H__ */ #endif /* __MEMCACHED_H__ */
 End of changes. 13 change blocks. 
43 lines changed or deleted 19 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/