5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2005 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silcserver/Server Library Interface
34 #include "silcserver_params.h"
36 /****s* silcserver/SilcServerAPI/SilcServer
40 * typedef struct SilcServerStruct *SilcServer;
44 * This context is the actual SILC Server context and is allocated
45 * by silc_server_alloc and given as argument to all silc_server_*
46 * functions. It is freed by the silc_server_free function.
49 typedef struct SilcServerStruct *SilcServer;
51 /****f* silcserver/SilcServerAPI/SilcServerRunning
55 * typedef void (*SilcServerRunning)(SilcServer server, SilcBool running,
60 * Called to indicate that the server is up and running and ready to
61 * accept new connection and create connections to remote router, if
62 * any has been configured.
65 typedef void (*SilcServerRunning)(SilcServer server, void *context);
67 /****f* silcserver/SilcServerAPI/SilcServerStop
71 * typedef void (*SilcServerStop)(SilcServer server, void *context);
75 * Called to indicate that the server has stopped and can be freed now.
78 typedef void (*SilcServerStop)(SilcServer server, void *context);
80 /****f* silcserver/SilcServerAPI/silc_server_alloc
84 * SilcServer silc_server_alloc(void *app_context, SilcServerParams params,
85 * SilcSchedule schedule);
89 * Allocates SILC server context and returns it. Returns NULL if case
90 * of error. The `app_context' is application specific context and
91 * can be retrieved from the server by using silc_server_get_context
92 * function. The `params' context contains the SILC server parameters
93 * that application has gathered most likely from a configuration file
94 * or similar source. The `params' and everything inside are allocated
95 * by the caller, but the server library will own it and free it. It
96 * may also modify its content.
99 SilcServer silc_server_alloc(void *app_context, SilcServerParams params,
100 SilcSchedule schedule);
102 /****f* silcserver/SilcServerAPI/silc_server_free
106 * void silc_server_free(SilcServer server);
110 * Free the server context and all allocated resources.
113 void silc_server_free(SilcServer server);
115 /****f* silcserver/SilcServerAPI/silc_server_run
119 * void silc_server_run(SilcServer server, SilcServerRunning running,
120 * void *running_context);
124 * Starts the SILC server. This function returns immediately and the
125 * SilcSchedule must be run after this functions returns or it must be
126 * already running when this function is called. The `running' callback
127 * will be called once the server is up and running.
130 void silc_server_run(SilcServer server, SilcServerRunning running,
131 void *running_context);
133 /****f* silcserver/SilcServerAPI/silc_server_run
137 * void silc_server_stop(SilcServer server, SilcServerStop stop_callback,
138 * void *stop_context);
142 * Stops the SILC server. Stopping of the server is asynchronous and
143 * once it has stopped the `stopped' callback will be called with the
144 * `stop_context'. Application should not exit without calling this
148 void silc_server_stop(SilcServer server, SilcServerStop stopped,
151 #include "server_internal.h"
157 #endif /* SILCSERVER_H */