nginx/src/event/ngx_event_connect.h

76 lines
1.8 KiB
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
2003-05-12 23:52:24 +08:00
#ifndef _NGX_EVENT_CONNECT_H_INCLUDED_
#define _NGX_EVENT_CONNECT_H_INCLUDED_
#include <ngx_config.h>
2003-07-21 05:15:59 +08:00
#include <ngx_core.h>
2003-05-12 23:52:24 +08:00
#include <ngx_event.h>
#define NGX_PEER_KEEPALIVE 1
#define NGX_PEER_NEXT 2
#define NGX_PEER_FAILED 4
2006-12-05 00:46:13 +08:00
typedef struct ngx_peer_connection_s ngx_peer_connection_t;
typedef ngx_int_t (*ngx_event_get_peer_pt)(ngx_peer_connection_t *pc,
void *data);
typedef void (*ngx_event_free_peer_pt)(ngx_peer_connection_t *pc, void *data,
ngx_uint_t state);
#if (NGX_SSL)
typedef ngx_int_t (*ngx_event_set_peer_session_pt)(ngx_peer_connection_t *pc,
void *data);
typedef void (*ngx_event_save_peer_session_pt)(ngx_peer_connection_t *pc,
void *data);
#endif
2006-12-05 00:46:13 +08:00
struct ngx_peer_connection_s {
ngx_connection_t *connection;
2006-12-05 00:46:13 +08:00
struct sockaddr *sockaddr;
socklen_t socklen;
ngx_str_t *name;
2006-12-05 00:46:13 +08:00
ngx_uint_t tries;
2006-12-05 00:46:13 +08:00
ngx_event_get_peer_pt get;
ngx_event_free_peer_pt free;
void *data;
2006-12-05 00:46:13 +08:00
#if (NGX_SSL)
ngx_event_set_peer_session_pt set_session;
ngx_event_save_peer_session_pt save_session;
2006-12-05 00:46:13 +08:00
#endif
2003-07-21 05:15:59 +08:00
2004-07-05 23:08:23 +08:00
#if (NGX_THREADS)
ngx_atomic_t *lock;
2004-07-05 23:08:23 +08:00
#endif
2003-07-22 00:24:25 +08:00
ngx_addr_t *local;
int rcvbuf;
ngx_log_t *log;
2003-07-23 03:53:10 +08:00
unsigned cached:1;
2003-08-01 22:56:33 +08:00
/* ngx_connection_log_error_e */
unsigned log_error:2;
2006-12-05 00:46:13 +08:00
};
2003-05-12 23:52:24 +08:00
ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc);
2006-12-05 00:46:13 +08:00
ngx_int_t ngx_event_get_peer(ngx_peer_connection_t *pc, void *data);
2003-10-02 13:39:37 +08:00
2003-05-12 23:52:24 +08:00
#endif /* _NGX_EVENT_CONNECT_H_INCLUDED_ */