Gearman Developer Documentation

Connection Handling

Data Structures

struct  gearman_con_st

Modules

 Private Connection Functions

Enumerations

enum  gearman_con_options_t {
  GEARMAN_CON_ALLOCATED = (1 << 0), GEARMAN_CON_READY = (1 << 1), GEARMAN_CON_PACKET_IN_USE = (1 << 2), GEARMAN_CON_EXTERNAL_FD = (1 << 3),
  GEARMAN_CON_IGNORE_LOST_CONNECTION = (1 << 4), GEARMAN_CON_CLOSE_AFTER_FLUSH = (1 << 5)
}
enum  gearman_con_state_t { GEARMAN_CON_STATE_ADDRINFO, GEARMAN_CON_STATE_CONNECT, GEARMAN_CON_STATE_CONNECTING, GEARMAN_CON_STATE_CONNECTED }
enum  gearman_con_send_state_t {
  GEARMAN_CON_SEND_STATE_NONE, GEARMAN_CON_SEND_STATE_PRE_FLUSH, GEARMAN_CON_SEND_STATE_FORCE_FLUSH, GEARMAN_CON_SEND_STATE_FLUSH,
  GEARMAN_CON_SEND_STATE_FLUSH_DATA
}
enum  gearman_con_recv_state_t { GEARMAN_CON_RECV_STATE_NONE, GEARMAN_CON_RECV_STATE_READ, GEARMAN_CON_RECV_STATE_READ_DATA }

Functions

void gearman_con_set_host (gearman_con_st *con, const char *host)
void gearman_con_set_port (gearman_con_st *con, in_port_t port)
gearman_con_options_t gearman_con_options (const gearman_con_st *con)
void gearman_con_set_options (gearman_con_st *con, gearman_con_options_t options)
void gearman_con_add_options (gearman_con_st *con, gearman_con_options_t options)
void gearman_con_remove_options (gearman_con_st *con, gearman_con_options_t options)
gearman_return_t gearman_con_set_fd (gearman_con_st *con, int fd)
void * gearman_con_context (const gearman_con_st *con)
void gearman_con_set_context (gearman_con_st *con, const void *context)
gearman_return_t gearman_con_connect (gearman_con_st *con)
void gearman_con_close (gearman_con_st *con)
void gearman_con_reset_addrinfo (gearman_con_st *con)
gearman_return_t gearman_con_send (gearman_con_st *con, const gearman_packet_st *packet, bool flush)
size_t gearman_con_send_data (gearman_con_st *con, const void *data, size_t data_size, gearman_return_t *ret_ptr)
gearman_return_t gearman_con_flush (gearman_con_st *con)
gearman_packet_st * gearman_con_recv (gearman_con_st *con, gearman_packet_st *packet, gearman_return_t *ret_ptr, bool recv_data)
size_t gearman_con_recv_data (gearman_con_st *con, void *data, size_t data_size, gearman_return_t *ret_ptr)
size_t gearman_con_read (gearman_con_st *con, void *data, size_t data_size, gearman_return_t *ret_ptr)
gearman_return_t gearman_con_set_events (gearman_con_st *con, short events)
gearman_return_t gearman_con_set_revents (gearman_con_st *con, short revents)
void * gearman_con_protocol_context (const gearman_con_st *con)
void gearman_con_set_protocol_context (gearman_con_st *con, const void *context)
void gearman_con_set_protocol_context_free_fn (gearman_con_st *con, gearman_con_protocol_context_free_fn *function)
void gearman_con_set_packet_pack_fn (gearman_con_st *con, gearman_packet_pack_fn *function)
void gearman_con_set_packet_unpack_fn (gearman_con_st *con, gearman_packet_unpack_fn *function)

Detailed Description

This is a low level interface for gearman connections. This is used internally by both client and worker interfaces, so you probably want to look there first. This is usually used to write lower level clients, workers, proxies, or your own server.


Enumeration Type Documentation

Options for gearman_con_st.

Enumerator:
GEARMAN_CON_ALLOCATED 
GEARMAN_CON_READY 
GEARMAN_CON_PACKET_IN_USE 
GEARMAN_CON_EXTERNAL_FD 
GEARMAN_CON_IGNORE_LOST_CONNECTION 
GEARMAN_CON_CLOSE_AFTER_FLUSH 

Definition at line 139 of file constants.h.

States for gearman_con_st.

Enumerator:
GEARMAN_CON_STATE_ADDRINFO 
GEARMAN_CON_STATE_CONNECT 
GEARMAN_CON_STATE_CONNECTING 
GEARMAN_CON_STATE_CONNECTED 

Definition at line 153 of file constants.h.

Send states for gearman_con_st.

Enumerator:
GEARMAN_CON_SEND_STATE_NONE 
GEARMAN_CON_SEND_STATE_PRE_FLUSH 
GEARMAN_CON_SEND_STATE_FORCE_FLUSH 
GEARMAN_CON_SEND_STATE_FLUSH 
GEARMAN_CON_SEND_STATE_FLUSH_DATA 

