~nginx/nginx/1.0

« back to all changes in this revision

Viewing changes to src/event/ngx_event_connect.h

  • Committer: Michael Lustfield
  • Date: 2010-12-01 08:06:25 UTC
  • Revision ID: michael@profarius.com-20101201080625-y8i4bq0e54ev2qwy
Tags: 0.9.0
Nginx v0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * Copyright (C) Igor Sysoev
 
4
 */
 
5
 
 
6
 
 
7
#ifndef _NGX_EVENT_CONNECT_H_INCLUDED_
 
8
#define _NGX_EVENT_CONNECT_H_INCLUDED_
 
9
 
 
10
 
 
11
#include <ngx_config.h>
 
12
#include <ngx_core.h>
 
13
#include <ngx_event.h>
 
14
 
 
15
 
 
16
#define NGX_PEER_KEEPALIVE           1
 
17
#define NGX_PEER_NEXT                2
 
18
#define NGX_PEER_FAILED              4
 
19
 
 
20
 
 
21
typedef struct ngx_peer_connection_s  ngx_peer_connection_t;
 
22
 
 
23
typedef ngx_int_t (*ngx_event_get_peer_pt)(ngx_peer_connection_t *pc,
 
24
    void *data);
 
25
typedef void (*ngx_event_free_peer_pt)(ngx_peer_connection_t *pc, void *data,
 
26
    ngx_uint_t state);
 
27
#if (NGX_SSL)
 
28
 
 
29
typedef ngx_int_t (*ngx_event_set_peer_session_pt)(ngx_peer_connection_t *pc,
 
30
    void *data);
 
31
typedef void (*ngx_event_save_peer_session_pt)(ngx_peer_connection_t *pc,
 
32
    void *data);
 
33
#endif
 
34
 
 
35
 
 
36
struct ngx_peer_connection_s {
 
37
    ngx_connection_t                *connection;
 
38
 
 
39
    struct sockaddr                 *sockaddr;
 
40
    socklen_t                        socklen;
 
41
    ngx_str_t                       *name;
 
42
 
 
43
    ngx_uint_t                       tries;
 
44
 
 
45
    ngx_event_get_peer_pt            get;
 
46
    ngx_event_free_peer_pt           free;
 
47
    void                            *data;
 
48
 
 
49
#if (NGX_SSL)
 
50
    ngx_event_set_peer_session_pt    set_session;
 
51
    ngx_event_save_peer_session_pt   save_session;
 
52
#endif
 
53
 
 
54
#if (NGX_THREADS)
 
55
    ngx_atomic_t                    *lock;
 
56
#endif
 
57
 
 
58
    ngx_addr_t                      *local;
 
59
 
 
60
    int                              rcvbuf;
 
61
 
 
62
    ngx_log_t                       *log;
 
63
 
 
64
    unsigned                         cached:1;
 
65
 
 
66
                                     /* ngx_connection_log_error_e */
 
67
    unsigned                         log_error:2;
 
68
};
 
69
 
 
70
 
 
71
ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc);
 
72
ngx_int_t ngx_event_get_peer(ngx_peer_connection_t *pc, void *data);
 
73
 
 
74
 
 
75
#endif /* _NGX_EVENT_CONNECT_H_INCLUDED_ */