ks_common.h File Reference

common definitions for libkarmaclient. More...

#include "ks_malloc.h"

Go to the source code of this file.

Data Structures

struct  _ks_type_t
 libkarmaclient's type info type. More...
struct  _ks_base_t
 libkarmaclient's base type. More...

Defines

#define KS_CAST(t, v)

Typedefs

typedef _ks_base_t ks_base_t
 libkarmaclient's base type
typedef _ks_string_t ks_string_t
 libkarmaclient's string type
typedef void(*) ks_destroy_t (ks_base_t *)
 Destructor function type.
typedef void(*) ks_bappend_t (ks_string_t *, ks_base_t *)
 Bencode appender function type.
typedef _ks_type_t ks_type_t
 libkarmaclient's type info type.
typedef void(*) ks_error_handler_t (const char *)
 libkarmaclient's error handler function type.

Functions

void ks_error_handler_set (ks_error_handler_t)
void ks_error (const char *,...)


Detailed Description

common definitions for libkarmaclient.

Definition in file ks_common.h.


Define Documentation

#define KS_CAST ( t,
 ) 

Value:

((t ## _t *)                    (                               ((v)->type == t ## _type())                                     ? (v)                                   : ks_cast_error(#t, v)                  )               )

Definition at line 115 of file ks_common.h.

Referenced by ks_assoc_keys(), ks_combination_data(), ks_combination_score(), ks_fact_data(), ks_fact_feed(), ks_fact_identity(), ks_fact_value(), ks_response_bparse(), ks_response_combination(), ks_response_combinations(), ks_response_id(), ks_response_message(), and ks_response_time().


Typedef Documentation

typedef void(*) ks_bappend_t(ks_string_t *, ks_base_t *)

Bencode appender function type.

Definition at line 49 of file ks_common.h.

typedef struct _ks_base_t ks_base_t

libkarmaclient's base type

Definition at line 34 of file ks_common.h.

typedef void(*) ks_destroy_t(ks_base_t *)

Destructor function type.

Definition at line 44 of file ks_common.h.

typedef void(*) ks_error_handler_t(const char *)

libkarmaclient's error handler function type.

Definition at line 95 of file ks_common.h.

typedef struct _ks_string_t ks_string_t

libkarmaclient's string type

Definition at line 39 of file ks_common.h.

typedef struct _ks_type_t ks_type_t

libkarmaclient's type info type.


Function Documentation

void ks_error ( const char *  format,
  ... 
)

Passes an error on to the error handler, after expansion. See printf for a list of expansion tokens.

Parameters:
format The format string.
Returns:
nothing

Definition at line 72 of file ks_error.c.

References KS_ERRBUFSIZ, and KS_ERRTAG.

Referenced by ks_response_bparse(), ks_socket_connect(), ks_socket_new(), ks_socket_recv(), and ks_socket_send().

void ks_error_handler_set ( ks_error_handler_t  handler  ) 

Set the error handler which protocol errors will be delivered to.

Parameters:
handler A pointer to a function to be passed error messages.
Returns:
nothing

Definition at line 58 of file ks_error.c.


Generated on Wed May 9 01:01:57 2007 for libkarmaclient by  doxygen 1.5.1