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>
18 #define SERVERS_TO_CREATE 5
22 typedef pid_t (test_server_getpid
)(server_st
&);
23 typedef bool (test_server_ping
)(server_st
&);
30 char pid_file
[FILENAME_MAX
]; // Did we start it, or was it just sitting there?
32 test_server_getpid
*__get_pid
;
33 test_server_ping
*__ping
;
37 char hostname
[NI_MAXHOST
];
47 strncpy(hostname
, "localhost", sizeof(hostname
));
50 void set_methods(test_server_getpid
*get_pid_arg
, test_server_ping
*ping_arg
)
52 __get_pid
= get_pid_arg
;
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] == '/';
116 void set_hostname(const char *arg
)
118 strncpy(hostname
, arg
, sizeof(hostname
));
128 std::ostream
& operator<<(std::ostream
& output
, const server_st
&arg
);
130 struct server_startup_st
134 std::string server_list
;
135 server_st server
[SERVERS_TO_CREATE
];
137 server_startup_st() :
138 count(SERVERS_TO_CREATE
),
142 ~server_startup_st();
150 bool server_startup(server_startup_st
*construct
);
151 void server_shutdown(server_startup_st
*construct
);