Definition at line 165 of file constants.h.

Recv states for gearman_con_st.

Enumerator:
GEARMAN_CON_RECV_STATE_NONE 
GEARMAN_CON_RECV_STATE_READ 
GEARMAN_CON_RECV_STATE_READ_DATA 

Definition at line 178 of file constants.h.


Function Documentation

void gearman_con_set_host ( gearman_con_st *  con,
const char *  host 
)

Set host for a connection.

Definition at line 37 of file conn.c.

void gearman_con_set_port ( gearman_con_st *  con,
in_port_t  port 
)

Set port for a connection.

Definition at line 46 of file conn.c.

gearman_con_options_t gearman_con_options ( const gearman_con_st *  con  ) 

Get options for a connection.

Definition at line 53 of file conn.c.

void gearman_con_set_options ( gearman_con_st *  con,
gearman_con_options_t  options 
)

Set options for a connection.

Definition at line 58 of file conn.c.

void gearman_con_add_options ( gearman_con_st *  con,
gearman_con_options_t  options 
)

Add options for a connection.

Definition at line 64 of file conn.c.

void gearman_con_remove_options ( gearman_con_st *  con,
gearman_con_options_t  options 
)

Remove options for a connection.

Definition at line 70 of file conn.c.

gearman_return_t gearman_con_set_fd ( gearman_con_st *  con,
int  fd 
)

Set connection to an already open file descriptor.

Definition at line 76 of file conn.c.

void* gearman_con_context ( const gearman_con_st *  con  ) 

Get application context pointer.

Definition at line 94 of file conn.c.

void gearman_con_set_context ( gearman_con_st *  con,
const void *  context 
)

Set application context pointer.

Definition at line 99 of file conn.c.

gearman_return_t gearman_con_connect ( gearman_con_st *  con  ) 

Connect to server.

Definition at line 104 of file conn.c.

void gearman_con_close ( gearman_con_st *  con  ) 

Close a connection.

Definition at line 109 of file conn.c.

void gearman_con_reset_addrinfo ( gearman_con_st *  con  ) 

Clear address info, freeing structs if needed.

Definition at line 137 of file conn.c.

gearman_return_t gearman_con_send ( gearman_con_st *  con,
const gearman_packet_st *  packet,
bool  flush 
)

Send packet to a connection.

Definition at line 148 of file conn.c.

size_t gearman_con_send_data ( gearman_con_st *  con,
const void *  data,
size_t  data_size,
gearman_return_t *  ret_ptr 
)

Send packet data to a connection.

Definition at line 288 of file conn.c.

gearman_return_t gearman_con_flush ( gearman_con_st *  con  ) 

Flush the send buffer.

Definition at line 311 of file conn.c.

gearman_packet_st* gearman_con_recv ( gearman_con_st *  con,
gearman_packet_st *  packet,
gearman_return_t *  ret_ptr,
bool  recv_data 
)

Receive packet from a connection.

Definition at line 528 of file conn.c.

size_t gearman_con_recv_data ( gearman_con_st *  con,
void *  data,
size_t  data_size,
gearman_return_t *  ret_ptr 
)

Receive packet data from a connection.

Definition at line 645 of file conn.c.

size_t gearman_con_read ( gearman_con_st *  con,
void *  data,
size_t  data_size,
gearman_return_t *  ret_ptr 
)

Read data from a connection.

Definition at line 693 of file conn.c.

gearman_return_t gearman_con_set_events ( gearman_con_st *  con,
short  events 
)

Set events to be watched for a connection.

Definition at line 761 of file conn.c.

gearman_return_t gearman_con_set_revents ( gearman_con_st *  con,
short  revents 
)

Set events that are ready for a connection. This is used with the external event callbacks.

Definition at line 784 of file conn.c.

void* gearman_con_protocol_context ( const gearman_con_st *  con  ) 

Get protocol context pointer.

Definition at line 814 of file conn.c.

void gearman_con_set_protocol_context ( gearman_con_st *  con,
const void *  context 
)

Set protocol context pointer.

Definition at line 819 of file conn.c.

void gearman_con_set_protocol_context_free_fn ( gearman_con_st *  con,
gearman_con_protocol_context_free_fn *  function 
)

Set function to call when protocol_data should be freed.

Definition at line 824 of file conn.c.

void gearman_con_set_packet_pack_fn ( gearman_con_st *  con,
gearman_packet_pack_fn *  function 
)

Set custom packet_pack function

Definition at line 830 of file conn.c.

void gearman_con_set_packet_unpack_fn ( gearman_con_st *  con,
gearman_packet_unpack_fn *  function 
)

Set custom packet_unpack function

Definition at line 836 of file conn.c.


Generated on Tue Oct 13 20:19:22 2009 by  doxygen 1.6.1