2 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
3 * Copyright (C) 2006-2009 Brian Aker
6 * Use and distribution licensed under the BSD license. See
7 * the COPYING file in the parent directory for full text.
14 #include <netinet/in.h>
19 #define SERVERS_TO_CREATE 5
23 typedef pid_t (test_server_getpid
)(server_st
&);
24 typedef bool (test_server_ping
)(server_st
&);
31 char pid_file
[FILENAME_MAX
]; // Did we start it, or was it just sitting there?
33 test_server_getpid
*__get_pid
;
34 test_server_ping
*__ping
;
35 std::string _hostname
;
38 server_st(in_port_t port_arg
, test_server_getpid
*, test_server_ping
*);
40 server_st(const std::string
&socket_file
, test_server_getpid
*, test_server_ping
*);
42 void set_methods(test_server_getpid
*get_pid_arg
, test_server_ping
*ping_arg
)
44 __get_pid
= get_pid_arg
;
48 const char *hostname() const
50 if (_hostname
.empty())
53 return _hostname
.c_str();
67 return _pid
= __get_pid(*this);
72 void set_port(in_port_t arg
)
77 in_port_t
port() const
87 void set_command(const char *arg
)
111 bool is_socket() const
113 return _hostname
[0] == '/';
123 std::ostream
& operator<<(std::ostream
& output
, const server_st
&arg
);
125 struct server_startup_st
129 std::string server_list
;
130 std::vector
<server_st
*> servers
;
132 server_startup_st() :
133 count(SERVERS_TO_CREATE
),
138 void push_server(server_st
*);
140 ~server_startup_st();
148 bool server_startup(server_startup_st
*construct
);
149 void server_shutdown(server_startup_st
*construct
);