Electroneum
remote.h
Go to the documentation of this file.
1 /*
2  * daemon/remote.h - remote control for the unbound daemon.
3  *
4  * Copyright (c) 2008, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
46 #ifndef DAEMON_REMOTE_H
47 #define DAEMON_REMOTE_H
48 #ifdef HAVE_OPENSSL_SSL_H
49 #include "openssl/ssl.h"
50 #endif
51 struct config_file;
52 struct listen_list;
53 struct listen_port;
54 struct worker;
55 struct comm_reply;
56 struct comm_point;
57 struct daemon_remote;
58 
60 #define REMOTE_CONTROL_TCP_TIMEOUT 120000
61 
65 struct rc_state {
67  struct rc_state* next;
69  struct comm_point* c;
72 #ifdef HAVE_SSL
73 
74  SSL* ssl;
75 #endif
76 
77  int fd;
79  struct daemon_remote* rc;
80 };
81 
89 struct daemon_remote {
91  struct worker* worker;
94  /* if certificates are used */
95  int use_cert;
97  int active;
102 #ifdef HAVE_SSL
103 
104  SSL_CTX* ctx;
105 #endif
106 };
107 
112 #ifdef HAVE_SSL
113 
114  SSL* ssl;
115 #endif
116 
117  int fd;
118 };
119 typedef struct remote_stream RES;
120 
126 struct daemon_remote* daemon_remote_create(struct config_file* cfg);
127 
132 void daemon_remote_delete(struct daemon_remote* rc);
133 
139 void daemon_remote_clear(struct daemon_remote* rc);
140 
148 
157  struct listen_port* ports, struct worker* worker);
158 
164 
170 
175 void daemon_remote_exec(struct worker* worker);
176 
177 #ifdef HAVE_SSL
178 
184 int ssl_print_text(RES* ssl, const char* text);
185 
192 int ssl_printf(RES* ssl, const char* format, ...)
193  ATTR_FORMAT(printf, 2, 3);
194 
203 int ssl_read_line(RES* ssl, char* buf, size_t max);
204 #endif /* HAVE_SSL */
205 
206 #endif /* DAEMON_REMOTE_H */
struct daemon_remote * rc
Definition: remote.h:79
int max_active
Definition: remote.h:99
void daemon_remote_delete(struct daemon_remote *rc)
void daemon_remote_clear(struct daemon_remote *rc)
void daemon_remote_stop_accept(struct daemon_remote *rc)
struct comm_point * c
Definition: remote.h:69
int daemon_remote_open_accept(struct daemon_remote *rc, struct listen_port *ports, struct worker *worker)
int use_cert
Definition: remote.h:95
int active
Definition: remote.h:97
struct listen_list * accept_list
Definition: remote.h:93
struct rc_state * next
Definition: remote.h:67
struct worker * worker
Definition: remote.h:91
struct rc_state * busy_list
Definition: remote.h:101
void * ssl
Definition: netevent.h:191
struct listen_port * daemon_remote_open_ports(struct config_file *cfg)
void daemon_remote_start_accept(struct daemon_remote *rc)
const char * buf
Definition: slow_memmem.cpp:74
void daemon_remote_exec(struct worker *worker)
enum rc_state::@40 shake_state
struct daemon_remote * daemon_remote_create(struct config_file *cfg)
Definition: worker.h:82
int fd
Definition: remote.h:77