- * Handle for a GNUnet daemon (technically a set of
- * daemons; the handle is really for the master ARM
- * daemon) started by the testing library.
- */
-struct GNUNET_TESTING_Daemon
-{
- /**
- * Our scheduler.
- */
- struct GNUNET_SCHEDULER_Handle *sched;
-
- /**
- * Our configuration.
- */
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
- /**
- * At what time to give up starting the peer
- */
- struct GNUNET_TIME_Absolute max_timeout;
-
- /**
- * Host to run GNUnet on.
- */
- char *hostname;
-
- /**
- * Result of GNUNET_i2s of this peer,
- * for printing
- */
- char *shortname;
-
- /**
- * Username we are using.
- */
- char *username;
-
- /**
- * Name of the configuration file
- */
- char *cfgfile;
-
- /**
- * Callback to inform initiator that the peer's
- * hostkey has been created.
- */
- GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback;
-
- /**
- * Closure for hostkey creation callback.
- */
- void *hostkey_cls;
-
- /**
- * Function to call when the peer is running.
- */
- GNUNET_TESTING_NotifyDaemonRunning cb;
-
- /**
- * Closure for cb.
- */
- void *cb_cls;
-
- /**
- * Arguments from "daemon_stop" call.
- */
- GNUNET_TESTING_NotifyCompletion dead_cb;
-
- /**
- * Closure for 'dead_cb'.
- */
- void *dead_cb_cls;
-
- /**
- * Arguments from "daemon_stop" call.
- */
- GNUNET_TESTING_NotifyCompletion update_cb;
-
- /**
- * Closure for 'update_cb'.
- */
- void *update_cb_cls;
-
- /**
- * Identity of this peer (once started).
- */
- struct GNUNET_PeerIdentity id;
-
- /**
- * Flag to indicate that we've already been asked
- * to terminate (but could not because some action
- * was still pending).
- */
- int dead;
-
- /**
- * PID of the process that we started last.
- */
- pid_t pid;
-
- /**
- * In which phase are we during the start of
- * this process?
- */
- enum GNUNET_TESTING_StartPhase phase;
-
- /**
- * ID of the current task.
- */
- GNUNET_SCHEDULER_TaskIdentifier task;
-
- /**
- * Handle to the server.
- */
- struct GNUNET_CORE_Handle *server;
-
- /**
- * Handle to the transport service of this peer
- */
- struct GNUNET_TRANSPORT_Handle *th;
-
- /**
- * HELLO message for this peer
- */
- struct GNUNET_HELLO_Message *hello;
-
- /**
- * Handle to a pipe for reading the hostkey.
- */
- struct GNUNET_DISK_PipeHandle *pipe_stdout;
-
- /**
- * Output from gnunet-peerinfo is read into this buffer.
- */
- char hostkeybuf[105];
-
- /**
- * Current position in 'hostkeybuf' (for reading from gnunet-peerinfo)
- */
- unsigned int hostkeybufpos;
-
- /**
- * Set to GNUNET_YES once the peer is up.
- */
- int running;
-
- /**
- * Used to tell shutdown not to remove configuration for the peer
- * (if it's going to be restarted later)
- */
- int churn;
-};
+ * Create a system handle. There must only be one system
+ * handle per operating system. Use this function directly
+ * if multiple system objects are created for the same host
+ * (only really useful when testing --- or to make the port
+ * range configureable).
+ *
+ * @param testdir only the directory name without any path. This is used for
+ * all service homes; the directory will be created in a temporary
+ * location depending on the underlying OS
+ * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
+ * service configurations generated to allow control connections from
+ * this ip. This can either be a single ip address or a network address
+ * in CIDR notation.
+ * @param hostname the hostname of the system we are using for testing; NULL for
+ * localhost
+ * @param lowport lowest port number this system is allowed to allocate (inclusive)
+ * @param highport highest port number this system is allowed to allocate (exclusive)
+ * @return handle to this system, NULL on error
+ */
+struct GNUNET_TESTING_System *
+GNUNET_TESTING_system_create_with_portrange (const char *testdir,
+ const char *trusted_ip,
+ const char *hostname,
+ uint16_t lowport,
+ uint16_t highport);