2 This file is part of GNUnet
3 (C) 2008, 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/gnunet_testing_lib.h
23 * @brief convenience API for writing testcases for GNUnet
24 * Many testcases need to start and stop gnunetd,
25 * and this library is supposed to make that easier
26 * for TESTCASES. Normal programs should always
27 * use functions from gnunet_{util,arm}_lib.h. This API is
28 * ONLY for writing testcases!
29 * @author Christian Grothoff
32 #ifndef GNUNET_TESTING_LIB_H
33 #define GNUNET_TESTING_LIB_H
35 #include "gnunet_util_lib.h"
36 #include "gnunet_statistics_service.h"
41 #if 0 /* keep Emacsens' auto-indent happy */
47 * Handle for a GNUnet daemon (technically a set of
48 * daemons; the handle is really for the master ARM
49 * daemon) started by the testing library.
51 struct GNUNET_TESTING_Daemon;
54 * Linked list of hostnames and ports to use for starting daemons.
56 struct GNUNET_TESTING_Host
59 * Pointer to next item in the list.
61 struct GNUNET_TESTING_Host *next;
64 * Hostname to connect to.
69 * Username to use when connecting (may be null).
74 * Port to use for SSH connection (used for ssh
75 * connection forwarding, 0 to let ssh decide)
81 * Prototype of a function that will be called whenever
82 * a daemon was started by the testing library.
85 * @param id identifier for the daemon, NULL on error
86 * @param d handle for the daemon
87 * @param emsg error message (NULL on success)
89 typedef void (*GNUNET_TESTING_NotifyHostkeyCreated)(void *cls,
90 const struct GNUNET_PeerIdentity *id,
91 struct GNUNET_TESTING_Daemon *d,
95 * Prototype of a function that will be called whenever
96 * a daemon was started by the testing library.
99 * @param id identifier for the daemon, NULL on error
100 * @param cfg configuration used by this daemon
101 * @param d handle for the daemon
102 * @param emsg error message (NULL on success)
104 typedef void (*GNUNET_TESTING_NotifyDaemonRunning)(void *cls,
105 const struct GNUNET_PeerIdentity *id,
106 const struct GNUNET_CONFIGURATION_Handle *cfg,
107 struct GNUNET_TESTING_Daemon *d,
112 * Handle to an entire testbed of GNUnet peers.
114 struct GNUNET_TESTING_Testbed;
117 * Phases of starting GNUnet on a system.
119 enum GNUNET_TESTING_StartPhase
122 * Copy the configuration file to the target system.
127 * Configuration file has been copied, generate hostkey.
132 * Create the hostkey for the peer.
137 * Hostkey generated, wait for topology to be finished.
142 * Topology has been created, now start ARM.
147 * ARM has been started, check that it has properly daemonized and
148 * then try to connect to the CORE service (which should be
149 * auto-started by ARM).
154 * We're waiting for CORE to start.
159 * Core has notified us that we've established a connection to the service.
160 * The main FSM halts here and waits to be moved to UPDATE or CLEANUP.
165 * We've been asked to terminate the instance and are now waiting for
166 * the remote command to stop the gnunet-arm process and delete temporary
172 * We've received a configuration update and are currently waiting for
173 * the copy process for the update to complete. Once it is, we will
174 * return to "SP_START_DONE" (and rely on ARM to restart all affected
181 * Prototype of a function that will be called when a
182 * particular operation was completed the testing library.
185 * @param emsg NULL on success
187 typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls,
191 * Prototype of a function that will be called with the
192 * number of connections created for a particular topology.
195 * @param num_connections the number of connections created
197 typedef void (*GNUNET_TESTING_NotifyConnections)(void *cls,
198 unsigned int num_connections);
201 * Handle for a GNUnet daemon (technically a set of
202 * daemons; the handle is really for the master ARM
203 * daemon) started by the testing library.
205 struct GNUNET_TESTING_Daemon
210 struct GNUNET_CONFIGURATION_Handle *cfg;
213 * At what time to give up starting the peer
215 struct GNUNET_TIME_Absolute max_timeout;
218 * Host to run GNUnet on.
223 * Port to use for ssh, NULL to let system choose default.
228 * Result of GNUNET_i2s of this peer,
234 * Username we are using.
239 * Name of the configuration file
244 * Callback to inform initiator that the peer's
245 * hostkey has been created.
247 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback;
250 * Closure for hostkey creation callback.
255 * Function to call when the peer is running.
257 GNUNET_TESTING_NotifyDaemonRunning cb;
265 * Arguments from "daemon_stop" call.
267 GNUNET_TESTING_NotifyCompletion dead_cb;
270 * Closure for 'dead_cb'.
275 * Arguments from "daemon_stop" call.
277 GNUNET_TESTING_NotifyCompletion update_cb;
280 * Closure for 'update_cb'.
285 * Identity of this peer (once started).
287 struct GNUNET_PeerIdentity id;
290 * Flag to indicate that we've already been asked
291 * to terminate (but could not because some action
292 * was still pending).
297 * PID of the process that we started last.
299 struct GNUNET_OS_Process *proc;
302 * In which phase are we during the start of
305 enum GNUNET_TESTING_StartPhase phase;
308 * ID of the current task.
310 GNUNET_SCHEDULER_TaskIdentifier task;
313 * Handle to the server.
315 struct GNUNET_CORE_Handle *server;
318 * Handle to the transport service of this peer
320 struct GNUNET_TRANSPORT_Handle *th;
323 * HELLO message for this peer
325 struct GNUNET_HELLO_Message *hello;
328 * Handle to a pipe for reading the hostkey.
330 struct GNUNET_DISK_PipeHandle *pipe_stdout;
333 * Output from gnunet-peerinfo is read into this buffer.
335 char hostkeybuf[105];
338 * Current position in 'hostkeybuf' (for reading from gnunet-peerinfo)
340 unsigned int hostkeybufpos;
343 * Set to GNUNET_YES once the peer is up.
348 * Used to tell shutdown not to remove configuration for the peer
349 * (if it's going to be restarted later)
356 * Handle to a group of GNUnet peers.
358 struct GNUNET_TESTING_PeerGroup;
362 * Prototype of a function that will be called whenever
363 * two daemons are connected by the testing library.
366 * @param first peer id for first daemon
367 * @param second peer id for the second daemon
368 * @param distance distance between the connected peers
369 * @param first_cfg config for the first daemon
370 * @param second_cfg config for the second daemon
371 * @param first_daemon handle for the first daemon
372 * @param second_daemon handle for the second daemon
373 * @param emsg error message (NULL on success)
375 typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls,
376 const struct GNUNET_PeerIdentity *first,
377 const struct GNUNET_PeerIdentity *second,
379 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
380 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
381 struct GNUNET_TESTING_Daemon *first_daemon,
382 struct GNUNET_TESTING_Daemon *second_daemon,
386 * Prototype of a callback function indicating that two peers
387 * are currently connected.
390 * @param first peer id for first daemon
391 * @param second peer id for the second daemon
392 * @param distance distance between the connected peers
393 * @param emsg error message (NULL on success)
395 typedef void (*GNUNET_TESTING_NotifyTopology)(void *cls,
396 const struct GNUNET_PeerIdentity *first,
397 const struct GNUNET_PeerIdentity *second,
401 * Starts a GNUnet daemon. GNUnet must be installed on the target
402 * system and available in the PATH. The machine must furthermore be
403 * reachable via "ssh" (unless the hostname is "NULL") without the
404 * need to enter a password.
406 * @param cfg configuration to use
407 * @param timeout how long to wait starting up peers
408 * @param hostname name of the machine where to run GNUnet
409 * (use NULL for localhost).
410 * @param ssh_username ssh username to use when connecting to hostname
411 * @param sshport port to pass to ssh process when connecting to hostname
412 * @param hostkey_callback function to call once the hostkey has been
413 * generated for this peer, but it hasn't yet been started
414 * (NULL to start immediately, otherwise waits on GNUNET_TESTING_daemon_continue_start)
415 * @param hostkey_cls closure for hostkey callback
416 * @param cb function to call once peer is up, or failed to start
417 * @param cb_cls closure for cb
418 * @return handle to the daemon (actual start will be completed asynchronously)
420 struct GNUNET_TESTING_Daemon *
421 GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
422 struct GNUNET_TIME_Relative timeout,
423 const char *hostname,
424 const char *ssh_username,
426 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback,
428 GNUNET_TESTING_NotifyDaemonRunning cb,
432 * Continues GNUnet daemon startup when user wanted to be notified
433 * once a hostkey was generated (for creating friends files, blacklists,
436 * @param daemon the daemon to finish starting
439 GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon);
442 * Check whether the given daemon is running.
444 * @param daemon the daemon to check
446 * @return GNUNET_YES if the daemon is up, GNUNET_NO if the
447 * daemon is down, GNUNET_SYSERR on error.
450 GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon);
453 * Restart (stop and start) a GNUnet daemon.
455 * @param d the daemon that should be restarted
456 * @param cb function called once the daemon is (re)started
457 * @param cb_cls closure for cb
460 GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
461 GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls);
464 * Start a peer that has previously been stopped using the daemon_stop
465 * call (and files weren't deleted and the allow restart flag)
467 * @param daemon the daemon to start (has been previously stopped)
468 * @param timeout how long to wait for restart
469 * @param cb the callback for notification when the peer is running
470 * @param cb_cls closure for the callback
473 GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
474 struct GNUNET_TIME_Relative timeout,
475 GNUNET_TESTING_NotifyDaemonRunning cb,
479 * Get a certain testing daemon handle.
481 * @param pg handle to the set of running peers
482 * @param position the number of the peer to return
484 struct GNUNET_TESTING_Daemon *
485 GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg,
486 unsigned int position);
489 * Get a daemon by peer identity, so callers can
490 * retrieve the daemon without knowing it's offset.
492 * @param pg the peer group to retrieve the daemon from
493 * @param peer_id the peer identity of the daemon to retrieve
495 * @return the daemon on success, or NULL if no such peer identity is found
497 struct GNUNET_TESTING_Daemon *
498 GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg,
499 struct GNUNET_PeerIdentity *peer_id);
502 * Stops a GNUnet daemon.
504 * @param d the daemon that should be stopped
505 * @param timeout how long to wait for process for shutdown to complete
506 * @param cb function called once the daemon was stopped
507 * @param cb_cls closure for cb
508 * @param delete_files GNUNET_YES to remove files, GNUNET_NO
509 * to leave them (i.e. for restarting at a later time,
510 * or logfile inspection once finished)
511 * @param allow_restart GNUNET_YES to restart peer later (using this API)
512 * GNUNET_NO to kill off and clean up for good
515 GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
516 struct GNUNET_TIME_Relative timeout,
517 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls,
518 int delete_files, int allow_restart);
522 * Changes the configuration of a GNUnet daemon.
524 * @param d the daemon that should be modified
525 * @param cfg the new configuration for the daemon
526 * @param cb function called once the configuration was changed
527 * @param cb_cls closure for cb
529 void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
530 struct GNUNET_CONFIGURATION_Handle *cfg,
531 GNUNET_TESTING_NotifyCompletion cb,
536 * Establish a connection between two GNUnet daemons.
538 * @param d1 handle for the first daemon
539 * @param d2 handle for the second daemon
540 * @param timeout how long is the connection attempt
542 * @param max_connect_attempts how many times should we try to reconnect
544 * @param cb function to call at the end
545 * @param cb_cls closure for cb
547 void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
548 struct GNUNET_TESTING_Daemon *d2,
549 struct GNUNET_TIME_Relative timeout,
550 unsigned int max_connect_attempts,
551 GNUNET_TESTING_NotifyConnection cb,
558 * Start count gnunetd processes with the same set of transports and
559 * applications. The port numbers (any option called "PORT") will be
560 * adjusted to ensure that no two peers running on the same system
561 * have the same port(s) in their respective configurations.
563 * @param cfg configuration template to use
564 * @param total number of daemons to start
565 * @param timeout total time allowed for peers to start
566 * @param hostkey_callback function to call on each peers hostkey generation
567 * if NULL, peers will be started by this call, if non-null,
568 * GNUNET_TESTING_daemons_continue_startup must be called after
569 * successful hostkey generation
570 * @param hostkey_cls closure for hostkey callback
571 * @param cb function to call on each daemon that was started
572 * @param cb_cls closure for cb
573 * @param connect_callback function to call each time two hosts are connected
574 * @param connect_callback_cls closure for connect_callback
575 * @param hostnames linked list of hosts to use to start peers on (NULL to run on localhost only)
577 * @return NULL on error, otherwise handle to control peer group
579 struct GNUNET_TESTING_PeerGroup *
580 GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
582 struct GNUNET_TIME_Relative timeout,
583 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback,
585 GNUNET_TESTING_NotifyDaemonRunning cb,
587 GNUNET_TESTING_NotifyConnection
588 connect_callback, void *connect_callback_cls,
589 const struct GNUNET_TESTING_Host *hostnames);
592 * Function which continues a peer group starting up
593 * after successfully generating hostkeys for each peer.
595 * @param pg the peer group to continue starting
598 GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg);
601 * Restart all peers in the given group.
603 * @param pg the handle to the peer group
604 * @param callback function to call on completion (or failure)
605 * @param callback_cls closure for the callback function
608 GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
609 GNUNET_TESTING_NotifyCompletion callback,
614 * Shutdown all peers started in the given group.
616 * @param pg handle to the peer group
617 * @param timeout how long to wait for shutdown
618 * @param cb callback to notify upon success or failure
619 * @param cb_cls closure for cb
622 GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
623 struct GNUNET_TIME_Relative timeout,
624 GNUNET_TESTING_NotifyCompletion cb,
629 * Count the number of running peers.
631 * @param pg handle for the peer group
633 * @return the number of currently running peers in the peer group
636 GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg);
639 * Simulate churn by stopping some peers (and possibly
640 * re-starting others if churn is called multiple times). This
641 * function can only be used to create leave-join churn (peers "never"
642 * leave for good). First "voff" random peers that are currently
643 * online will be taken offline; then "von" random peers that are then
644 * offline will be put back online. No notifications will be
645 * generated for any of these operations except for the callback upon
646 * completion. Note that the implementation is at liberty to keep
647 * the ARM service itself (but none of the other services or daemons)
648 * running even though the "peer" is being varied offline.
650 * @param pg handle for the peer group
651 * @param voff number of peers that should go offline
652 * @param von number of peers that should come back online;
653 * must be zero on first call (since "testbed_start"
654 * always starts all of the peers)
655 * @param timeout how long to wait for operations to finish before
657 * @param cb function to call at the end
658 * @param cb_cls closure for cb
661 GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
664 struct GNUNET_TIME_Relative timeout,
665 GNUNET_TESTING_NotifyCompletion cb,
669 * Callback function to process statistic values.
672 * @param peer the peer the statistics belong to
673 * @param subsystem name of subsystem that created the statistic
674 * @param name the name of the datum
675 * @param value the current value
676 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
677 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
679 typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls,
680 const struct GNUNET_PeerIdentity *peer,
681 const char *subsystem,
687 * Iterate over all (running) peers in the peer group, retrieve
688 * all statistics from each.
691 GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg,
692 GNUNET_STATISTICS_Callback cont,
693 GNUNET_TESTING_STATISTICS_Iterator proc, void *cls);
696 * Topologies supported for testbeds.
698 enum GNUNET_TESTING_Topology
701 * A clique (everyone connected to everyone else).
703 GNUNET_TESTING_TOPOLOGY_CLIQUE,
706 * Small-world network (2d torus plus random links).
708 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD,
711 * Small-world network (ring plus random links).
713 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING,
718 GNUNET_TESTING_TOPOLOGY_RING,
723 GNUNET_TESTING_TOPOLOGY_2D_TORUS,
728 GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI,
731 * Certain percentage of peers are unable to communicate directly
732 * replicating NAT conditions
734 GNUNET_TESTING_TOPOLOGY_INTERNAT,
737 * Scale free topology.
739 GNUNET_TESTING_TOPOLOGY_SCALE_FREE,
742 * Straight line topology.
744 GNUNET_TESTING_TOPOLOGY_LINE,
747 * All peers are disconnected.
749 GNUNET_TESTING_TOPOLOGY_NONE
753 * Options for connecting a topology.
755 enum GNUNET_TESTING_TopologyOption
758 * Try to connect all peers specified in the topology.
760 GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
763 * Choose a random subset of connections to create.
765 GNUNET_TESTING_TOPOLOGY_OPTION_RANDOM,
768 * Create at least X connections for each peer.
770 GNUNET_TESTING_TOPOLOGY_OPTION_MINIMUM,
773 * Using a depth first search, create one connection
774 * per peer. If any are missed (graph disconnected)
775 * start over at those peers until all have at least one
778 GNUNET_TESTING_TOPOLOGY_OPTION_DFS,
781 * Find the N closest peers to each allowed peer in the
782 * topology and make sure a connection to those peers
783 * exists in the connect topology.
785 GNUNET_TESTING_TOPOLOGY_OPTION_ADD_CLOSEST,
788 * No options specified.
790 GNUNET_TESTING_TOPOLOGY_OPTION_NONE
795 * Get a topology from a string input.
797 * @param topology where to write the retrieved topology
798 * @param topology_string The string to attempt to
799 * get a configuration value from
800 * @return GNUNET_YES if topology string matched a
801 * known topology, GNUNET_NO if not
804 GNUNET_TESTING_topology_get(enum GNUNET_TESTING_Topology *topology,
805 const char * topology_string);
808 * Get connect topology option from string input.
810 * @param topology_option where to write the retrieved topology
811 * @param topology_string The string to attempt to
812 * get a configuration value from
813 * @return GNUNET_YES if topology string matched a
814 * known topology, GNUNET_NO if not
817 GNUNET_TESTING_topology_option_get(enum GNUNET_TESTING_TopologyOption *topology_option,
818 const char * topology_string);
822 * Takes a peer group and creates a topology based on the
823 * one specified. Creates a topology means generates friend
824 * files for the peers so they can only connect to those allowed
825 * by the topology. This will only have an effect once peers
826 * are started if the FRIENDS_ONLY option is set in the base
829 * Also takes an optional restrict topology which
830 * disallows direct connections UNLESS they are specified in
831 * the restricted topology.
833 * A simple example; if the topology option is set to LINE
834 * peers can ONLY connect in a LINE. However, if the topology
835 * option is set to 2D-torus and the restrict option is set to
836 * line with restrict_transports equal to "tcp udp", then peers
837 * may connect in a 2D-torus, but will be restricted to tcp and
838 * udp connections only in a LINE. Generally it only makes
839 * sense to do this if restrict_topology is a subset of topology.
841 * For testing peer discovery, etc. it is generally better to
842 * leave restrict_topology as GNUNET_TESTING_TOPOLOGY_NONE and
843 * then use the connect_topology function to restrict the initial
846 * @param pg the peer group struct representing the running peers
847 * @param topology which topology to connect the peers in
848 * @param restrict_topology allow only direct connections in this topology,
849 * based on those listed in restrict_transports, set to
850 * GNUNET_TESTING_TOPOLOGY_NONE for no restrictions
851 * @param restrict_transports space delimited list of transports to blacklist
852 * to create restricted topology, NULL for none
854 * @return the maximum number of connections were all allowed peers
855 * connected to each other
858 GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
859 enum GNUNET_TESTING_Topology topology,
860 enum GNUNET_TESTING_Topology restrict_topology,
861 const char *restrict_transports);
864 * Iterate over all (running) peers in the peer group, retrieve
865 * all connections that each currently has.
867 * @param pg the peer group we are concerned with
868 * @param cb callback for topology information
869 * @param cls closure for callback
872 GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg,
873 GNUNET_TESTING_NotifyTopology cb, void *cls);
876 * There are many ways to connect peers that are supported by this function.
877 * To connect peers in the same topology that was created via the
878 * GNUNET_TESTING_create_topology, the topology variable must be set to
879 * GNUNET_TESTING_TOPOLOGY_NONE. If the topology variable is specified,
880 * a new instance of that topology will be generated and attempted to be
881 * connected. This could result in some connections being impossible,
882 * because some topologies are non-deterministic.
884 * @param pg the peer group struct representing the running peers
885 * @param topology which topology to connect the peers in
886 * @param options options for connecting the topology
887 * @param option_modifier modifier for options that take a parameter
888 * @param notify_callback notification to be called once all connections completed
889 * @param notify_cls closure for notification callback
891 * @return the number of connections that will be attempted (multiple of two,
892 * each bidirectional connection counts twice!), GNUNET_SYSERR on error
896 GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
897 enum GNUNET_TESTING_Topology topology,
898 enum GNUNET_TESTING_TopologyOption options,
899 double option_modifier,
900 GNUNET_TESTING_NotifyCompletion notify_callback,
904 * Start or stop an individual peer from the given group.
906 * @param pg handle to the peer group
907 * @param offset which peer to start or stop
908 * @param desired_status GNUNET_YES to have it running, GNUNET_NO to stop it
909 * @param timeout how long to wait for shutdown
910 * @param cb function to call at the end
911 * @param cb_cls closure for cb
914 GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg,
917 struct GNUNET_TIME_Relative timeout,
918 GNUNET_TESTING_NotifyCompletion cb,
922 #if 0 /* keep Emacsens' auto-indent happy */