root/src/noit_listener.h

Revision c3c109dfa192ae3441f8a5c1392dad91464f2db9, 3.2 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 1 year ago)

provide a -n argument to skip specified listeners

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  *       notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  *       copyright notice, this list of conditions and the following
13  *       disclaimer in the documentation and/or other materials provided
14  *       with the distribution.
15  *     * Neither the name OmniTI Computer Consulting, Inc. nor the names
16  *       of its contributors may be used to endorse or promote products
17  *       derived from this software without specific prior written
18  *       permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _NOIT_LISTENER_H
34 #define _NOIT_LISTENER_H
35
36 #include "noit_defines.h"
37 #include "eventer/eventer.h"
38 #include "utils/noit_hash.h"
39
40 #include <sys/types.h>
41 #include <sys/socket.h>
42 #ifdef HAVE_SYS_FILIO_H
43 #include <sys/filio.h>
44 #endif
45 #include <netinet/in.h>
46
47 typedef struct {
48   union {
49     struct sockaddr remote_addr;
50     struct sockaddr_in remote_addr4;
51     struct sockaddr_in6 remote_addr6;
52   } remote;
53   char *remote_cn;
54   noit_hash_table *config;
55   void *service_ctx;
56   eventer_func_t dispatch;
57   u_int32_t cmd;
58   int rlen;
59   void (*service_ctx_free)(void *);
60 } acceptor_closure_t;
61
62 typedef struct {
63   int8_t family;
64   unsigned short port;
65   eventer_func_t dispatch_callback;
66   acceptor_closure_t *dispatch_closure;
67   noit_hash_table *sslconfig;
68 } * listener_closure_t;
69
70 API_EXPORT(void) noit_listener_init(const char *toplevel);
71
72 API_EXPORT(void) noit_listener_skip(const char *address, int port);
73
74 API_EXPORT(int)
75   noit_listener(char *host, unsigned short port, int type,
76                 int backlog, noit_hash_table *sslconfig,
77                 noit_hash_table *config,
78                 eventer_func_t handler, void *service_ctx);
79
80 API_EXPORT(void)
81   acceptor_closure_free(acceptor_closure_t *ac);
82
83 API_EXPORT(void)
84   noit_control_dispatch_delegate(eventer_func_t listener_dispatch,
85                                  u_int32_t cmd,
86                                  eventer_func_t delegate_dispatch);
87
88 API_EXPORT(int)
89   noit_control_dispatch(eventer_t, int, void *, struct timeval *);
90
91 API_EXPORT(int)
92   noit_convert_sockaddr_to_buff(char *, int, struct sockaddr *);
93
94 API_EXPORT(noit_hash_table *)
95   noit_listener_commands();
96
97 #endif
Note: See TracBrowser for help on using the browser.