root/src/noit_listener.h

Revision db9d1c2db7c42ea70190db97aab99fd029180d11, 1.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

Fixed up and working. Tested with:

(perl -e '$| = 0; print pack("N", 0xca4aca4a);'; sleep 1) | openssl s_client -connect localhost:34332
  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  */
5
6 #ifndef _NOIT_LISTENER_H
7 #define _NOIT_LISTENER_H
8
9 #include "noit_defines.h"
10 #include "eventer/eventer.h"
11 #include "utils/noit_hash.h"
12
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <sys/ioctl.h>
16 #ifdef HAVE_SYS_FILIO_H
17 #include <sys/filio.h>
18 #endif
19 #include <netinet/in.h>
20
21 typedef struct {
22   union {
23     struct sockaddr remote_addr;
24     struct sockaddr_in remote_addr4;
25     struct sockaddr_in6 remote_addr6;
26   } remote;
27   char *remote_cn;
28   noit_hash_table *config;
29   void *service_ctx;
30   eventer_func_t dispatch;
31 } acceptor_closure_t;
32
33 typedef struct {
34   int8_t family;
35   unsigned short port;
36   eventer_func_t dispatch_callback;
37   acceptor_closure_t *dispatch_closure;
38   noit_hash_table *sslconfig;
39 } * listener_closure_t;
40
41 API_EXPORT(void) noit_listener_init(const char *toplevel);
42
43 API_EXPORT(int)
44   noit_listener(char *host, unsigned short port, int type,
45                 int backlog, noit_hash_table *sslconfig,
46                 noit_hash_table *config,
47                 eventer_func_t handler, void *service_ctx);
48
49 API_EXPORT(void)
50   acceptor_closure_free(acceptor_closure_t *ac);
51
52 API_EXPORT(void)
53   noit_control_dispatch_delegate(eventer_func_t listener_dispatch,
54                                  u_int32_t cmd,
55                                  eventer_func_t delegate_dispatch);
56
57 API_EXPORT(int)
58   noit_control_dispatch(eventer_t, int, void *, struct timeval *);
59
60 API_EXPORT(noit_hash_table *)
61   noit_listener_commands();
62
63 #endif
Note: See TracBrowser for help on using the browser.