Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gnunet/platform.h>
- #include <sys/select.h>
- #include <sys/time.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <gnunet/gnunet_util_lib.h>
- static int ret;
- static void run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg) {
- struct sockaddr_in sa;
- struct GNUNET_NETWORK_Handle *desc;
- memset (&sa, 0, sizeof (sa));
- #if HAVE_SOCKADDR_IN_SIN_LEN
- sa.sin_len = sizeof (sa);
- #endif
- sa.sin_family = AF_INET;
- sa.sin_port = htons (6667);
- sa.sin_addr.s_addr = inet_addr("127.0.0.1");
- desc = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
- GNUNET_assert (desc != NULL);
- GNUNET_assert (GNUNET_OK == GNUNET_NETWORK_socket_bind
- (desc, (struct sockaddr *) &sa, sizeof (sa)));
- GNUNET_NETWORK_socket_listen (desc, 5);
- ret = 0;
- }
- int main (int argc, char *const *argv) {
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
- return (GNUNET_OK == GNUNET_PROGRAM_run (
- argc, argv, "gnunetircd",
- gettext_noop ("ircd over gnunet"),
- options, &run, NULL)) ? ret : 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement