+Sun Jul 1 19:15:15 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Server 1.1 Beta1.
+
+Sun Jul 1 12:40:06 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added support for rekey with PFS when using CTR mode
+ encryption. Affected file is lib/silcske/silcske.c.
+
+ * Added silc_idcache_move that can be used to move entries
+ between caches. Affected files are
+ lib/silcapputil/silcidcache.[ch].
+
+ * Added better checks for invalid argument and notify payloads.
+ Affected files are lib/silccore/silcnotify.c and
+ silcargument.c.
+
+ * Fixed SILC_PACKET_FLAG_LONG_PAD bitmask value. Affected
+ file lib/silccore/silcpacket.h.
+
+Sat Jun 30 21:48:08 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Set the destination ID to packet stream as SKE responder
+ if ID was present in key exchange packet. Affected file
+ is lib/silcske/silcske.[ch].
+
+ * Handle also zero timeouts in the scheduler notify callback
+ to avoid problems with SILC Plugin. Affected file is
+ apps/irssi/src/silc/core/silc-core.c.
+
+Thu Jun 28 19:19:13 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Client 1.1.1.
+
+Sun Jun 24 18:47:55 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Toolkit 1.1.1.
+
+ * Compile sources with _GNU_SOURCE on Linux systems. Affected
+ file is configure.ad.
+
+Sun Jun 24 16:33:59 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed Unix signal task dispatching to not lock the signals
+ when dispatching the callback to avoid deadlocks. Affected
+ file is lib/silcutil/unix/silcunixschedule.c.
+
+Sun Jun 24 14:43:21 CEST 2007 Jochen Eisinger <coffee@silcnet.org>
+
+ * Fix configure output for with-plugin. Affected file is
+ apps/irssi/configure.ad
+
+Tue Jun 19 17:05:48 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added SILC_VERSION macro for checking package versions at
+ compile time. Affected files are configure.ad,
+ includes/silc.h.in and includes/silcversion.h.in.
+
+Mon Jun 18 23:47:22 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Use SILC_VERIFY to assert that silc_rwlock_wrlock can be
+ called only once per thread on Unix. Affected file is
+ lib/silcutil/unix/silcunixthread.c. Added same for mutex
+ as well. Documented same on the API in
+ lib/silcutil/silcmutex.h.
+
+ * Fixed USERS command reply write-lock unlocking. Affected file
+ is lib/silcclient/command_reply.c.
+
+Mon Jun 18 08:14:26 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed silc_create_key_pair to check for valid identifier.
+ Affected file is lib/silcapputil/silcapputil.c.
+
+Sun Jun 17 20:08:26 CEST 2007 Jochen Eisinger <coffee@silcnet.org>
+
+ * Rewrite signed public message handling, adopting the new
+ hilight interface. Affected file is
+ apps/irssi/src/fe-common/silc/fe-silc-messages.c
+
+Thu Jun 14 21:15:31 CEST 2007 Jochen Eisinger <coffee@silcnet.org>
+
+ * Fix off by one error when loading modules. Affected file is
+ apps/irssi/src/core/modules-load.c
+
+ * Don't delete hilight entry (because it's just a pointer, not a
+ copy). Affected file is
+ apps/irssi/src/fe-common/silc/fe-silc-messages.c
+
+Mon Jun 11 22:10:17 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added __SILC_TOOLKIT_x_x_x macro to all Toolkit distribution
+ which can be used to check for Toolkit version in third-party
+ software. Affected file is configure.ad, includes/silc.h.in.
+
+Sun Jun 10 17:32:15 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added support for channel@server channel name strings to
+ client library (SILC protocol version 1.3 change). Affected
+ files are lib/silcclient/silcclient_entry.h, client_entry.c.
+
+ * Added full_nicknames and full_channel_names settings to
+ SilcClientParams that can be used to specify whether client
+ library returns full nickname and channel name strings.
+ Full strings are nick@server and channel@server. Affected
+ file is lib/silcclient/client_entry.c and command.c.
+
+Sat Jun 9 19:43:25 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed unix connecting failure to return error code correctly.
+ Affected file is lib/silcutil/unix/silcunixnet.c.
+
+Fri Jun 8 23:32:33 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed SKE timeout double free crash. Affected file is
+ lib/silcske/silcske.c.
+
+ * Fixed MIME multipart decoding buffer overflow. Affected file
+ is lib/silcutil/silcmime.c. Thanks to Matt Miller for patch.
+
+Fri Jun 8 18:39:34 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed connection auth protocol timeout crash. Affected
+ file is lib/silcske/silconnauth.c.
+
+ * Fixed FSM machine finishing to check for existing threads
+ at the final free callback to allow time for the threads to
+ finish. Affected file lib/silcutil/silcfsm.c.
+
+Thu Jun 7 21:25:31 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed silc_client_get_clients_local to check the nick's
+ server also if nick@server nickname string is given to the
+ function. Affected file is lib/silcclient/client_entry.c.
+
+Wed Jun 6 18:33:05 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added notify callback to silc_schedule_init which can be used to
+ set a notify callback for scheduler which is called when task is
+ added to scheduler or deleted from scheduler. Affected file
+ is lib/silcutil/silcschedule.[ch].
+
+ * Dispatch timeout tasks after dispatching FD tasks if the timeout
+ was very short. Affected file is lib/silcutil/silcschedule.c.
+
+ * Rewrote the SILC scheduler handling in SILC Client to not poll
+ every few msecs but to use the new notify callback. Affected
+ file is apps/irssi/src/silc/core/silc-core.c.
+
+ * Fixed SFTP client library read buffer size which was too small.
+ Affected file is lib/silcsftp/sftp_client.c.
+
+ * Fixed file transfer crash bug in /QUIT in SILC Client. Close
+ the FTP sessions before quitting the client. Affected file
+ is apps/irssi/src/silc/core/silc-servers.c.
+
+Tue Jun 5 20:48:40 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed silc_packet_get_ids to decode the IDs correctly.
+ Affected file is lib/silccore/silcpacket.c.
+
+ * Fixed silc_client_get_clients_local to parse correctly nickname
+ string that may have server name in it (nick@server) regardless
+ whether it was formatted nickname or not. Affected file is
+ lib/silcclient/client_entry.c.
+
+Mon Jun 4 22:02:53 CEST 2007 Jochen Eisinger <jochen@penguin-breeder.org>
+
+ * Only destroy sendbuffers, if they still exist (they cease to
+ exist during /upgrade). Affected file is
+ apps/irssi/src/silc/core/silc-servers.c
+
+Mon Jun 4 21:24:17 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Removed --enable-silc-plugin. Added --with-silc-plugin.
+ Affected files are configure.ad, lib/configure.ad,
+ apps/irssi/configure.ad, apps/irssi/configure.in,
+ apps/irssi/scripts/Makefile.am,
+ apps/irssi/scripts/examples/Makefile.am,
+ apps/irssi/src/silc/core/silc/Makefile.am,
+ apps/irssi/src/fe-common/silc/Makefile.am.
+
+Mon Jun 4 08:35:59 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Client 1.1.
+
+Sun Jun 3 14:00:09 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed DESTDIR handling in make install.
+
+Sat Jun 2 21:04:32 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SIM modules are not delivered to SILC CLient distribution
+ anymore.
+
+ * Changed default installation path from /usr/local/silc to
+ /usr/local for all distributions.
+
+ * Removed --with-etcdir and --with-docdir. The etcdir is now
+ the system's default. The Docdir is system's default.
+
+Sat Jun 2 00:51:57 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * If public key/private key loading fails set the return
+ pointer to NULL. Affected file is lib/silccrypt/silcpkcs.c.
+
+ * If private key loading fails in silc_load_key_pair free the
+ loaded public key. Affected file is
+ lib/silcapputil/silcapputil.c.
+
+ * Fixed key pair loading crash with SILC Plugin if key pair
+ loading fails. Affected file is
+ apps/irssi/src/silc/core/silc-core.c.
+
+ * Fixed SILC Client help and script file installation path
+ to go to prefix/share/silc. Affected files are
+ apps/irssi/src/scripts/Makefile.am and
+ apps/irssi/docs/help/Makefile.am.gen.
+
+Thu May 31 16:49:13 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed UTC offset minutes to be actually minutes. Affected
+ file is lib/silcutil/silctime.c.
+
+Thu May 31 09:40:56 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Toolkit 1.1.
+
+ * Added support for checking for timezone and tm_gmtoff.
+ Affected files are configure.ad and lib/silcutil/silctime.c.
+
+Wed May 30 18:46:34 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added silc-toolkit.spec.in RPM spec file.
+
+Mon May 28 23:21:39 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed nickname formatting crash when updating existing
+ client entry. Affected file is lib/silcclient/client_entry.c.
+
+ * Fixed MIME object encoding in attribute payload encoding.
+ Affected file is lib/silccore/silcattrs.c.
+
+Mon May 28 09:02:26 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Client 1.1 Beta6
+
+Sun May 27 20:38:30 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Copy SILC Plugin's libfe_common_silc.so to libfe_silc.so so
+ that user's don't have to do it manually. Affected file
+ is apps/irssi/src/fe-common/silc/core/Makefile.am.
+
+Thu May 24 15:30:31 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Toolkit 1.1 Beta4.
+
+ * Fixed channel and server entry freeing in client library.
+ Affected file is lib/silcclient/client_entry.c.
+
+ * Do not allow stopping client before it has been started.
+ Affected file is lib/silcclient/client.c.
+
+Wed May 23 23:21:03 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed formatted nickname renaming to rename also irssi's
+ nicklist (/NAMES etc). Affected file is
+ apps/irssi/src/silc/core/client_ops.c.
+
+ * Fixed SILC Plugin crash when stopping client library before
+ it has been started. Affected file is
+ apps/irssi/src/silc/core/silc-core.c.
+
+Tue May 22 17:18:54 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * For SILC Client and SILC Server check for 1.1 Toolkit
+ in configure. Affected file is configure.ad.
+
+ * Added better library linking flags and orders for SILC Client.
+ Affected file is configure.ad, Makefile.defines_int.in and
+ apps/irssi/src/fe-text/Makefile.am
+
+Mon May 21 08:26:38 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * SILC Client 1.1 Beta5.
+
+Sun May 20 18:34:22 CEST 2007 Jochen Eisinger <coffee@silcnet.org>
+
+ * Add hooks for Irssi 0.8.11 module functions. Affected file
+ is apps/irssi/src/fe-common/silc/fe-common-silc.c
+
Sat May 19 14:46:36 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
* Fixed passphrase authentication with server. Affected file
EXTRA_DIST = \
silcdefs.h.in \
#ifdef SILC_DIST_TOOLKIT
+ silc-toolkit.spec \
symbian \
#endif SILC_DIST_TOOLKIT
#ifdef SILC_DIST_CLIENT
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2000 - 2005 Pekka Riikonen
+# Copyright (C) 2000 - 2007 Pekka Riikonen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# Common libraries that are linked against the created executable
#
-SILC_COMMON_LIBS= -L$(silc_top_srcdir)/lib -lsilc @LIBS@
+SILC_COMMON_LDFLAGS= @LDFLAGS@
+SILC_COMMON_LIBS= -lsilc @LIBS@
#
# Common compilation flags
silc_modulesdir=@MODULESDIR@
silc_helpdir=@HELPDIR@
silc_docdir=@DOCDIR@
-silc_logsdir=@LOGSDIR@
etcdir = $(DESTDIR)$(silc_etcdir)
modulesdir = $(DESTDIR)$(silc_modulesdir)
helpdir = $(DESTDIR)$(silc_helpdir)
docdir = $(DESTDIR)$(silc_docdir)
-logsdir = $(DESTDIR)$(silc_logsdir)
mandir = $(DESTDIR)@mandir@
+#ifdef SILC_DIST_SERVER
+silc_logsdir=@LOGSDIR@
+logsdir = $(DESTDIR)$(silc_logsdir)
+#endif SILC_DIST_SERVER
\ No newline at end of file
autodist <name> <version>
-Where the <name> is the distribution name. It is one of the distributions
-that was defined in distdir/ directory. The <version> is the version of
-the distribution that will be prepared. The version format is
+Where the <name> is the distribution name. It is one of the distributions
+that was defined in distdir/ directory. The <version> is the version of
+the distribution that will be prepared. The version format is
major.minor.build, for example 0.9.10. Example:
autodist client 0.9.15
-This prepares 'client' distribution of version 0.9.15. The package will
+This prepares 'client' distribution of version 0.9.15. The package will
have the version 0.9.15 automatically.
+NOTE: Those distribution that have RPM spec files you should specify the
+RPM release version to autodist also by doing the following:
+
+ autodist toolkit 1.1.2 0.fc7
+
+where the "0.fc7" will become the RPM release version. If you omit the
+release version the default currently is "0.fc7".
+
Configuring and compiling the distribution
==========================================
-When you prepare the distribution for releasing you should configure the
-distribution without any specific configuration options, hence just give
+When you prepare the distribution for releasing you should configure the
+distribution without any specific configuration options, hence just give
the command:
./configure
+NOTE: If you have SILC Toolkit installed to your system you must use
+the following command to configure the distribution, so that the Toolkit
+from the system is not used:
+
+ PKG_CONFIG=. ./configure
+
To compile the distribution, give command:
make
-If you want you can clear the environment first with make clean command,
+If you want you can clear the environment first with make clean command,
but this is not necessary.
Packaging the distribution
==========================
-After the distribution is prepared, configured and compiled it can be
+After the distribution is prepared, configured and compiled it can be
packaged with the following commands:
make -C doc dist-hook
makedist --bzip2
-The 'makedist --bzip2' creates the default 'tar.gz' and 'tar.bz2'
+The 'makedist --bzip2' creates the default 'tar.gz' and 'tar.bz2'
distribution.
-NOTE: Before giving this command, make sure that you do not have any of
+NOTE: Before giving this command, make sure that you do not have any of
the tests in the SILC source tree compiled. If they are the binaries
-will be included in the distribution which is not allowed. The tests are
+will be included in the distribution which is not allowed. The tests are
always located in the tests/ directory, for example lib/silccore/tests/.
-The tests are not compiled by default, but if you compiled them by
+The tests are not compiled by default, but if you compiled them by
yourself make sure you make clean them before creating the distribution.
NOTE: Same thing must be assured for silcer/ and tutorial/ sub
extra files. If you haven't compiled them after the CVS checkout, they do
not include any extra files.
-NOTE for 'toolkit' distribution: Running ./configure for toolkit
-distribution is not necessary. Toolkit is packaged simply by giving
+NOTE for 'toolkit' distribution: Running ./configure for toolkit
+distribution is not necessary. Toolkit is packaged simply by giving
command:
makedist
Before releasing the distribution
=================================
-Before releasing the distribution the created distribution must be tagged
-in the CVS so that it can be checkout at a later time, if needed. The tag
+Before releasing the distribution the created distribution must be tagged
+in the CVS so that it can be checkout at a later time, if needed. The tag
format is as follows:
silc_<name>_<version>
-Where <name> is the distribution name and <version> is the version of the
-distribution in following format: major_minor_build, for example 0_9_10.
+Where <name> is the distribution name and <version> is the version of the
+distribution in following format: major_minor_build, for example 0_9_10.
Example:
silc_client_0_9_15
-To tag the distribution go to the root of the SILC CVS source tree and
+To tag the distribution go to the root of the SILC CVS source tree and
give, for example, command:
cvs tag silc_client_0_9_15
In order to compile the SILC Plugin (instead of the SILC Client), pass the
-following options to configure:
+following options to configure, if your Irssi is installed into /usr:
- --enable-silc-plugin --without-silc-includes
+ --prefix=/usr
+ --with-silc-plugin
+ --without-silc-includes
-Depending on your OS/architecture you may also need to pass:
+If your Irssi is installed in some other location than /usr, then pass its
+location to --prefix and --with-silc-plugin, for example:
- --with-pic --without-pthreads
+ --prefix=/usr/local
+ --with-silc-plugin=/usr/local/lib/irssi
+ --without-silc-includes
-For installing the SILC Plugin to the appropriate directories, you have to
-define the following paths (assuming Irssi is installed to /usr)
+Depending on your OS/architecture you may also need to pass the following
+options to configure:
- --prefix=/usr
- --with-simdir=/usr/lib/irssi
-
-If you're using Irssi 0.8.10, you may need to rename libfe_common_silc.so to
-libfe_silc.so
+ --with-pic --without-pthreads
@IRSSI_SUBDIR@ \
#endif SILC_DIST_CLIENT
#ifdef SILC_DIST_INPLACE
- silcstress
+# silcstress
#endif SILC_DIST_INPLACE
+Thu May 31 23:34:00 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Autodist 1.3.2.
+
+ * Added 'prereq' directive to support encforcment of Autodist
+ version.
+
+ * Added support for providing extra parameters to autodist that
+ are passed to the hook scripts. User can specify whatever
+ extra parameter they want.
+
Wed Feb 21 15:45:50 EET 2007 Pekka Riikonen <priikone@silcnet.org>
* Autodist 1.3.1.
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2005 Pekka Riikonen
+# Copyright (C) 2005 - 2007 Pekka Riikonen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1
+ params=`grep "params:" < autodist.dist | cut -d: -f2` || exit 1
ad_parse_distribution $distribution false
ad_log " Distribution: $distribution $dist_version"
ad_log " Destination directory: $am_distdir"
fi
# Run pre-dist-hooks
- ad_run_dist_hooks "$pre_dist_hooks"
+ ad_run_dist_hooks "$pre_dist_hooks" "$params"
# Create distribution directory
ad_debug "Creating distribution directory $am_distdir"
fi
# Run pre-process-dist-hooks
- ad_run_dist_hooks "$pre_p_dist_hooks"
+ ad_run_dist_hooks "$pre_p_dist_hooks" "$params"
# Run excludes
ad_dist_excludes "$excludes" true
ad_process_noprocess false
# Run post-process_dist-hooks
- ad_run_dist_hooks "$post_p_dist_hooks"
+ ad_run_dist_hooks "$post_p_dist_hooks" "$params"
# Make distribution sane
ad_makedist_makesane
rm -f $am_distdir.tar
# Run post-dist-hooks
- ad_run_dist_hooks "$post_dist_hooks"
+ ad_run_dist_hooks "$post_dist_hooks" "$params"
# Cleanup
rm -rf $am_distdir
ad_fatal "Distribution '$1' is not declared"
fi
+ # Get and enforce prereq version
+ prereq=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
+ | grep "prereq " | cut -d' ' -f2- | sort | uniq`
+ if test '!' -z $prereq; then
+ if [[ $ver < $prereq ]]; then
+ ad_fatal "Autodist $prereq or newer is required for distribution $1"
+ fi
+ fi
+
# Get inherited
inhs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "inherit " | cut -d' ' -f2 | sort | uniq`
#
# Run hooks
#
-# Arguments: ad_run_hooks <hooks>
+# Arguments: ad_run_hooks <hooks> <params>
#
ad_run_hooks()
{
if test '!' -f $i; then
ad_fatal "Hook script $i does not exist"
fi
- ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\""
- sh $i "$distribution" "$dist_version" "$package" || exit 1
+ ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$2\""
+ sh $i "$distribution" "$dist_version" "$package" "$2" || exit 1
done
ad_log ""
#
# Run dist hooks
#
-# Arguments: ad_run_dist_hooks <hooks>
+# Arguments: ad_run_dist_hooks <hooks> <params>
#
ad_run_dist_hooks()
{
ad_fatal "Dist hook script $i does not exist"
fi
- ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\""
- sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1
+ ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\" \"$2\""
+ sh $i "$distribution" "$dist_version" "$package" "$am_distdir" "$2" || exit 1
done
ad_log ""
###############################################################################
# Autodist code
-usage="Usage: autodist [options] [distribution] [version]"
+usage="Usage: autodist [options] [distribution] [version] [params]"
help="\
Autodist prepares source tree for configuration, compilation and
distribution. Generates Automake.am files from Automake.ad files,
echo "@PACKAGE@ (@PACKAGE_NAME@) $ver" 1>&2;
echo "Written by Pekka Riikonen" 1>&2;
echo 1>&2;
- echo "Copyright (C) 2004 - 2005 SILC Project" 1>&2;
+ echo "Copyright (C) 2004 - 2007 SILC Project" 1>&2;
echo "\
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " 1>&2;
ad_fatal "DISTDEFS not defined in $distdir/autodist.conf"
fi
+# Get extra parameters from command line
+shift
+
#
# Run pre-hooks
#
-ad_run_hooks "$pre_hooks"
+ad_run_hooks "$pre_hooks" "$@"
#
# Generate the Makefile.am files from Makefile.ad files
echo "dist:$distfile" > autodist.dist
echo "ver:$dist_version" >> autodist.dist
echo "distdir:$package-$dist_version" >> autodist.dist
+echo "params:$@" >> autodist.dist
#
# Run post-hooks
#
-ad_run_hooks "$post_hooks"
+ad_run_hooks "$post_hooks" "$@"
ad_log "Source tree processed successfully."
ad_debug "Done, now run ./configure and make."
--- /dev/null
+Summary: Source distribution management system
+Name: autodist
+Version: AUTODIST_VERSION
+Release: AUTODIST_RELEASE
+License: BSD
+Group: Development/Tools
+URL: http://silcnet.org/software/developers/autodist/
+Source0: http://silcnet.org/download/autodist/sources/autodist-%{version}.tar.bz2
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: autoconf >= 2.58
+Requires: automake >= 1.9
+
+%description
+The Autodist is a source distribution management system that allows
+powerful mechanisms to define what is included in and excluded from a
+distribution, and what license the distribution is released under. It
+is also used to create the actual distribution source packages.
+Autodist allows distribution management in file, directory and file
+content level. Different distributions may include different portions
+of files, for example, excluding certain features from certain
+distributions. It is always guaranteed that anything not defined for
+the distribution, is removed automatically (files, file content,
+directories), thus ensuring that nothing is accidentally included in
+the distribution.
+
+%prep
+%setup -q
+
+%build
+./configure --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
+ --bindir=%{_bindir} --datadir=%{_datadir}
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm -f $RPM_BUILD_ROOT/%{_datadir}/autodist/COPYING
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root, -)
+%{_bindir}/*
+%{_datadir}/autodist/*.conf
+%{_datadir}/autodist/default
+%{_infodir}/autodist.info*
+%{_mandir}/man1/*
+%doc COPYING README TODO CHANGES AUTHORS
+
+%changelog
+* Thu May 31 2007 Pekka Riikonen <priikone@silcnet.org>
+- Initial version
Autodist \- Source distribution management system
.SH SYNOPSIS
.B autodist
-[options] [distribution] [version]
+[options] [distribution] [version] [params]
.PP
.SH DESCRIPTION
.PP
files. Otherwise the replacement will not be complete.
+@section Directive: prereq <version>
+
+The 'prereq' may be used to enforce the Autodist version. If the Autodist
+version used to process the distribution is older than the version
+specified with 'prereq' the Autodist will fail.
+
+Example:
+@example
+prereq 1.3.2
+@end example
+
+Will require Autodist 1.3.2 or newer for this distribution.
+
+
@section Directive: inherit <distfile>
The Autodist provides inheritance of distributions. The 'inherit'
'pre-hook' hook will be run immediately after invoking Autodist to start
preparing the source tree for configuration and compilation (@pxref{Preparing source tree, , , , }).
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution. The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when
+Autodist executes the script: distribution name, distribution version and
+package name of distribution. The script may use these arguments if it
+needs them. If user passed any extra parameters to autodist in the
+command line they will also be passed to the script as last arguments.
@section Directive: post-hook <filename> [...]
preparing the source three for configuration and compilation (@pxref{Preparing source tree, , , , }). The Autodist will exit after it has run the
'post-hook' scripts.
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution. The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when
+Autodist executes the script: distribution name, distribution version and
+package name of distribution. The script may use these arguments if it
+needs them. If user passed any extra parameters to autodist in the
+command line they will also be passed to the script as last arguments.
@section Directive: pre-process-dist-hook <filename> [...]
will be run immediately after the Autodist has created the distribution
directory but has not yet started any distribution processing.
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name. The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when
+Autodist executes the script: distribution name, distribution version,
+package name of distribution and destination distribution directory name.
+The script may use these arguments if it needs them. If user passed any
+extra parameters to autodist in the command line they will also be passed
+to the script as last arguments.
@section Directive: post-process-dist-hook <filename> [...]
has finished processing the destination distribution directory but has not
yet created the distribution package.
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name. The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when
+Autodist executes the script: distribution name, distribution version,
+package name of distribution and destination distribution directory name.
+The script may use these arguments if it needs them. If user passed any
+extra parameters to autodist in the command line they will also be passed
+to the script as last arguments.
@section Directive: pre-dist-hook <filename> [...]
the Autodist has started distribution creation, but has not yet created
the distribution directory. This hook is run before 'pre-process-dist-hook'.
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name. The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when
+Autodist executes the script: distribution name, distribution version,
+package name of distribution and destination distribution directory name.
+The script may use these arguments if it needs them. If user passed any
+extra parameters to autodist in the command line they will also be passed
+to the script as last arguments.
@section Directive: post-dist-hook <filename> [...]
immediately after the Autodist has finished creating the distribution
package. This is the last hook Autodist runs.
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name. The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when
+Autodist executes the script: distribution name, distribution version,
+package name of distribution and destination distribution directory name.
+The script may use these arguments if it needs them. If user passed any
+extra parameters to autodist in the command line they will also be passed
+to the script as last arguments.
@section Running hooks
define _DIST_NOMAD
define _DIST_NOMAD_LIB
undef _DIST_CRYPTO
+pre-dist-hook nomad-pre-dist-hook
@end example
@example
autodist libfoozbar 1.0.5
makedist
-autodist nomad 2.0
+Nomad has also an RPM .spec file that you have written and a pre-dist-hook
+that will replace the RPM release version with sed tool with the one you
+give as extra parameter to autodist:
+
+autodist nomad 2.0 0.fc7
makedist
@end example
-The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz'.
+The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz', and
+the RPM will have a release version '0.fc7' when you compile the RPM. Any
+extra parameter that you pass to autodist will be delivered to your hook
+scripts.
@page
@contents
if SILCPLUGIN
themedir = $(datadir)/irssi/themes
+theme_DATA = plugin.theme
else
themedir = $(datadir)/silc/themes
-endif
theme_DATA = default.theme plugin.theme
+endif
noinst_HEADERS = irssi-version.h.in
curses.m4 \
README \
file2header.sh \
- irssi.spec \
- irssi.spec.in \
+ silc-client.spec \
$(conffile) \
$(theme_DATA) \
irssi-config.in \
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2005 Pekka Riikonen
+# Copyright (C) 2005 - 2007 Pekka Riikonen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# help directory
#
-HELPDIR="$silc_prefix/help"
+HELPDIR="$datadir/silc/help"
AC_ARG_WITH(helpdir,
- [[ --with-helpdir=DIR directory for SILC Client help files [PREFIX/help]]],
+ [[ --with-helpdir=DIR directory for SILC Client help files [DATADIR/silc/help]]],
[
case "$withval" in
no|yes)
# Irssi SILC Plugin support
#
-AC_ARG_ENABLE(silc-plugin,
-[ --enable-silc-plugin Compile the SILC Plugin instead of the SILC Client])
+AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
+AC_ARG_WITH(silc-plugin,
+ [[ --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
+ Irssi location [/usr/lib/irssi]]],
+ [
+ case "${withval}" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ ;;
+ esac
+ ],[AC_MSG_RESULT(no)])
AC_CONFIG_SUBDIRS(apps/irssi)
AC_CONFIG_FILES(
-AC_INIT(src)
+AC_INIT([SILC-Client], [0.8.11+], [silc-devel@lists.silcnet.org], [silc-client])
# we don't want VERSION in our config.h
if test -n "`grep '^#undef VERSION' config.h.in`"; then
fi
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(SILC-Client, 0.8.11+)
+AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
# Irssi SILC Plugin support
#
-AC_ARG_ENABLE(silc-plugin,
-[ --enable-silc-plugin Compile the SILC Plugin instead of the SILC Client],
-[case "${enableval}" in
- yes) silc_plugin=true ;;
- no) silc_plugin=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-silc-plugin) ;;
-esac],[silc_plugin=false])
+SILC_IRSSIDIR=
+silc_plugin=false
+AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
+AC_ARG_WITH(silc-plugin,
+ [[ --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
+ Irssi location [/usr/lib/irssi]]],
+ [
+ case "${withval}" in
+ no)
+ AC_MSG_RESULT(no)
+ silc_plugin=false
+ ;;
+ yes)
+ AC_MSG_RESULT(yes)
+ silc_plugin=true
+ SILC_IRSSIDIR="/usr/lib/irssi/modules"
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ silc_plugin=true
+ SILC_IRSSIDIR="$withval/modules"
+ ;;
+ esac
+ ])
+
AM_CONDITIONAL(SILCPLUGIN, test x$silc_plugin = xtrue)
+AC_SUBST(SILC_IRSSIDIR)
AC_ARG_WITH(file-offset-size,
[ --with-file-offset-size=BITS Set size of file offsets. Usually 32 or 64.
docs/help/in/Makefile
irssi-version.h
stamp.h
-irssi.spec
irssi-config)
dnl ** for building from objdir
-include $(top_srcdir)/Makefile.defines.in
-
-docdir = $(silc_docdir)
-
doc_DATA = signals.txt formats.txt manual.txt startup-HOWTO.html \
special_vars.txt
-# faq.txt
-# startup-HOWTO.txt
EXTRA_DIST = $(doc_DATA)
if SILCPLUGIN
helpdir = $(datadir)/irssi/help/silc
SILCHELP = silc
+ED =
else
-helpdir = $(datadir)/irssi/help
-SILCHELP =
+helpdir = $(datadir)/silc/help
+SILCHELP =
+ED = silc
endif
EXTRA_DIST = \
Makefile.am.gen \
+ $(ED) \
$(help_DATA)
SUBDIRS = in
@SYNTAX:cmode@
-This command is used to manage the modes of the channel. Most
-of the modes require special privileges, such as channel operator
-or channel founder privileges to work. The mode is added by
-adding + before the option(s) and removed by adding - before the
-option(s). The (*) mark below means that only founder may set/unset
-that mode. Other modes both channel operator and founder may manage.
+ This command is used to manage the modes of the channel. Most
+ of the modes require special privileges, such as channel operator
+ or channel founder privileges to work. The mode is added by
+ adding + before the option(s) and removed by adding - before the
+ option(s). The (*) mark below means that only founder may set/unset
+ that mode. Other modes both channel operator and founder may manage.
-The following modes are available:
+ The following modes are available:
+
+ p Set/unset channel as private channel. Private
+ channels are shown with LIST command with an
+ indication the channel is private. Private
+ channel is not shown on user's joined channel
+ list (with for example WHOIS command).
- p Set/unset channel as private channel
s Set/unset channel as secret channel. Secret
- channel are not shown in user's channel list
- or with /LIST command.
- k Enable/disable channel private key usage (*)
- i Set/unset channel as invite only channel
+ channels are entirely invisible. They are not
+ shown with LIST command and they do not appear
+ in user's joined channel list.
+
+ k Enable/disable private channel key usage. (*)
+ When enabled KEY command may be used to set
+ private channel key(s) on the channel.
+
+ i Set/unset channel as invite only channel. If
+ you are the founder of the channel you will
+ still be able to join the channel by giving
+ command /JOIN channel -founder.
+
t Set/unset that only channel operator or
founder may set channel topic
+
m Set/unset user silencing. Normal users
- are not able to talk on channel. (*)
+ are not able to talk on channel. (*)
+
M Set/unset operator silencing. Operators
- are not able to talk on channel. (*)
- l <limit> Set/unset channel's user limit
+ are not able to talk on channel. (*)
+
+ l <limit> Set/unset channel's user count limit
+
a <passphrase> Set/unset passphrase for channel that must
- be provided when joining to the channel. (*)
- c <cipher> Set/unset channel's cipher (*)
- h <hmac> Set/unset channel's hmac (*)
+ be provided when joining to the channel. (*)
+
+ c <cipher> Set/unset channel's cipher (*)
+
+ h <hmac> Set/unset channel's HMAC (*)
+
f [<pubkeyfile> <privkeyfile> [<privkey passphrase>]]
- Set/unset channel founder authentication. (*)
+ Set/unset channel founder authentication. (*)
Channel founder may set this mode so that
- if the client leaves the channel it can
+ when the client leaves the channel it can
claim the founder rights when it returns
to the channel, and to set the channel to
- be permanent channel. You can claim the
+ be permanent channel. You can reclaim the
founder rights using CUMODE or JOIN commands.
If the <pubkeyfile> and <privkeyfile> is
server. If these are omitted then the default
SILC keypair is used. Normally you do not need
to provide these arguments.
- C [{[+|-]<pubkeyfile> }] (*)
+
+ C [{[+|-]<pubkeyfile> }] (*)
Set/unset channel public key mode, and add/remove
channel publics key from the channel public key
list. When this mode is set only those users
arguments the current channel public key list is
displayed.
-Multiple modes can be set/unset at once if the modes does not
-require any arguments. If mode requires an argument then only
-one mode can be set at once.
+ Multiple modes can be set/unset at once if the modes does not
+ require any arguments. If mode requires an argument then only
+ one mode can be set at once.
+
+ When the +k (private channel key mode) mode is set the channel's
+ default cipher and HMAC are not used. The private key (see /HELP KEY
+ for help how to set the private channel key) defines the cipher and
+ HMAC for the channel while +k mode is set. Also the +c and +h modes
+ are ignored when private channel key mode is set.
+
+Examples:
+
+ Set the channel a permanent (persistent). The channel won't be
+ deleted when last user leaves the channel. When you as the founder
+ leave the channel you will be able to reclaim the founder rights
+ later.
+
+ /CMODE * +f
+
+ Reclaim founder rights (and operator privileges) for you channel:
+
+ /CUMODE * +of mynick
+
+ You can do the same during joining:
+
+ /JOIN yourchannel -founder
+
+ Change channel founder keypair on your channel. You can do this if
+ you want to transfer founder rights to some other user or if you
+ created new keypair. The operation requires that you have a copy of
+ the old keypair:
+
+ /CUMODE * +f mynick /path/to/old/pubkey /path/to/old/privkey
+ /CMODE * +f /path/to/new/pubkey /path/to/new/privkey
+
+ or simply /CMODE * +f if you are already using the new keypair.
+
+ Here's how to transfer founder rights to different user using
+ temporary keypair. First, create temporary keypair:
+
+ # silc -C
+
+ Become founder on your channel:
+
+ /CUMODE * +f mynick
+
+ Set the temporary keypair on the channel and then send the key
+ pair to your friend with /FILE command or with encrypted Email:
+
+ /CMODE * +f /path/to/temp/pubkey /path/to/temp/privkey
+ (/FILE send /path/to/temp/keypair.tgz yourfriend)
+
+ Tell your friend to give the following command to become founder:
+
+ /CUMODE * +f yourfriend /path/to/temp/pubkey /path/to/temp/privkey
+
+ Your friend then sets his own keypair on the channel:
+
+ /CMODE * +f
-When the +k (channel private key mode) mode is set the channel's
-default cipher and HMAC are not used. The private key (see /HELP KEY
-for help how to set the private key) defines the cipher and HMAC for
-the channel while +k mode is set. Also the +c and +h modes are ignored
-when channel private key is set.
+ After this the temporary keypair can be removed and your friend has
+ become the founder of the channel. This way the founder rights can
+ be transferred without ever revealing your own keypair. When your
+ friend becomes the founder your founder rights will be removed by
+ the server automatically. It is also possible to continue using the
+ temporary keypair, thus sharing founder rights with two or more
+ users. Note that it is possible for only one user at a time to
+ have founder mode on the channel even if they share the keypair.
See also: CUMODE, UMODE, JOIN, KEY
@SYNTAX:cumode@
-This command is used to manage the users modes on the channel.
-Most of the modes require that the user which changes some
-other user's mode must be channel founder or channel operator. The
-mode is added by adding + before the option(s) and removed by
-adding - before the option(s). The following channel user modes
-are available:
+ This command is used to manage the users modes on the channel.
+ Most of the modes require that the user which changes some
+ other user's mode must be channel founder or channel operator.
+ The mode is added by adding + before the option(s) and removed
+ by adding - before the option(s). The following channel user
+ modes are available:
a <nickname>[@<server>]
Set/Unset channel founder. If you are channel
founder you can set the channel founder authentication
- using CMODEc command.
+ using the CMODE command.
If the <pubkeyfile> and <privkeyfile> is
provided then the <pubkeyfile> will the used
is used to compute a signature for the SILC
server. If these are omitted then the default
SILC keypair is used. Normally you do not need
- to provide these arguments.
+ to provide these arguments unless you want to use
+ different keypair for channel founder authentication.
o <nickname>[@<server>]
- Set/unset channel operator. Requires that
+ Set/unset channel operator. Requires that
you are channel operator or channel founder.
b <nickname>[@<server>]
unset this mode itself. This mode cannot be set
or unset to yourself.
+Examples:
+
+ Become a founder (and operator) on the channel that you have
+ founded and have set the founder mode:
+
+ /CUMODE * +of yournick
+ /CUMODE channel_name +f yournick
+
+ Give operator privileges to your Friend on this channel:
+
+ /CUMODE * +o Friend
+
+ Quiet misbehaving user on your channel:
+
+ /CUMODE * +q lamer
See also: CMODE, UMODE
@SYNTAX:key@
-This command is used to set and unset private keys for
-channels, set and unset private keys for private messages
-with remote clients and to send key agreement requests and
-negotiate the key agreement protocol with remote client.
-The key agreement is supported only to negotiate private
-message keys, it currently cannot be used to negotiate
-private keys for channels, as it is not convenient for that
-purpose.
+This command is used to set and unset private channel keys,
+set and unset private message keys with remote users, and
+to send key agreement requests and negotiate the key agreement
+protocol with remote user. The key agreement is supported only
+to negotiate private message keys, it currently cannot be used
+to negotiate channel private keys.
Types:
+++ /dev/null
-# $Revision$, $Date$
-Name: irssi
-Version: @VERSION@
-Release: 1
-Vendor: Timo Sirainen <cras@irssi.org>
-Summary: Irssi is a IRC client
-Copyright: GPL
-Group: Applications/Communications
-URL: http://irssi.org/
-Source0: http://irssi.org/irssi/files/%{name}-%{version}.tar.gz
-BuildRequires: glib-devel
-BuildRequires: ncurses-devel
-BuildRoot: /tmp/%{name}-%{version}-root
-
-%define _sysconfdir /etc
-%define configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; ./configure %{_target_platform} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} }
-
-%description
-Irssi is a modular IRC client that currently has only text
-mode user interface, but 80-90% of the code isn't text mode specific
-so other UI could be created pretty easily. Also, Irssi isn't really
-even IRC specific anymore, there's already a working SILC module
-available. Support for other protocols like ICQ could be create some day
-too.
-
-More information can be found at http://irssi.org/.
-
-%prep
-%setup -q
-
-%build
-export NOCONFIGURE=x
-./autogen.sh
-%configure \
- --with-imlib \
- --enable-ipv6 \
- --with-textui \
- --with-socks \
- --with-bot \
- --with-proxy \
- --with-perl=yes \
- --with-ncurses
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr install
-mv $RPM_BUILD_ROOT/%{_datadir}/doc/irssi $RPM_BUILD_ROOT/%{_datadir}/doc/irssi-%version
-strip $RPM_BUILD_ROOT/%{_bindir}/*
-strip $RPM_BUILD_ROOT/%{_libdir}/irssi/modules/lib*.so*
-rm -f $RPM_BUILD_ROOT/%{_libdir}/perl5/5.6.0/i386-linux/perllocal.pod
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr (644,root,root,755)
-%doc %{_datadir}/doc/irssi-%version/
-
-%attr(755,root,root) %{_bindir}/*
-
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/irssi*
-
-%dir %{_libdir}
-%attr(755,root,root) %{_libdir}/irssi
-%attr(755,root,root) %{_libdir}/perl5
-
-%dir %{_datadir}/irssi
-%attr(755,root,root) %{_datadir}/irssi/*
-
-%changelog
-* Fri Aug 17 2001 - Joose Vettenranta <joose@iki.fi>
- Created new spec file from spec file founded in irssi-0.7.98.3
SUBDIRS = examples
-scriptdir = $(datadir)/irssi/scripts
+PLUGIN_SCR = silc.pl
-script_DATA = \
+if SILCPLUGIN
+scriptdir = $(datadir)/irssi/scripts
+IRSSI_SCR =
+else
+scriptdir = $(datadir)/silc/scripts
+IRSSI_SCR = \
autoop.pl \
autorejoin.pl \
buf.pl \
mlock.pl \
quitmsg.pl \
scriptassist.pl \
- silc.pl \
splitlong.pl \
usercount.pl
+endif
+
+script_DATA = \
+ $(PLUGIN_SCR) \
+ $(IRSSI_SCR)
EXTRA_DIST = $(script_DATA)
-scriptdir = $(datadir)/irssi/scripts
-script_DATA = \
+if SILCPLUGIN
+scriptdir = $(datadir)/irssi/scripts
+IRSSI_EX_SCR =
+else
+scriptdir = $(datadir)/silc/scripts
+IRSSI_EX_SCR = \
command.pl \
msg-event.pl \
redirect.pl
+endif
+
+script_DATA = $(IRSSI_EX_SCR)
EXTRA_DIST = $(script_DATA)
--- /dev/null
+Summary: SILC Client
+Name: silc-client
+Version: SILC_VERSION
+Release: SILC_RELEASE
+License: GPL
+Group: Applications/Communications
+URL: http://silcnet.org/
+Source0: silc-client-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildRequires: silc-toolkit-devel
+Requires: silc-toolkit >= 1.1
+
+%description
+SILC (Secure Internet Live Conferencing) is a protocol which provides
+secure conferencing services on the Internet over insecure channel.
+SILC Client is used to connect to SILC server and SILC network.
+
+%prep
+%setup -q
+
+%build
+%configure --prefix=%{_prefix} \
+ --mandir=%{_mandir} \
+ --infodir=%{_infodir} \
+ --bindir=%{_bindir} \
+ --datadir=%{_datadir} \
+ --with-perl-lib=%{_libdir}/silc/perl5 \
+ --enable-ipv6 --with-socks --with-perl=yes
+make -j4
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+rm -f $RPM_BUILD_ROOT/%{_libdir}/silc/perl5/*/perllocal.pod
+mv $RPM_BUILD_ROOT/%{_datadir}/doc/silc-client \
+ $RPM_BUILD_ROOT/%{_datadir}/doc/silc-client-%version
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr (755,root,root,755)
+%{_bindir}/*
+%{_libdir}/silc/perl5
+%defattr (644,root,root,755)
+%{_sysconfdir}/silc.conf
+%{_mandir}/man1/*
+%{_datadir}/silc
+%doc %{_datadir}/doc
+
+%changelog
+* Sun Jun 3 2007 - Pekka Riikonen <priikone@silcnet.org>
+- Initial version
SBDRS=lib-popt lib-config core
endif
-pkginc_srcdir=$(pkgincludedir)/src
-pkginc_src_HEADERS = \
- common.h
noinst_HEADERS = \
common.h
-I$(top_srcdir)/src/core \
$(GLIB_CFLAGS) \
-DSYSCONFDIR=\""$(silc_etcdir)"\" \
- -DMODULEDIR=\""$(silc_modulesdir)"\"
+ -DMODULEDIR=\""@SILC_IRSSIDIR@"\"
libcore_a_SOURCES = \
args.c \
strcmp(name+rootlen, "_core") == 0)
return g_strdup("core");
- if (namelen+1 > rootlen && name[namelen-rootlen-1] == '_' &&
+ if (namelen > rootlen && name[namelen-rootlen-1] == '_' &&
strcmp(name+namelen-rootlen, root) == 0)
return g_strndup(name, namelen-rootlen-1);
include $(top_srcdir)/Makefile.defines.in
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
IRSSI_INCLUDE=../../..
libfe_common_silc.a: libfe_common_silc.la
cp .libs/libfe_common_silc.a .
+
+if SILCPLUGIN
+install-data-hook: libfe_common_silc.la
+ -ln -s libfe_common_silc.so $(DESTDIR)$(moduledir)/libfe_silc.so
+endif
void fe_silc_modules_init(void);
void fe_silc_modules_deinit(void);
-void fe_silc_init(void)
+static void silc_init(void)
{
theme_register(fecommon_silc_formats);
fe_silc_messages_init();
fe_silc_queries_init();
fe_silcnet_init();
+}
+
+void fe_common_silc_init(void)
+{
+ silc_init();
+ module_register("silc", "fe_common");
+}
+void fe_silc_init(void)
+{
+ silc_init();
module_register("silc", "fe");
}
-void fe_silc_deinit(void)
+void fe_common_silc_deinit(void)
{
fe_silc_queries_deinit();
fe_silc_messages_deinit();
theme_unregister();
}
+
+void fe_silc_deinit(void)
+{
+ fe_common_silc_deinit();
+}
const char *nickmode, *printnick;
int for_me, print_channel, level;
char *color, *freemsg = NULL;
+ HILIGHT_REC *hilight;
/* NOTE: this may return NULL if some channel is just closed with
/WINDOW CLOSE and server still sends the few last messages */
for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
nick_match_msg(chanrec, msg, server->nick);
- color = for_me ? NULL :
- (char *)hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC,
- msg);
+ hilight = for_me ? NULL :
+ hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
+ color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
print_channel = chanrec == NULL ||
!window_item_is_active((WI_ITEM_REC *) chanrec);
print_channel = TRUE;
level = MSGLEVEL_PUBLIC;
- if (for_me || color != NULL)
+ if (for_me)
level |= MSGLEVEL_HILIGHT;
if (settings_get_bool("emphasis"))
if (printnick == NULL)
printnick = nick;
- if (!print_channel) {
- /* message to active channel in window */
- if (color != NULL) {
- /* highlighted nick */
- printformat_module("fe-common/silc", server, target,
- level, VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
- color, printnick, msg, nickmode);
- } else {
- printformat_module("fe-common/silc", server, target, level,
- for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
- VERIFIED_MSG(verified,SILCTXT_PUBMSG),
- printnick, msg, nickmode);
- }
- } else {
- /* message to not existing/active channel */
- if (color != NULL) {
- /* highlighted nick */
- printformat_module("fe-common/silc", server, target, level,
+ if (color != NULL) {
+ /* highlighted nick */
+ TEXT_DEST_REC dest;
+ format_create_dest(&dest, server, target, level, NULL);
+ hilight_update_text_dest(&dest,hilight);
+ if (!print_channel) /* message to active channel in windpw */
+ printformat_module_dest("fe-common/silc", &dest,
+ VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
+ color, printnick, msg, nickmode);
+ else /* message to not existing/active channel */
+ printformat_module_dest("fe-common/silc", &dest,
VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT_CHANNEL),
color, printnick, target, msg, nickmode);
- } else {
+
+ } else {
+ if (!print_channel)
+ printformat_module("fe-common/silc", server, target, level,
+ for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
+ VERIFIED_MSG(verified,SILCTXT_PUBMSG),
+ printnick, msg, nickmode);
+ else
printformat_module("fe-common/silc", server, target, level,
for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME_CHANNEL) :
VERIFIED_MSG(verified, SILCTXT_PUBMSG_CHANNEL),
printnick, target, msg, nickmode);
- }
}
g_free_not_null(freemsg);
@PERL_LINK_LIBS@ \
@PERL_FE_LINK_LIBS@
-LIBS = $(SILC_COMMON_LIBS)
silc_LDADD = \
@COMMON_LIBS@ \
- -lsilcclient \
@PERL_LINK_LIBS@ \
@PERL_FE_LINK_LIBS@ \
+ $(SILC_COMMON_LDFLAGS) \
+ -lsilcclient \
+ $(SILC_COMMON_LIBS) \
@PERL_LINK_FLAGS@ \
@PROG_LIBS@ \
@TEXTUI_LIBS@
include $(top_srcdir)/Makefile.defines.in
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
if SILCPLUGIN
perl_dirs = silc
include $(top_srcdir)/Makefile.defines.in
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
IRSSI_INCLUDE=../../..
name = va_arg(va, char *);
client_entry = va_arg(va, SilcClientEntry);
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf) - 1, "%s@%s",
- client_entry->username, client_entry->hostname);
- signal_emit("message invite", 4, server, channel ? channel->channel_name :
- name, client_entry->nickname, buf);
+ silc_snprintf(buf, sizeof(buf) - 1, "%s@%s",
+ client_entry->username, client_entry->hostname);
+ signal_emit("message invite", 4, server, name,
+ client_entry->nickname, buf);
break;
case SILC_NOTIFY_TYPE_JOIN:
if (silc_client_on_channel(channel, client_entry2)) {
silc_snprintf(buf, sizeof(buf), "%s", client_entry2->nickname);
silc_client_nickname_format(client, conn, client_entry2, TRUE);
- if (!silc_utf8_strcasecmp(buf, client_entry2->nickname))
+ if (!silc_utf8_strcasecmp(buf, client_entry2->nickname)) {
+ nicklist_rename_unique(SERVER(server), client_entry2, buf,
+ client_entry2, client_entry2->nickname);
printformat_module("fe-common/silc", server, channel->channel_name,
MSGLEVEL_CRAP, SILCTXT_CHANNEL_USER_APPEARS,
buf, client_entry2->nickname);
+ }
}
silc_client_list_free(client, conn, clients);
silc_free(name);
if (silc_client_on_channel(channel, client_entry2)) {
silc_snprintf(buf, sizeof(buf), "%s", client_entry2->nickname);
silc_client_nickname_format(client, conn, client_entry2, TRUE);
- if (!silc_utf8_strcasecmp(buf, client_entry2->nickname))
+ if (!silc_utf8_strcasecmp(buf, client_entry2->nickname)) {
+ nicklist_rename_unique(SERVER(server), client_entry2, buf,
+ client_entry2, client_entry2->nickname);
printformat_module("fe-common/silc", server, channel->channel_name,
MSGLEVEL_CRAP, SILCTXT_CHANNEL_USER_APPEARS,
buf, client_entry2->nickname);
+ }
}
silc_client_list_free(client, conn, clients);
silc_free(name);
NICK_REC *ownnick;
if (SILC_STATUS_IS_ERROR(status)) {
+ if (status == SILC_STATUS_ERR_NO_SUCH_SERVER) {
+ char *tmp = va_arg(vp, char *);
+ if (tmp)
+ silc_say_error("JOIN: %s: %s", tmp,
+ silc_get_status_message(status));
+ return;
+ }
+ if (status == SILC_STATUS_ERR_NO_SUCH_CHANNEL) {
+ char *tmp = va_arg(vp, char *);
+ if (tmp)
+ silc_say_error("JOIN: %s: %s", tmp,
+ silc_get_status_message(status));
+ return;
+ }
silc_say_error("JOIN: %s", silc_get_status_message(status));
return;
}
int i=0;
items = g_strsplit(list, ",", -1);
-
+
while (items[i] != NULL)
printformat_module("fe-common/silc", NULL, NULL,
MSGLEVEL_CRAP, SILCTXT_CONFIG_LIST,
ENTRY_REDIRECT_FLAG_HIDDEN, rec);
return;
}
-
+
if ((rec->passphrase == NULL) && (answer) && (*answer != '\0')) {
rec->passphrase = g_strdup(answer);
keyboard_entry_redirect((SIGNAL_FUNC) change_private_key_passphrase,
}
if (silc_change_private_key_passphrase(rec->file, rec->old,
- (rec->passphrase == NULL ?
+ (rec->passphrase == NULL ?
"" : rec->passphrase)) == TRUE)
printformat_module("fe-common/silc", NULL, NULL,
MSGLEVEL_CRAP, SILCTXT_CONFIG_PASSCHANGE);
static int init_failed = 0;
#endif
-static int idletag = -1;
+static int running = 0;
/* SILC Client */
SilcClient silc_client = NULL;
void silc_core_deinit(void);
#endif
-static int my_silc_scheduler(void)
+static gboolean my_silc_scheduler(gpointer data)
{
+ SILC_LOG_DEBUG(("Timeout"));
silc_client_run_one(silc_client);
- return 1;
+ return FALSE;
+}
+
+static gboolean my_silc_scheduler_fd(GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ SILC_LOG_DEBUG(("I/O event, %d", SILC_PTR_TO_32(data)));
+ silc_client_run_one(silc_client);
+ return TRUE;
+}
+
+static void scheduler_notify_cb(SilcSchedule schedule,
+ SilcBool added, SilcTask task,
+ SilcBool fd_task, SilcUInt32 fd,
+ SilcTaskEvent event,
+ long seconds, long useconds,
+ void *context)
+{
+ if (added) {
+ if (fd_task) {
+ /* Add fd */
+ GIOChannel *ch;
+ guint e = 0;
+
+ SILC_LOG_DEBUG(("Add fd %d, events %d", fd, event));
+ g_source_remove_by_user_data(SILC_32_TO_PTR(fd));
+
+ if (event & SILC_TASK_READ)
+ e |= (G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR);
+ if (event & SILC_TASK_WRITE)
+ e |= (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL);
+
+ if (e) {
+ ch = g_io_channel_unix_new(fd);
+ g_io_add_watch(ch, e, my_silc_scheduler_fd, SILC_32_TO_PTR(fd));
+ g_io_channel_unref(ch);
+ }
+ } else {
+ /* Add timeout */
+ guint t;
+
+ t = (seconds * 1000) + (useconds / 1000);
+ SILC_LOG_DEBUG(("interval %d msec", t));
+ g_timeout_add(t, my_silc_scheduler, NULL);
+ }
+ } else {
+ if (fd_task) {
+ /* Remove fd */
+ g_source_remove_by_user_data(SILC_32_TO_PTR(fd));
+ }
+ }
}
static CHATNET_REC *create_chatnet(void)
static void
silc_running(SilcClient client, void *context)
{
+ running = 1;
SILC_LOG_DEBUG(("Client library is running"));
}
return;
}
+ silc_schedule_set_notify(silc_client->schedule, scheduler_notify_cb, NULL);
+
silc_log_set_callback(SILC_LOG_INFO, silc_log_misc, NULL);
silc_log_set_callback(SILC_LOG_WARNING, silc_log_misc, NULL);
silc_log_set_callback(SILC_LOG_ERROR, silc_log_misc, NULL);
silc_hash_alloc("sha1", &sha1hash);
- /* register SILC scheduler */
- idletag = g_timeout_add(5, (GSourceFunc) my_silc_scheduler, NULL);
+ /* Run SILC scheduler */
+ my_silc_scheduler(NULL);
}
/* Init SILC. Called from src/fe-text/silc.c */
/* Initialize client parameters */
memset(¶ms, 0, sizeof(params));
strcat(params.nickname_format, settings_get_str("nickname_format"));
+ params.full_channel_names = TRUE;
/* Allocate SILC client */
silc_client = silc_client_alloc(&ops, ¶ms, NULL, silc_version_string);
void silc_core_deinit(void)
{
- if (idletag != -1)
- g_source_remove(idletag);
-
- int stopped = 0;
- silc_client_stop(silc_client, silc_stopped, &stopped);
-
- while (!stopped)
- silc_client_run_one(silc_client);
+ if (running) {
+ volatile int stopped = 0;
+ silc_client_stop(silc_client, silc_stopped, (void *)&stopped);
+ while (!stopped)
+ silc_client_run_one(silc_client);
+ }
if (opt_hostname)
silc_free(opt_hostname);
chat_protocol_unregister("SILC");
- silc_pkcs_public_key_free(irssi_pubkey);
- silc_pkcs_private_key_free(irssi_privkey);
+ if (irssi_pubkey)
+ silc_pkcs_public_key_free(irssi_pubkey);
+ if (irssi_privkey)
+ silc_pkcs_private_key_free(irssi_privkey);
silc_client_free(silc_client);
}
clients = silc_client_get_clients_local(silc_client, server->conn,
rec->nick, FALSE);
if (!clients) {
- printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
- "%s: There is no such client (did you mean %s?)", rec->nick,
- target->nickname);
+ if (strchr(rec->nick, '@') && target->server)
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client (did you mean %s@%s?)", rec->nick,
+ target->nickname, target->server);
+ else
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client (did you mean %s?)", rec->nick,
+ target->nickname);
goto out;
}
void *context)
{
SILC_SERVER_REC *server = context;
+ FtpSession ftp;
char *file;
SILC_LOG_DEBUG(("Connection callback %p, status %d, error %d, message %s",
silc_get_status_message(error), error,
message ? message : "");
+ /* Close FTP sessions */
+ silc_dlist_start(server->ftp_sessions);
+ while ((ftp = silc_dlist_get(server->ftp_sessions)))
+ silc_client_file_close(client, conn, ftp->session_id);
+ silc_dlist_uninit(server->ftp_sessions);
+
if (server->conn)
server->conn->context = NULL;
server->conn = NULL;
if (!IS_SILC_SERVER(server))
return;
- silc_dlist_uninit(server->ftp_sessions);
-
if (server->conn) {
/* Close connection */
silc_client_close_connection(silc_client, server->conn);
}
/* SILC closes the handle */
- g_io_channel_unref(net_sendbuffer_handle(server->handle));
- net_sendbuffer_destroy(server->handle, FALSE);
- server->handle = NULL;
+ if (server->handle) {
+ g_io_channel_unref(net_sendbuffer_handle(server->handle));
+ net_sendbuffer_destroy(server->handle, FALSE);
+ server->handle = NULL;
+ }
}
SERVER_REC *silc_server_init_connect(SERVER_CONNECT_REC *conn)
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_WHOIS, cmd, 1, 256);
- silc_server_query_command(cmd->server, SILC_COMMAND_WHOIS, cmd);
+ silc_server_query_command(cmd->server, SILC_COMMAND_WHOIS, cmd, NULL);
silc_server_command_free(cmd);
}
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_WHOWAS, cmd, 1, 2);
- silc_server_query_command(cmd->server, SILC_COMMAND_WHOWAS, cmd);
+ silc_server_query_command(cmd->server, SILC_COMMAND_WHOWAS, cmd, NULL);
silc_server_command_free(cmd);
}
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_IDENTIFY, cmd, 1, 256);
- silc_server_query_command(cmd->server, SILC_COMMAND_IDENTIFY, cmd);
+ silc_server_query_command(cmd->server, SILC_COMMAND_IDENTIFY, cmd, NULL);
silc_server_command_free(cmd);
}
if (client) {
/* Free all client specific data, such as client entry and entires
on channels this client may be on. */
- silc_server_free_client_data(server, q->sock, client,
- TRUE, q->signoff);
- silc_packet_set_context(q->sock, NULL);
+ silc_server_free_sock_user_data(server, q->sock, q->signoff);
+ silc_server_close_connection(server, q->sock);
}
silc_packet_stream_unref(q->sock);
comment = silc_argument_get_arg_type(cmd->args, 2, &tmp_len2);
if (comment && tmp_len2 > 128) {
tmp_len2 = 128;
- comment[127] = '\0';
+ comment[tmp_len2 - 1] = '\0';
}
/* If authentication data is provided then verify that killing is
/* Server side of command JOIN. Joins client into requested channel. If
the channel does not exist it will be created. */
+void silc_server_command_join_connected(SilcServer server,
+ SilcServerEntry server_entry,
+ void *context)
+{
+ SilcServerCommandContext cmd = (SilcServerCommandContext)context;
+
+ if (!server_entry) {
+ SilcUInt32 tmp_len;
+ unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 1, &tmp_len);
+ char serv[256 + 1];
+
+ SILC_LOG_DEBUG(("Connecting to router failed"));
+ silc_parse_userfqdn(tmp, NULL, 0, serv, sizeof(serv));
+
+ if (serv[0]) {
+ silc_server_command_send_status_data(cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_NO_SUCH_SERVER, 0,
+ 2, serv, strlen(serv));
+ } else {
+ silc_server_command_send_status_data(cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_NO_SUCH_CHANNEL, 0,
+ 2, tmp, tmp_len);
+ }
+ silc_server_command_free(cmd);
+ return;
+ }
+
+ /* Reprocess command */
+ SILC_LOG_DEBUG(("Reprocess JOIN after connecting to router"));
+ silc_server_command_join(cmd, NULL);
+}
+
SILC_SERVER_CMD_FUNC(join)
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
unsigned char *auth, *cauth;
SilcUInt32 tmp_len, auth_len, cauth_len;
char *tmp, *channel_name, *channel_namec = NULL, *cipher, *hmac;
+ char parsed[256 + 1], serv[256 + 1];
SilcChannelEntry channel;
SilcUInt32 umode = 0;
SilcBool created = FALSE, create_key = TRUE;
/* Truncate over long channel names */
if (tmp_len > 256) {
- tmp[tmp_len - 1] = '\0';
tmp_len = 256;
+ tmp[tmp_len - 1] = '\0';
+ }
+
+ /* Parse server name from the channel name */
+ silc_parse_userfqdn(tmp, parsed, sizeof(parsed), serv,
+ sizeof(serv));
+ channel_name = parsed;
+
+ if (server->config->dynamic_server) {
+ /* If server name is not specified but local channels is FALSE then the
+ channel will be global, based on our router name. */
+ if (!serv[0] && !server->config->local_channels) {
+ if (!server->standalone) {
+ silc_snprintf(serv, sizeof(serv), server->router->server_name);
+ } else {
+ SilcServerConfigRouter *router;
+ router = silc_server_config_get_primary_router(server);
+ if (router) {
+ /* Create connection to primary router */
+ SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+ router->host, router->port));
+ silc_server_create_connection(server, FALSE, TRUE,
+ router->host, router->port,
+ silc_server_command_join_connected,
+ cmd);
+ return;
+ }
+ }
+ }
+
+ /* If server name is ours, ignore it. */
+ if (serv[0] && silc_utf8_strcasecmp(serv, server->server_name))
+ memset(serv, 0, sizeof(serv));
+
+ /* Create connection */
+ if (serv[0] && server->standalone) {
+ SilcServerConfigRouter *router;
+ router = silc_server_config_get_primary_router(server);
+ if (router) {
+ /* Create connection to primary router */
+ SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+ router->host, router->port));
+ silc_server_create_connection(server, FALSE, TRUE,
+ router->host, router->port,
+ silc_server_command_join_connected, cmd);
+ return;
+ }
+ }
}
- channel_name = tmp;
/* Check for valid channel name. This is cached, the original is saved
in the channel context. */
- channel_namec = silc_channel_name_check(tmp, tmp_len, SILC_STRING_UTF8, 256,
- NULL);
+ channel_namec = silc_channel_name_check(channel_name, strlen(channel_name),
+ SILC_STRING_UTF8, 256, NULL);
if (!channel_namec) {
silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
SILC_STATUS_ERR_BAD_CHANNEL, 0);
channel = silc_server_create_new_channel(server, server->id, cipher,
hmac, channel_name, TRUE);
if (!channel) {
- silc_server_command_send_status_data(
- cmd, SILC_COMMAND_JOIN,
- SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
- 0, 2, cipher, strlen(cipher));
+ if (cipher) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, cipher, strlen(cipher));
+ } else if (hmac) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, hmac, strlen(hmac));
+ } else {
+ silc_server_command_send_status_reply(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_RESOURCE_LIMIT,
+ 0);
+ }
goto out;
}
channel = silc_server_create_new_channel(server, server->id, cipher,
hmac, channel_name, TRUE);
if (!channel) {
- silc_server_command_send_status_data(
- cmd, SILC_COMMAND_JOIN,
- SILC_STATUS_ERR_UNKNOWN_ALGORITHM, 0,
- 2, cipher, strlen(cipher));
+ if (cipher) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, cipher, strlen(cipher));
+ } else if (hmac) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, hmac, strlen(hmac));
+ } else {
+ silc_server_command_send_status_reply(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_RESOURCE_LIMIT,
+ 0);
+ }
goto out;
}
channel = silc_server_create_new_channel(server, server->id, cipher,
hmac, channel_name, TRUE);
if (!channel) {
- silc_server_command_send_status_data(
- cmd, SILC_COMMAND_JOIN,
- SILC_STATUS_ERR_UNKNOWN_ALGORITHM, 0,
- 2, cipher, strlen(cipher));
+ if (cipher) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, cipher, strlen(cipher));
+ } else if (hmac) {
+ silc_server_command_send_status_data(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+ 0, 2, hmac, strlen(hmac));
+ } else {
+ silc_server_command_send_status_reply(
+ cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_RESOURCE_LIMIT,
+ 0);
+ }
goto out;
}
}
if (add_nick && add_nick_len > 128) {
- add_nick[128] = '\0';
add_nick_len = 128;
+ add_nick[add_nick_len - 1] = '\0';
}
if (del_nick && del_nick_len > 128) {
- del_nick[128] = '\0';
del_nick_len = 128;
+ del_nick[del_nick_len - 1] = '\0';
}
/* Add new nickname to be watched in our cell */
username = silc_identifier_check(username, tmp_len, SILC_STRING_UTF8, 128,
&tmp_len);
if (!username) {
- silc_server_command_send_status_reply(cmd, SILC_COMMAND_OPER,
+ silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
SILC_STATUS_ERR_BAD_USERNAME,
0);
goto out;
}
if (!result) {
/* Authentication failed */
- silc_server_command_send_status_reply(cmd, SILC_COMMAND_OPER,
+ silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
SILC_STATUS_ERR_AUTH_FAILED, 0);
goto out;
}
SILC_GET32_MSB(port, tmp);
/* Create the connection. It is done with timeout and is async. */
- silc_server_create_connection(server, FALSE, host, port, NULL, NULL);
+ silc_server_create_connection(server, FALSE, FALSE, host, port, NULL, NULL);
/* Send reply to the sender */
silc_server_command_send_status_reply(cmd, SILC_COMMAND_PRIV_CONNECT,
return FALSE;
}
- /* Remove the old cache entry */
- silc_idcache_del_by_context(global ? server->global_list->clients :
- server->local_list->clients, client, NULL);
+ /* Update entry */
+ silc_idcache_update_by_context(global ? server->global_list->clients :
+ server->local_list->clients, client, NULL,
+ nickname, TRUE);
silc_free(client->nickname);
silc_free(client->username);
client->mode = mode;
client->data.status |= SILC_IDLIST_STATUS_RESOLVED;
client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
-
- /* Create new cache entry */
- silc_idcache_add(global ? server->global_list->clients :
- server->local_list->clients, nickname, client->id,
- client);
}
/* Save channel list if it was sent to us */
silc_hmac_free(hmac);
silc_server_command_reply_free(cmd);
- silc_pkcs_public_key_free(founder_key);
+ if (founder_key)
+ silc_pkcs_public_key_free(founder_key);
if (client_id_list)
silc_buffer_free(client_id_list);
if (client_mode_list)
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
idata->public_key = NULL;
}
-/* Purges ID cache */
-
-SILC_TASK_CALLBACK(silc_idlist_purge)
-{
- SilcServer server = app_context;
- SilcIDListPurge i = (SilcIDListPurge)context;
-
- SILC_LOG_DEBUG(("Purging cache"));
-
-#if 0
- /* XXX */
- silc_idcache_purge(i->cache);
- silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge, i,
- i->timeout, 0);
-#endif
-}
-
/******************************************************************************
Server entry functions
int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
{
- SILC_LOG_DEBUG(("Start"));
+ SILC_LOG_DEBUG(("Delete client %p", entry));
if (entry) {
/* Delete client, destructor will free data */
is returned to `clients_count'. Caller must free the returned table.
The 'nickname' must be normalized already. */
-int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
+int silc_idlist_get_clients_by_hash(SilcIDList id_list,
+ char *nickname, char *server,
SilcHash md5hash,
SilcClientEntry **clients,
SilcUInt32 *clients_count)
SilcIDCacheEntry id_cache = NULL;
unsigned char hash[SILC_HASH_MAXLEN];
SilcClientID client_id;
+ SilcClientEntry client_entry;
SILC_LOG_DEBUG(("Start"));
if (!silc_idcache_find_by_id(id_list->clients, &client_id, &list))
return FALSE;
+ /* If server is specified, narrow the search with it. */
+ if (server) {
+ silc_list_start(list);
+ while ((id_cache = silc_list_get(list))) {
+ client_entry = id_cache->context;
+ if (!client_entry->servername)
+ continue;
+ if (!silc_utf8_strcasecmp(client_entry->servername, server))
+ silc_list_del(list, id_cache);
+ }
+ }
+
+ if (!silc_list_count(list))
+ return FALSE;
+
*clients = silc_realloc(*clients,
(silc_list_count(list) + *clients_count) *
sizeof(**clients));
client = (SilcClientEntry)id_cache->context;
- /* Remove the old entry and add a new one */
-
- if (!silc_idcache_del_by_context(id_list->clients, client, server))
- return NULL;
-
/* Check if anyone is watching old nickname */
if (server->server_type == SILC_ROUTER)
silc_server_check_watcher_list(server, client, nickname,
SILC_NOTIFY_TYPE_NICK_CHANGE);
+ /* Replace */
+ if (!silc_idcache_update(id_list->clients, id_cache, new_id, nicknamec,
+ TRUE))
+ return NULL;
+
silc_free(client->nickname);
- *client->id = *new_id;
client->nickname = nickname ? strdup(nickname) : NULL;
/* Check if anyone is watching new nickname */
silc_server_check_watcher_list(server, client, nickname,
SILC_NOTIFY_TYPE_NICK_CHANGE);
- if (!silc_idcache_add(id_list->clients, nicknamec, client->id,
- client))
- return NULL;
-
SILC_LOG_DEBUG(("Replaced"));
return client;
/* Connection data */
void *connection;
+
+ void *backup_proto;
+ unsigned int backup : 1; /* Set when executing backup protocol */
};
/*
typedef struct {
/* Generic data structure. DO NOT add anything before this! */
SilcIDListDataStruct data;
+ SilcAsyncOperation op;
SilcServerConfigRef cconfig;
SilcServerConfigRef sconfig;
SilcServerConfigRef rconfig;
char *server,
SilcClientEntry **clients,
SilcUInt32 *clients_count);
-int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
+int silc_idlist_get_clients_by_hash(SilcIDList id_list,
+ char *nickname, char *server,
SilcHash md5hash,
SilcClientEntry **clients,
SilcUInt32 *clients_count);
SilcUInt32 tmp_len, tmp2_len;
SilcBool local, ret;
- if (idata->conn_type == SILC_CONN_CLIENT ||
- packet->src_id_type != SILC_ID_SERVER || !packet->dst_id) {
+ if (idata->conn_type == SILC_CONN_CLIENT) {
+ SILC_LOG_DEBUG(("Notify received from client, drop it"));
+ return;
+ }
+
+ if (packet->src_id_type != SILC_ID_SERVER){
+ SILC_LOG_DEBUG(("Bad notify packet received"));
+ return;
+ }
+
+ if (!packet->dst_id) {
SILC_LOG_DEBUG(("Bad notify packet received"));
return;
}
/* Parse the Notify Payload */
payload = silc_notify_payload_parse(buffer->data, silc_buffer_len(buffer));
- if (!payload)
+ if (!payload) {
+ SILC_LOG_DEBUG(("Marlformed notify payload"));
return;
+ }
/* If we are router and this packet is not already broadcast packet
we will broadcast it. The sending socket really cannot be router or
/* Packet is destined to channel */
if (!silc_id_str2id(packet->dst_id, packet->dst_id_len,
packet->dst_id_type, &channel_id,
- sizeof(channel_id)))
+ sizeof(channel_id))) {
+ SILC_LOG_DEBUG(("Malformed destination ID in notify packet"));
goto out;
+ }
silc_server_packet_send_dest(server, SILC_PRIMARY_ROUTE(server),
packet->type, packet->flags |
type = silc_notify_get_type(payload);
args = silc_notify_get_args(payload);
- if (!args)
+ if (!args) {
+ SILC_LOG_DEBUG(("Notify doesn't have any arguments, drop it"));
goto out;
+ }
switch(type) {
case SILC_NOTIFY_TYPE_JOIN:
channel = silc_idlist_find_channel_by_id(server->local_list,
SILC_ID_GET_ID(id), NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
&channel_id, NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(&channel_id, SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
&channel_id, NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(&channel_id, SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
&channel_id, NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(&channel_id, SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
&channel_id, NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(&channel_id, SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
SILC_ID_GET_ID(id), NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->global_list,
SILC_ID_GET_ID(id), NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
goto out;
}
}
/* Get client entry */
client = silc_idlist_find_client_by_id(server->global_list,
- SILC_ID_GET_ID(id),
+ SILC_ID_GET_ID(id2),
TRUE, &cache);
local = FALSE;
if (!client) {
client = silc_idlist_find_client_by_id(server->local_list,
- SILC_ID_GET_ID(id),
+ SILC_ID_GET_ID(id2),
TRUE, &cache);
local = TRUE;
if (!client)
channel = silc_idlist_find_channel_by_id(server->local_list,
&channel_id, NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
goto out;
}
}
channel = silc_idlist_find_channel_by_id(server->local_list,
SILC_ID_GET_ID(id), NULL);
if (!channel) {
- SILC_LOG_DEBUG(("Notify for unknown channel"));
+ SILC_LOG_DEBUG(("Notify for unknown channel %s",
+ silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
goto out;
}
}
break;
default:
+ SILC_LOG_DEBUG(("Unsupported notify %d", type));
break;
}
global list. Cell wide information however is kept in the local
list. */
entry = silc_idlist_add_client(id_list, NULL, NULL, NULL,
- &id, router, NULL);
+ silc_id_dup(&id, SILC_ID_CLIENT),
+ router, NULL);
if (!entry) {
SILC_LOG_ERROR(("Could not add new client to the ID Cache"));
/* As a router we keep information of all global information in our
global list. Cell wide information however is kept in the local
list. */
- entry = silc_idlist_add_server(id_list, NULL, 0, &id, router,
+ entry = silc_idlist_add_server(id_list, NULL, 0,
+ silc_id_dup(&id, SILC_ID_SERVER), router,
router_sock);
if (!entry) {
SILC_LOG_ERROR(("Could not add new server to the ID Cache"));
}
/* Create the channel with the provided Channel ID */
- channel = silc_server_create_new_channel_with_id(server, NULL, NULL,
- channel_name,
- &channel_id, FALSE);
+ channel =
+ silc_server_create_new_channel_with_id(
+ server, NULL, NULL,
+ channel_name,
+ silc_id_dup(&channel_id, SILC_ID_CHANNEL),
+ FALSE);
if (!channel) {
silc_channel_payload_free(payload);
return;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SILC_TASK_CALLBACK(silc_server_get_stats);
SILC_TASK_CALLBACK(silc_server_connect_router);
+SILC_TASK_CALLBACK(silc_server_connect_to_router_retry);
SILC_TASK_CALLBACK(silc_server_do_rekey);
SILC_TASK_CALLBACK(silc_server_purge_expired_clients);
static void silc_server_accept_new_connection(SilcNetStatus status,
SilcServer server = callback_context;
SilcIDListData idata = stream_context;
+ if (!idata)
+ return FALSE;
+
/* Packets we do not handle */
switch (packet->type) {
case SILC_PACKET_HEARTBEAT:
silc_server_close_connection(server, stream);
}
+SILC_TASK_CALLBACK(silc_server_packet_error_timeout)
+{
+ SilcServer server = app_context;
+ SilcPacketStream stream = context;
+ SilcIDListData idata = silc_packet_get_context(stream);
+
+ if (!idata)
+ return;
+
+ if (server->router_conn && server->router_conn->sock == stream &&
+ !server->router && server->standalone) {
+ silc_server_create_connections(server);
+ } else {
+ /* If backup disconnected then mark that resuming will not be allowed */
+ if (server->server_type == SILC_ROUTER && !server->backup_router &&
+ idata->conn_type == SILC_CONN_SERVER) {
+ SilcServerEntry server_entry = (SilcServerEntry)idata;
+ if (server_entry->server_type == SILC_BACKUP_ROUTER)
+ server->backup_closed = TRUE;
+ }
+
+ silc_server_free_sock_user_data(server, stream, NULL);
+ }
+
+ silc_server_close_connection(server, stream);
+}
+
/* Packet engine callback to indicate error */
static void silc_server_packet_error(SilcPacketEngine engine,
void *callback_context,
void *stream_context)
{
+ SilcServer server = callback_context;
SilcIDListData idata = silc_packet_get_context(stream);
SilcStream sock = silc_packet_stream_get_stream(stream);
const char *ip;
if (!silc_socket_stream_get_info(sock, NULL, NULL, &ip, &port))
return;
- SILC_LOG_ERROR(("Connection %s:%d [%s]: %s",
- SILC_CONNTYPE_STRING(idata->conn_type), ip, port,
+ SILC_LOG_ERROR(("Connection %s:%d [%s]: %s", ip, port,
+ SILC_CONNTYPE_STRING(idata->conn_type),
silc_packet_error_string(error)));
+
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_packet_error_timeout,
+ stream, 0, 0);
}
/* Packet stream callbacks */
status = (SilcStatus)packet->buffer.data[0];
if (silc_buffer_len(&packet->buffer) > 1 &&
- silc_utf8_valid(packet->buffer.data + 1, silc_buffer_len(&packet->buffer) - 1))
+ silc_utf8_valid(packet->buffer.data + 1,
+ silc_buffer_len(&packet->buffer) - 1))
message = silc_memdup(packet->buffer.data + 1,
silc_buffer_len(&packet->buffer) - 1);
- if (!silc_socket_stream_get_info(sock, NULL, &hostname, &ip, NULL))
+ if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+ NULL, &hostname, &ip, NULL))
break;
SILC_LOG_INFO(("Disconnected by %s (%s): %s (%d) %s", ip, hostname,
server->backup_noswitch = (status == SILC_STATUS_OK ? FALSE : TRUE);
/* If backup disconnected then mark that resuming will not be allowed */
-#if 0
if (server->server_type == SILC_ROUTER && !server->backup_router &&
- sock->type == SILC_CONN_SERVER && sock->user_data) {
- SilcServerEntry server_entry = sock->user_data;
+ idata->conn_type == SILC_CONN_SERVER) {
+ SilcServerEntry server_entry = (SilcServerEntry)idata;
if (server_entry->server_type == SILC_BACKUP_ROUTER)
server->backup_closed = TRUE;
}
/* Handle the disconnection from our end too */
- if (sock->user_data && SILC_IS_LOCAL(sock->user_data))
+ if (SILC_IS_LOCAL(idata))
silc_server_free_sock_user_data(server, sock, NULL);
- SILC_SET_DISCONNECTING(sock);
silc_server_close_connection(server, sock);
server->backup_noswitch = FALSE;
-#endif
}
break;
router resuming protocol. */
if (packet->flags & SILC_PACKET_FLAG_LIST)
break;
-#if 0
silc_server_backup_resume_router(server, sock, packet);
-#endif
break;
default:
{
SilcList list;
SilcIDCacheEntry cache;
+ SilcIDListData idata;
+
+ SILC_LOG_DEBUG(("Free server %p", server));
if (!server)
return;
silc_pkcs_private_key_free(server->private_key);
if (server->pending_commands)
silc_dlist_uninit(server->pending_commands);
- if (server->id_entry)
+ if (server->id_entry) {
+ if (server->id_entry->data.sconn)
+ silc_schedule_task_del_by_context(server->schedule,
+ server->id_entry->data.sconn->sock);
silc_idlist_del_server(server->local_list, server->id_entry);
+ }
/* Delete all channels */
if (silc_idcache_get_all(server->local_list->channels, &list)) {
/* Delete all clients */
if (silc_idcache_get_all(server->local_list->clients, &list)) {
silc_list_start(list);
- while ((cache = silc_list_get(list)))
+ while ((cache = silc_list_get(list))) {
+ silc_schedule_task_del_by_context(server->schedule, cache->context);
silc_idlist_del_client(server->local_list, cache->context);
+ }
}
if (silc_idcache_get_all(server->global_list->clients, &list)) {
silc_list_start(list);
- while ((cache = silc_list_get(list)))
+ while ((cache = silc_list_get(list))) {
+ silc_schedule_task_del_by_context(server->schedule, cache->context);
silc_idlist_del_client(server->global_list, cache->context);
+ }
}
/* Delete all servers */
if (silc_idcache_get_all(server->local_list->servers, &list)) {
silc_list_start(list);
- while ((cache = silc_list_get(list)))
+ while ((cache = silc_list_get(list))) {
+ idata = (SilcIDListData)cache->context;
+ if (idata->sconn)
+ silc_schedule_task_del_by_context(server->schedule,
+ idata->sconn->sock);
silc_idlist_del_server(server->local_list, cache->context);
+ }
}
if (silc_idcache_get_all(server->global_list->servers, &list)) {
- while ((cache = silc_list_get(list)))
+ while ((cache = silc_list_get(list))) {
+ idata = (SilcIDListData)cache->context;
+ if (idata->sconn)
+ silc_schedule_task_del_by_context(server->schedule,
+ idata->sconn->sock);
silc_idlist_del_server(server->global_list, cache->context);
+ }
}
silc_idcache_free(server->local_list->clients);
silc_skr_free(server->repository);
silc_packet_engine_stop(server->packet_engine);
+ silc_schedule_task_del_by_context(server->schedule, server);
+ silc_schedule_uninit(server->schedule);
+ server->schedule = NULL;
+
silc_free(server->local_list);
silc_free(server->global_list);
silc_free(server->server_name);
- silc_free(server->purge_i);
- silc_free(server->purge_g);
silc_free(server);
silc_hmac_unregister_all();
SilcBool silc_server_init_secondary(SilcServer server)
{
- return TRUE;
-#if 0
- int sock = 0;
- SilcPacketStream newsocket = NULL;
SilcServerConfigServerInfoInterface *interface;
+ SilcNetListener listener;
for (interface = server->config->server_info->secondary; interface;
- interface = interface->next, sock++) {
-
- if (!silc_server_listen(server,
- interface->server_ip, interface->port, &sock_list[sock]))
- goto err;
-
- /* Set socket to non-blocking mode */
- silc_net_set_socket_nonblock(sock_list[sock]);
-
- /* Add ourselves also to the socket table. The entry allocated above
- is sent as argument for fast referencing in the future. */
- silc_socket_alloc(sock_list[sock],
- SILC_CONN_SERVER, NULL, &newsocket);
- server->sockets[sock_list[sock]] = newsocket;
- SILC_SET_LISTENER(newsocket);
-
- /* Perform name and address lookups to resolve the listenning address
- and port. */
- if (!silc_net_check_local_by_sock(sock_list[sock], &newsocket->hostname,
- &newsocket->ip)) {
- if ((server->config->require_reverse_lookup && !newsocket->hostname) ||
- !newsocket->ip) {
- SILC_LOG_ERROR(("IP/DNS lookup failed for local host %s",
- newsocket->hostname ? newsocket->hostname :
- newsocket->ip ? newsocket->ip : ""));
- server->stat.conn_failures++;
- goto err;
- }
- if (!newsocket->hostname)
- newsocket->hostname = strdup(newsocket->ip);
- }
- newsocket->port = silc_net_get_local_port(sock);
-
- newsocket->user_data = (void *)server->id_entry;
- silc_schedule_task_add(server->schedule, sock_list[sock],
- silc_server_accept_new_connection,
- (void *)server, 0, 0,
- SILC_TASK_FD,
- SILC_TASK_PRI_NORMAL);
+ interface = interface->next) {
+ listener = silc_server_listen(server, interface->server_ip,
+ interface->port);
+ if (!listener)
+ return FALSE;
+ silc_dlist_add(server->listeners, listener);
}
return TRUE;
-
- err:
- do silc_net_close_server(sock_list[sock--]); while (sock >= 0);
-#endif /* 0 */
- return FALSE;
}
/* Initializes the entire SILC server. This is called always before running
{
SilcServerID *id;
SilcServerEntry id_entry;
- SilcIDListPurge purge;
SilcNetListener listener;
SilcUInt16 *port;
char **ip;
server->config->server_info->primary->port);
if (!listener)
goto err;
-
silc_dlist_add(server->listeners, listener);
/* Create a Server ID for the server. */
port = silc_net_listener_get_port(listener, NULL);
ip = silc_net_listener_get_ip(listener, NULL);
- silc_id_create_server_id(ip[0], port[0], server->rng, &id);
+ silc_id_create_server_id(server->config->server_info->primary->public_ip ?
+ server->config->server_info->primary->public_ip :
+ ip[0], port[0], server->rng, &id);
if (!id)
goto err;
the ID list. */
id_entry =
silc_idlist_add_server(server->local_list, strdup(server->server_name),
- server->server_type, server->id, NULL, NULL);
+ server->server_type,
+ silc_id_dup(server->id, SILC_ID_SERVER),
+ NULL, NULL);
if (!id_entry) {
SILC_LOG_ERROR(("Could not add local server to cache"));
goto err;
}
id_entry->data.status |= SILC_IDLIST_STATUS_REGISTERED;
+ id_entry->data.conn_type = (server->server_type == SILC_SERVER ?
+ SILC_CONN_SERVER : SILC_CONN_ROUTER);
server->id_entry = id_entry;
/* Create secondary TCP listeners */
}
}
- /* Register the ID Cache purge task. This periodically purges the ID cache
- and removes the expired cache entries. */
-
- /* Clients local list */
- server->purge_i = purge = silc_calloc(1, sizeof(*purge));
- purge->cache = server->local_list->clients;
- purge->timeout = 600;
- silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge,
- (void *)purge, purge->timeout, 0);
-
- /* Clients global list */
- server->purge_g = purge = silc_calloc(1, sizeof(*purge));
- purge->cache = server->global_list->clients;
- purge->timeout = 300;
- silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge,
- (void *)purge, purge->timeout, 0);
-
/* If we are normal server we'll retrieve network statisticial information
once in a while from the router. */
if (server->server_type != SILC_ROUTER)
/* Register client entry expiration timeout */
silc_schedule_task_add_timeout(server->schedule,
silc_server_purge_expired_clients, server,
- 600, 0);
+ 120, 0);
/* Initialize HTTP server */
silc_server_http_init(server);
return FALSE;
}
-#if 0
/* Task callback to close a socket connection after rehash */
SILC_TASK_CALLBACK(silc_server_rehash_close_connection)
{
- SilcServer server = context;
- SilcPacketStream sock = server->sockets[fd];
+ SilcServer server = app_context;
+ SilcPacketStream sock = context;
+ SilcIDListData idata = silc_packet_get_context(sock);
+ const char *hostname;
+ SilcUInt16 port;
- if (!sock)
- return;
+ silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+ NULL, &hostname, NULL, &port);
SILC_LOG_INFO(("Connection %s:%d [%s] is unconfigured",
- sock->hostname, sock->port,
- (sock->type == SILC_CONN_UNKNOWN ? "Unknown" :
- sock->type == SILC_CONN_CLIENT ? "Client" :
- sock->type == SILC_CONN_SERVER ? "Server" :
- "Router")));
+ hostname, port, SILC_CONNTYPE_STRING(idata->conn_type)));
silc_schedule_task_del_by_context(server->schedule, sock);
silc_server_disconnect_remote(server, sock,
SILC_STATUS_ERR_BANNED_FROM_SERVER,
"This connection is removed from "
"configuration");
- if (sock->user_data)
- silc_server_free_sock_user_data(server, sock, NULL);
+ silc_server_free_sock_user_data(server, sock, NULL);
}
-#endif /* 0 */
/* This function basically reads the config file again and switches the config
object pointed by the server object. After that, we have to fix various
SilcBool silc_server_rehash(SilcServer server)
{
-#if 0
SilcServerConfig newconfig;
SILC_LOG_INFO(("Rehashing server"));
return FALSE;
}
- /* Reinit scheduler if necessary */
- if (newconfig->param.connections_max > server->config->param.connections_max)
- if (!silc_schedule_reinit(server->schedule,
- newconfig->param.connections_max))
- return FALSE;
-
/* Fix the server_name field */
if (strcmp(server->server_name, newconfig->server_info->server_name)) {
silc_free(server->server_name);
/* Update the idcache list with a fresh pointer */
silc_free(server->id_entry->server_name);
server->id_entry->server_name = strdup(server->server_name);
- if (!silc_idcache_del_by_context(server->local_list->servers,
- server->id_entry))
- return FALSE;
- if (!silc_idcache_add(server->local_list->servers,
- strdup(server->id_entry->server_name),
- server->id_entry->id, server->id_entry, 0, NULL))
- return FALSE;
+ silc_idcache_update_by_context(server->local_list->servers,
+ server->id_entry, NULL,
+ strdup(server->id_entry->server_name),
+ TRUE);
}
/* Set logging */
server->private_key = newconfig->server_info->private_key;
newconfig->server_info->public_key = NULL;
newconfig->server_info->private_key = NULL;
-
- /* Allocate PKCS context for local public and private keys */
- silc_pkcs_free(server->pkcs);
- if (!silc_pkcs_alloc(server->public_key->name, &server->pkcs))
- return FALSE;
- silc_pkcs_public_key_set(server->pkcs, server->public_key);
- silc_pkcs_private_key_set(server->pkcs, server->private_key);
}
/* Check for unconfigured server and router connections and close
SilcPacketStream sock;
sock = silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
ptr->host, ptr->port);
- if (sock && !SILC_IS_LISTENER(sock))
- silc_schedule_task_add(server->schedule, sock->sock,
- silc_server_rehash_close_connection,
- server, 0, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ if (sock)
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_rehash_close_connection,
+ sock, 0, 1);
}
}
}
SilcPacketStream sock;
sock = silc_server_find_socket_by_host(server, SILC_CONN_SERVER,
ptr->host, 0);
- if (sock && !SILC_IS_LISTENER(sock))
- silc_schedule_task_add(server->schedule, sock->sock,
- silc_server_rehash_close_connection,
- server, 0, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ if (sock)
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_rehash_close_connection,
+ sock, 0, 1);
}
}
}
sock = silc_server_find_socket_by_host(server, SILC_CONN_CLIENT,
ptr->host, 0);
if (sock)
- silc_schedule_task_add(server->schedule, sock->sock,
- silc_server_rehash_close_connection,
- server, 0, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_rehash_close_connection,
+ sock, 0, 1);
}
}
}
#endif /* SILC_DEBUG */
SILC_LOG_DEBUG(("Server rehashed"));
-#endif /* 0 */
return TRUE;
}
silc_server_free_sock_user_data(server, ps,
"Server is shutting down");
}
- silc_dlist_uninit(list);
+ silc_packet_engine_free_streams_list(list);
}
/* We are not connected to network anymore */
silc_server_http_uninit(server);
+ /* Cancel any possible retry timeouts */
+ silc_schedule_task_del_by_callback(server->schedule,
+ silc_server_connect_router);
+ silc_schedule_task_del_by_callback(server->schedule,
+ silc_server_connect_to_router_retry);
+
silc_schedule_stop(server->schedule);
- silc_schedule_uninit(server->schedule);
- server->schedule = NULL;
SILC_LOG_DEBUG(("Server stopped"));
}
SilcServer server = context;
SilcClientEntry client;
SilcIDList id_list;
+ SilcUInt64 curtime = silc_time();
SILC_LOG_DEBUG(("Expire timeout"));
if (client->data.status & SILC_IDLIST_STATUS_REGISTERED)
continue;
+ /* For unregistered clients the created timestamp is actually
+ unregistered timestamp. Make sure client remains in history
+ at least 500 seconds. */
+ if (curtime - client->data.created < 500)
+ continue;
+
id_list = (client->data.status & SILC_IDLIST_STATUS_LOCAL ?
server->local_list : server->global_list);
silc_schedule_task_add_timeout(server->schedule,
silc_server_purge_expired_clients, server,
- 600, 0);
+ 120, 0);
}
/* Free connection context */
-static void silc_server_connection_free(SilcServerConnection sconn)
+void silc_server_connection_free(SilcServerConnection sconn)
{
+ SILC_LOG_DEBUG(("Free connection %p", sconn));
silc_dlist_del(sconn->server->conns, sconn);
silc_server_config_unref(&sconn->conn);
silc_free(sconn->remote_host);
void silc_server_create_connection(SilcServer server,
SilcBool reconnect,
+ SilcBool dynamic,
const char *remote_host, SilcUInt32 port,
SilcServerConnectCallback callback,
void *context)
sconn->no_reconnect = reconnect == FALSE;
sconn->callback = callback;
sconn->callback_context = context;
+ sconn->no_conf = dynamic;
+ sconn->server = server;
+
+ SILC_LOG_DEBUG(("Created connection %p", sconn));
silc_schedule_task_add_timeout(server->schedule, silc_server_connect_router,
sconn, 0, 0);
SilcServerConfigServer *conn;
SilcServerConfigConnParams *param;
SilcIDListData idata;
- SilcServerEntry id_entry;
+ SilcServerEntry id_entry = NULL;
unsigned char id[32];
SilcUInt32 id_len;
SilcID remote_id;
+ const char *ip;
SILC_LOG_DEBUG(("Connection authentication completed"));
+ sconn->op = NULL;
+
if (success == FALSE) {
/* Authentication failed */
/* XXX retry connecting */
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_AUTH_FAILED, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
+ silc_server_connection_free(sconn);
return;
}
+ /* XXX For now remote is router always */
+ entry->data.conn_type = SILC_CONN_ROUTER;
+
SILC_LOG_INFO(("Connected to %s %s",
SILC_CONNTYPE_STRING(entry->data.conn_type),
sconn->remote_host));
if (!id_entry) {
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
silc_free(entry);
return;
SILC_STR_END)) {
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
silc_free(entry);
return;
as NULL since it's local to us. */
id_entry = silc_idlist_add_server(server->global_list,
strdup(sconn->remote_host),
- SILC_ROUTER, &remote_id.u.server_id,
+ SILC_ROUTER,
+ silc_id_dup(&remote_id.u.server_id,
+ SILC_ID_SERVER),
NULL, sconn->sock);
if (!id_entry) {
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
silc_free(entry);
return;
/* Registered */
silc_idlist_add_data(id_entry, (SilcIDListData)entry);
- idata = (SilcIDListData)entry;
+ idata = (SilcIDListData)id_entry;
idata->status |= (SILC_IDLIST_STATUS_REGISTERED |
SILC_IDLIST_STATUS_LOCAL);
+ idata->sconn = sconn;
if (!sconn->backup) {
/* Mark this router our primary router if we're still standalone */
silc_server_announce_channels(server, 0, SILC_PRIMARY_ROUTE(server));
}
-#if 0
/* If we are backup router then this primary router is whom we are
backing up. */
- if (server->server_type == SILC_BACKUP_ROUTER)
- silc_server_backup_add(server, server->id_entry, sock->ip,
+ if (server->server_type == SILC_BACKUP_ROUTER) {
+ silc_socket_stream_get_info(silc_packet_stream_get_stream(sconn->
+ sock),
+ NULL, NULL, &ip, NULL);
+ silc_server_backup_add(server, server->id_entry, ip,
sconn->remote_port, TRUE);
+ }
+#if 0
+ } else {
+ /* We already have primary router. Disconnect this connection */
+ SILC_LOG_DEBUG(("We already have primary router, disconnect"));
+ silc_idlist_del_server(server->global_list, id_entry);
+ silc_server_disconnect_remote(server, sconn->sock,
+ SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
+ silc_server_connection_free(sconn);
+ silc_free(entry);
+ return;
#endif /* 0 */
}
} else {
default:
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_AUTH_FAILED, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
silc_free(entry);
return;
}
+ SILC_LOG_DEBUG(("Connection established, sock %p", sconn->sock));
+
conn = sconn->conn.ref_ptr;
param = &server->config->param;
if (conn && conn->param)
silc_schedule_task_add_timeout(server->schedule, silc_server_do_rekey,
sconn->sock, sconn->rekey_timeout, 0);
-#if 0
- /* Perform keepalive. */
- silc_socket_set_heartbeat(sock, param->keepalive_secs, server,
- silc_server_perform_heartbeat,
- server->schedule);
+ /* Set the entry as packet stream context */
+ silc_packet_set_context(sconn->sock, id_entry);
out:
/* Call the completion callback to indicate that we've connected to
if (sconn && sconn->callback)
(*sconn->callback)(server, id_entry, sconn->callback_context);
- /* Free the temporary connection data context */
- if (sconn) {
- silc_server_config_unref(&sconn->conn);
- silc_free(sconn->remote_host);
- silc_free(sconn->backup_replace_ip);
- silc_free(sconn);
- }
if (sconn == server->router_conn)
server->router_conn = NULL;
-#endif /* 0 */
silc_free(entry);
}
SilcSKERekeyMaterial rekey,
void *context)
{
- SilcServerConnection sconn = context;
- SilcUnknownEntry entry = silc_packet_get_context(sconn->sock);
+ SilcPacketStream sock = context;
+ SilcUnknownEntry entry = silc_packet_get_context(sock);
+ SilcServerConnection sconn = silc_ske_get_context(ske);
SilcServer server = entry->server;
SilcServerConfigRouter *conn = sconn->conn.ref_ptr;
SilcAuthMethod auth_meth = SILC_AUTH_NONE;
SilcHmac hmac_send, hmac_receive;
SilcHash hash;
+ sconn->op = NULL;
+
if (status != SILC_SKE_STATUS_OK) {
/* SKE failed */
SILC_LOG_ERROR(("Error (%s) during Key Exchange protocol with %s (%s)",
silc_ske_free(ske);
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
silc_ske_free(ske);
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
silc_ske_free(ske);
silc_server_disconnect_remote(server, sconn->sock,
SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
}
}
+ entry->data.rekey = rekey;
+
/* Start connection authentication */
- silc_connauth_initiator(connauth, server->server_type == SILC_ROUTER ?
- SILC_CONN_ROUTER : SILC_CONN_SERVER, auth_meth,
- auth_data, auth_data_len,
- silc_server_ke_auth_compl, sconn);
+ sconn->op =
+ silc_connauth_initiator(connauth, server->server_type == SILC_SERVER ?
+ SILC_CONN_SERVER : SILC_CONN_ROUTER, auth_meth,
+ auth_data, auth_data_len,
+ silc_server_ke_auth_compl, sconn);
}
/* Function that is called when the network connection to a router has
if (!sconn->sock) {
SILC_LOG_ERROR(("Cannot connect: cannot create packet stream"));
silc_stream_destroy(sconn->stream);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
if (!silc_packet_set_ids(sconn->sock, SILC_ID_SERVER, server->id,
0, NULL)) {
silc_packet_stream_destroy(sconn->sock);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
/* Start SILC Key Exchange protocol */
SILC_LOG_DEBUG(("Starting key exchange protocol"));
ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
- server->public_key, server->private_key, sconn->sock);
+ server->public_key, server->private_key, sconn);
if (!ske) {
silc_free(entry);
silc_packet_stream_destroy(sconn->sock);
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
/* Start key exchange protocol */
params.version = silc_version_string;
params.timeout_secs = server->config->key_exchange_timeout;
- silc_ske_initiator(ske, sconn->sock, ¶ms, NULL);
+ sconn->op = silc_ske_initiator(ske, sconn->sock, ¶ms, NULL);
}
/* Timeout callback that will be called to retry connecting to remote
if ((sconn->retry_count > param->reconnect_count) &&
!param->reconnect_keep_trying) {
SILC_LOG_ERROR(("Could not connect, giving up"));
+
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
SILC_LOG_ERROR(("Could not connect to %s:%d: %s",
sconn->remote_host, sconn->remote_port,
silc_net_get_error_string(status)));
+
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
break;
silc_schedule_task_add_timeout(sconn->server->schedule,
silc_server_connect_to_router_retry,
sconn, 1, 0);
+ silc_dlist_del(server->conns, sconn);
} else {
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
}
break;
/* Don't connect if we are shutting down. */
if (server->server_shutdown) {
+ if (sconn->callback)
+ (*sconn->callback)(server, NULL, sconn->callback_context);
silc_server_connection_free(sconn);
return;
}
(sconn->backup ? "backup router" : "router"),
sconn->remote_host, sconn->remote_port));
- if (!server->no_conf) {
+ if (!sconn->no_conf) {
/* Find connection configuration */
rconn = silc_server_config_find_router_conn(server, sconn->remote_host,
sconn->remote_port);
"normal server" : server->server_type == SILC_ROUTER ?
"router" : "backup router/normal server")));
- /* XXX */
if (!server->config->routers) {
/* There wasn't a configured router, we will continue but we don't
have a connection to outside world. We will be standalone server. */
return;
}
+ /* Cancel any possible retry timeouts */
+ silc_schedule_task_del_by_callback(server->schedule,
+ silc_server_connect_router);
+ silc_schedule_task_del_by_callback(server->schedule,
+ silc_server_connect_to_router_retry);
+
/* Create the connections to all our routes */
for (ptr = server->config->routers; ptr; ptr = ptr->next) {
if (!ptr->initiator)
continue;
+ if (ptr->dynamic_connection)
+ continue;
/* Check whether we are connecting or connected to this host already */
if (silc_server_num_sockets_by_remote(server,
silc_net_is_ip(ptr->host) ?
ptr->host : NULL,
silc_net_is_ip(ptr->host) ?
- NULL : ptr->host, ptr->port)) {
+ NULL : ptr->host, ptr->port,
+ SILC_CONN_ROUTER)) {
SILC_LOG_DEBUG(("We are already connected to %s:%d",
ptr->host, ptr->port));
if (!sock)
continue;
server->backup_noswitch = TRUE;
-#if 0
- if (sock->user_data)
- silc_server_free_sock_user_data(server, sock, NULL);
+ silc_server_free_sock_user_data(server, sock, NULL);
silc_server_disconnect_remote(server, sock, 0, NULL);
-#endif /* 0 */
server->backup_noswitch = FALSE;
SILC_LOG_DEBUG(("Reconnecting to primary router"));
} else {
sconn = silc_calloc(1, sizeof(*sconn));
if (!sconn)
continue;
+ sconn->server = server;
sconn->remote_host = strdup(ptr->host);
sconn->remote_port = ptr->port;
sconn->backup = ptr->backup_router;
sconn->backup_replace_port = ptr->backup_replace_port;
}
- /* XXX */
+ SILC_LOG_DEBUG(("Created connection %p", sconn));
+
if (!server->router_conn && !sconn->backup)
server->router_conn = sconn;
/* Remote end is server */
if (conn_type == SILC_CONN_SERVER) {
- SilcServerConfigServer *sconfig = entry->sconfig.ref_ptr;
+ SilcServerConfigServer *sconfig;
+
+ /* If we are normal server, don't accept the connection */
+ if (server->server_type == SILC_SERVER)
+ return FALSE;
+
+ sconfig = entry->sconfig.ref_ptr;
if (!sconfig)
return FALSE;
SilcServerConfigConnParams *param = &server->config->param;
SilcServerConnection sconn;
void *id_entry;
- const char *hostname;
+ const char *hostname, *ip;
SilcUInt16 port;
+ entry->op = NULL;
silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
- NULL, &hostname, NULL, &port);
+ NULL, &hostname, &ip, &port);
if (success == FALSE) {
/* Authentication failed */
SilcBool backup_router = FALSE;
char *backup_replace_ip = NULL;
SilcUInt16 backup_replace_port = 0;
- SilcServerConfigServer *sconn = entry->sconfig.ref_ptr;
+ SilcServerConfigServer *srvconn = entry->sconfig.ref_ptr;
SilcServerConfigRouter *rconn = entry->rconfig.ref_ptr;
/* If we are backup router and this is incoming server connection
if (!silc_server_connection_allowed(server, sock,
entry->data.conn_type,
&server->config->param,
- sconn ? sconn->param : NULL,
+ srvconn ? srvconn->param : NULL,
silc_connauth_get_ske(connauth))) {
server->stat.auth_failures++;
goto out;
}
- if (sconn) {
- if (sconn->param) {
- param = sconn->param;
+ if (srvconn) {
+ if (srvconn->param) {
+ param = srvconn->param;
if (!param->keepalive_secs)
param->keepalive_secs = server->config->param.keepalive_secs;
}
}
- backup_router = sconn->backup_router;
+ backup_router = srvconn->backup_router;
}
}
/* If we are primary router and we have backup router configured
but it has not connected to use yet, do not accept any other
connection. */
-#if 0
if (server->wait_backup && server->server_type == SILC_ROUTER &&
!server->backup_router && !backup_router) {
SilcServerConfigRouter *router;
goto out;
}
}
-#endif /* 0 */
SILC_LOG_DEBUG(("Remote host is %s",
entry->data.conn_type == SILC_CONN_SERVER ?
if (entry->data.conn_type == SILC_CONN_SERVER) {
server->stat.my_servers++;
server->stat.servers++;
+ SILC_LOG_DEBUG(("my_servers %d", server->stat.my_servers));
} else {
server->stat.my_routers++;
server->stat.routers++;
+ SILC_LOG_DEBUG(("my_routers %d", server->stat.my_routers));
}
/* Check whether this connection is to be our primary router connection
silc_packet_set_context(sock, id_entry);
/* Connection has been fully established now. Everything is ok. */
- SILC_LOG_DEBUG(("New connection authenticated"));
-
-#if 0
- /* Perform keepalive. */
- if (param->keepalive_secs)
- silc_socket_set_heartbeat(sock, param->keepalive_secs, server,
- silc_server_perform_heartbeat,
- server->schedule);
-#endif
+ SILC_LOG_DEBUG(("New connection %p authenticated", sconn));
/* Perform Quality of Service */
if (param->qos)
SilcCipher send_key, receive_key;
SilcHmac hmac_send, hmac_receive;
SilcHash hash;
+ unsigned char *pk;
+ SilcUInt32 pk_len;
+
+ entry->op = NULL;
if (status != SILC_SKE_STATUS_OK) {
/* SKE failed */
idata->rekey = rekey;
idata->public_key = silc_pkcs_public_key_copy(prop->public_key);
+ pk = silc_pkcs_public_key_encode(idata->public_key, &pk_len);
+ silc_hash_make(server->sha1hash, pk, pk_len, idata->fingerprint);
SILC_LOG_DEBUG(("Starting connection authentication"));
server->stat.auth_attempts++;
}
/* Start connection authentication */
- silc_connauth_responder(connauth, silc_server_accept_get_auth,
- silc_server_accept_auth_compl, sock);
+ entry->op =
+ silc_connauth_responder(connauth, silc_server_accept_get_auth,
+ silc_server_accept_auth_compl, sock);
}
/* Accept new TCP connection */
entry->ip = ip;
entry->port = port;
entry->server = server;
+ entry->data.conn_type = SILC_CONN_UNKNOWN;
silc_packet_set_context(packet_stream, entry);
silc_server_config_ref(&entry->cconfig, server->config, cconfig);
/* Start key exchange protocol */
params.version = silc_version_string;
params.timeout_secs = server->config->key_exchange_timeout;
- silc_ske_responder(ske, packet_stream, ¶ms);
+ entry->op = silc_ske_responder(ske, packet_stream, ¶ms);
}
SilcIDListData idata = silc_packet_get_context(sock);
SilcSKE ske;
+ SILC_LOG_DEBUG(("Perform rekey, sock %p", sock));
+
/* Do not execute rekey with disabled connections */
if (idata->status & SILC_IDLIST_STATUS_DISABLED)
return;
SILC_CONNTYPE_STRING(idata->conn_type)));
/* Allocate SKE */
- ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
- server->public_key, server->private_key, sock);
+ ske = silc_ske_alloc(server->rng, server->schedule, NULL,
+ server->public_key, NULL, sock);
if (!ske)
return;
SILC_CONNTYPE_STRING(idata->conn_type)));
/* Allocate SKE */
- ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
- server->public_key, server->private_key, sock);
+ ske = silc_ske_alloc(server->rng, server->schedule, NULL,
+ server->public_key, NULL, sock);
if (!ske) {
silc_packet_free(packet);
return;
const char *hostname;
SilcUInt16 port;
-#if 0
- /* If any protocol is active cancel its execution. It will call
- the final callback which will finalize the disconnection. */
- if (sock->protocol && sock->protocol->protocol &&
- sock->protocol->protocol->type != SILC_PROTOCOL_SERVER_BACKUP) {
- SILC_LOG_DEBUG(("Cancelling protocol, calling final callback"));
- silc_protocol_cancel(sock->protocol, server->schedule);
- sock->protocol->state = SILC_PROTOCOL_STATE_ERROR;
- silc_protocol_execute_final(sock->protocol, server->schedule);
- sock->protocol = NULL;
- return;
- }
-#endif
-
memset(tmp, 0, sizeof(tmp));
// silc_socket_get_error(sock, tmp, sizeof(tmp));
silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
// silc_socket_set_qos(sock, 0, 0, 0, 0, NULL);
+ if (idata && idata->sconn) {
+ silc_server_connection_free(idata->sconn);
+ idata->sconn = NULL;
+ }
+
/* Close connection with timeout */
server->stat.conn_num--;
+ silc_schedule_task_del_by_all(server->schedule, 0,
+ silc_server_close_connection_final, sock);
silc_schedule_task_add_timeout(server->schedule,
silc_server_close_connection_final,
sock, 0, 1);
silc_server_close_connection(server, sock);
}
-SILC_TASK_CALLBACK(silc_server_free_client_data_timeout)
-{
- SilcClientEntry client = context;
-
- assert(!silc_hash_table_count(client->channels));
-
- silc_idlist_del_data(client);
- // silc_idcache_purge_by_context(server->local_list->clients, client);
-}
-
/* Frees client data and notifies about client's signoff. */
void silc_server_free_client_data(SilcServer server,
int notify,
const char *signoff)
{
- SILC_LOG_DEBUG(("Freeing client data"));
+ SILC_LOG_DEBUG(("Freeing client %p data", client));
if (client->id) {
/* Check if anyone is watching this nickname */
SILC_OPER_STATS_UPDATE(client, router, SILC_UMODE_ROUTER_OPERATOR);
silc_schedule_task_del_by_context(server->schedule, client);
+ if (client->data.sconn)
+ silc_server_connection_free(client->data.sconn);
+
/* We will not delete the client entry right away. We will take it
into history (for WHOWAS command) for 5 minutes, unless we're
shutting down server. */
if (!server->server_shutdown) {
- silc_schedule_task_add_timeout(server->schedule,
- silc_server_free_client_data_timeout,
- client, 600, 0);
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
- client->data.status &= ~SILC_IDLIST_STATUS_LOCAL;
client->mode = 0;
client->router = NULL;
client->connection = NULL;
+ client->data.created = silc_time();
+ silc_dlist_add(server->expired_clients, client);
} else {
/* Delete directly since we're shutting down server */
+ SILC_LOG_DEBUG(("Delete client directly"));
silc_idlist_del_data(client);
silc_idlist_del_client(server->local_list, client);
}
const char *signoff_message)
{
SilcIDListData idata = silc_packet_get_context(sock);
+ const char *ip;
+ SilcUInt16 port;
+
+ SILC_LOG_DEBUG(("Start"));
if (!idata)
return;
+ silc_schedule_task_del_by_context(server->schedule, sock);
+
+ /* Cancel active protocols */
+ if (idata) {
+ if (idata->sconn && idata->sconn->op) {
+ SILC_LOG_DEBUG(("Abort active protocol"));
+ silc_async_abort(idata->sconn->op, NULL, NULL);
+ }
+ if (idata->conn_type == SILC_CONN_UNKNOWN &&
+ ((SilcUnknownEntry)idata)->op) {
+ SILC_LOG_DEBUG(("Abort active protocol"));
+ silc_async_abort(((SilcUnknownEntry)idata)->op, NULL, NULL);
+ }
+ }
+
switch (idata->conn_type) {
case SILC_CONN_CLIENT:
{
SilcServerEntry user_data = (SilcServerEntry)idata;
SilcServerEntry backup_router = NULL;
- SILC_LOG_DEBUG(("Freeing server data"));
+ SILC_LOG_DEBUG(("Freeing server %p data", user_data));
if (user_data->id)
backup_router = silc_server_backup_get(server, user_data->id);
if (server->server_shutdown || server->backup_noswitch)
backup_router = NULL;
+ silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+ NULL, NULL, &ip, &port);
+
/* If this was our primary router connection then we're lost to
the outside world. */
if (server->router == user_data) {
/* We stop here to take a breath */
sleep(2);
-#if 0
if (server->backup_router) {
server->server_type = SILC_ROUTER;
/* We'll need to constantly try to reconnect to the primary
router so that we'll see when it comes back online. */
- silc_server_backup_reconnect(server, sock->ip, sock->port,
+ silc_server_create_connection(server, FALSE, FALSE, ip, port,
silc_server_backup_connected,
NULL);
}
-#endif /* 0 */
/* Mark this connection as replaced */
silc_server_backup_replaced_add(server, user_data->id,
}
server->backup_noswitch = FALSE;
- /* Free the server entry */
- silc_server_backup_del(server, user_data);
- silc_server_backup_replaced_del(server, user_data);
- silc_idlist_del_data(user_data);
- if (!silc_idlist_del_server(server->local_list, user_data))
- silc_idlist_del_server(server->global_list, user_data);
+ if (idata->sconn)
+ silc_server_connection_free(idata->sconn);
+
+ /* Statistics */
if (idata->conn_type == SILC_CONN_SERVER) {
server->stat.my_servers--;
server->stat.servers--;
- } else {
+ SILC_LOG_DEBUG(("my_servers %d", server->stat.my_servers));
+ } else if (idata->conn_type == SILC_CONN_ROUTER) {
server->stat.my_routers--;
server->stat.routers--;
+ SILC_LOG_DEBUG(("my_routers %d", server->stat.my_routers));
}
if (server->server_type == SILC_ROUTER)
server->stat.cell_servers--;
+ /* Free the server entry */
+ silc_server_backup_del(server, user_data);
+ silc_server_backup_replaced_del(server, user_data);
+ silc_idlist_del_data(user_data);
+ if (!silc_idlist_del_server(server->local_list, user_data))
+ silc_idlist_del_server(server->global_list, user_data);
+
if (backup_router && backup_router != server->id_entry) {
/* Announce all of our stuff that was created about 5 minutes ago.
The backup router knows all the other stuff already. */
SILC_LOG_DEBUG(("Freeing unknown connection data"));
+ if (idata->sconn)
+ silc_server_connection_free(idata->sconn);
silc_idlist_del_data(idata);
silc_free(entry);
silc_packet_set_context(sock, NULL);
if (!client->connection && !client->router)
continue;
+ SILC_LOG_DEBUG(("Announce Client ID %s",
+ silc_id_render(client->id, SILC_ID_CLIENT)));
+
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
*clients = silc_buffer_realloc(*clients,
while (silc_hash_table_get(&htl, NULL, (void *)&chl)) {
clidp = silc_id_payload_encode(chl->client->id, SILC_ID_CLIENT);
+ SILC_LOG_DEBUG(("JOIN Client %s", silc_id_render(chl->client->id,
+ SILC_ID_CLIENT)));
+
/* JOIN Notify */
tmp = silc_server_announce_encode_notify(SILC_NOTIFY_TYPE_JOIN, 2,
clidp->data,
else
announce = TRUE;
+ SILC_LOG_DEBUG(("Announce Channel ID %s",
+ silc_id_render(channel->id, SILC_ID_CHANNEL)));
+
silc_id_id2str(channel->id, SILC_ID_CHANNEL, cid, sizeof(cid), &id_len);
name_len = strlen(channel->channel_name);
/* Assembles user list and users mode list from the `channel'. */
SilcBool silc_server_get_users_on_channel(SilcServer server,
- SilcChannelEntry channel,
- SilcBuffer *user_list,
- SilcBuffer *mode_list,
- SilcUInt32 *user_count)
+ SilcChannelEntry channel,
+ SilcBuffer *user_list,
+ SilcBuffer *mode_list,
+ SilcUInt32 *user_count)
{
SilcChannelClientEntry chl;
SilcHashTableList htl;
SILC_LOG_DEBUG(("Retrieving stats from router"));
server->stat.commands_sent++;
idp = silc_id_payload_encode(server->router->id, SILC_ID_SERVER);
- packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
- ++server->cmd_ident, 1,
- 1, idp->data,
- silc_buffer_len(idp));
- silc_server_packet_send(server, SILC_PRIMARY_ROUTE(server),
- SILC_PACKET_COMMAND, 0, packet->data,
- silc_buffer_len(packet));
- silc_buffer_free(packet);
- silc_buffer_free(idp);
+ if (idp) {
+ packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
+ ++server->cmd_ident, 1,
+ 1, idp->data,
+ silc_buffer_len(idp));
+ silc_server_packet_send(server, SILC_PRIMARY_ROUTE(server),
+ SILC_PACKET_COMMAND, 0, packet->data,
+ silc_buffer_len(packet));
+ silc_buffer_free(packet);
+ silc_buffer_free(idp);
+ }
}
silc_schedule_task_add_timeout(server->schedule, silc_server_get_stats,
silc_free(__fmt__); \
} while(0)
-/* Check whether rekey protocol is active */
-#define SILC_SERVER_IS_REKEY(sock) \
- (sock->protocol && sock->protocol->protocol && \
- sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_REKEY)
-
/* Output a message to stderr or to the appropriate log facility wether
we are in the background or not. */
#define SILC_SERVER_LOG_INFO(fmt) \
void silc_server_start_key_exchange(SilcServerConnection sconn);
void silc_server_create_connection(SilcServer server,
SilcBool reconnect,
+ SilcBool dynamic,
const char *remote_host, SilcUInt32 port,
SilcServerConnectCallback callback,
void *context);
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 2005, 2007 Pekka Riikonen
+ Copyright (C) 2001 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "server_internal.h"
SILC_TASK_CALLBACK(silc_server_protocol_backup_done);
-SILC_TASK_CALLBACK(silc_server_backup_connect_to_router);
SILC_TASK_CALLBACK(silc_server_backup_announce_watches);
static void silc_server_backup_connect_primary(SilcServer server,
SilcUInt32 sessions_count;
SilcUInt32 initiator_restart;
long start;
+ int state;
unsigned int responder : 1;
unsigned int received_failure : 1;
unsigned int timeout : 1;
}
SILC_LOG_DEBUG(("Backup router %s will replace %s",
- backup_server->data.sconn->remote_host, ip, port));
+ backup_server->data.sconn ?
+ backup_server->data.sconn->remote_host : "(me)", ip));
for (i = 0; i < server->backup->servers_count; i++) {
if (!server->backup->servers[i].server) {
/* The primary is not down, refuse to serve the server as primary */
SILC_LOG_DEBUG(("PING received, primary is up"));
silc_server_backup_send_start_use(pc->server, pc->sock, TRUE);
+ silc_packet_free(pc->packet);
}
silc_packet_stream_unref(pc->sock);
- silc_packet_free(pc->packet);
silc_free(pc);
}
SilcPacket packet)
{
SilcIDListData idata = silc_packet_get_context(sock);
+ SilcServerEntry router = (SilcServerEntry)idata;
SilcUInt8 type, session;
SilcServerBackupProtocolContext ctx;
int i, ret;
return;
}
-
/* Start the resuming protocol if requested. */
if (type == SILC_SERVER_BACKUP_START) {
/* We have received a start for resuming protocol. We are either
proto_ctx->session = session;
proto_ctx->start = time(0);
silc_packet_stream_ref(sock);
+ router->backup = TRUE;
+ router->backup_proto = proto_ctx;
SILC_LOG_DEBUG(("Starting backup resuming protocol as responder"));
SILC_LOG_INFO(("Starting backup resuming protocol"));
return;
}
-#if 0
/* Activate the shared protocol context for this socket connection
if necessary */
if (type == SILC_SERVER_BACKUP_RESUMED &&
- idata->conn_type == SILC_CONN_ROUTER && !sock->protocol &&
+ idata->conn_type == SILC_CONN_ROUTER && !router->backup &&
idata->status & SILC_IDLIST_STATUS_DISABLED) {
SilcServerEntry backup_router;
- if (silc_server_backup_replaced_get(server, ((SilcServerEntry)idata)->id,
- &backup_router)) {
- SilcPacketStream bsock =
- (SilcSocketConnection)backup_router->connection;
- if (bsock->protocol && bsock->protocol->protocol &&
- bsock->protocol->protocol->type == SILC_PROTOCOL_SERVER_BACKUP) {
- sock->protocol = bsock->protocol;
- ctx = sock->protocol->context;
- if (ctx->sock)
- silc_socket_free(ctx->sock); /* unref */
- ctx->sock = silc_socket_dup(sock);
- }
+ if (silc_server_backup_replaced_get(server, router->id, &backup_router)) {
+ ctx = backup_router->backup_proto;
+ if (ctx->sock)
+ silc_packet_stream_unref(ctx->sock);
+ router->backup = TRUE;
+ router->backup_proto = ctx;
+ ctx->sock = sock;
+ silc_packet_stream_ref(sock);
}
}
-
/* Call the resuming protocol if the protocol is active. */
- if (SILC_SERVER_IS_BACKUP(sock)) {
- ctx = sock->protocol->context;
+ if (router->backup) {
+ ctx = router->backup_proto;
ctx->type = type;
for (i = 0; i < ctx->sessions_count; i++) {
if (session == ctx->sessions[i].session) {
ctx->session = session;
- silc_protocol_execute(sock->protocol, server->schedule, 0, 0);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup,
+ ctx, 0, 1);
silc_packet_free(packet);
return;
}
/* If RESUMED received the session ID is zero, execute the protocol. */
if (type == SILC_SERVER_BACKUP_RESUMED) {
- silc_protocol_execute(sock->protocol, server->schedule, 0, 0);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup,
+ ctx, 0, 1);
silc_packet_free(packet);
return;
}
silc_packet_free(packet);
return;
}
-#endif /* 0 */
silc_packet_free(packet);
}
SilcServerBackupProtocolContext proto_ctx =
(SilcServerBackupProtocolContext)context;
SilcServer server = proto_ctx->server;
- SilcPacketStream sock = proto_ctx->sock;
SILC_LOG_DEBUG(("Starting backup resuming protocol as initiator"));
SILC_LOG_INFO(("Starting backup resuming protocol"));
if (primary) {
if (!silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
primary->host, primary->port))
- silc_server_create_connection(server, FALSE,
+ silc_server_create_connection(server, FALSE, FALSE,
primary->host, primary->port,
silc_server_backup_connected,
context);
/* Try again */
silc_schedule_task_add_timeout(server->schedule,
silc_server_backup_connected_again,
- context, 0, 0);
+ context, 5, 0);
return;
}
if (primary) {
if (!silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
primary->host, primary->port))
- silc_server_create_connection(server, FALSE,
+ silc_server_create_connection(server, FALSE, FALSE,
primary->host, primary->port,
silc_server_backup_connect_primary,
context);
SilcServerEntry server_entry,
void *context)
{
-#if 0
SilcPacketStream backup_router = context;
+ SilcIDListData idata = silc_packet_get_context(backup_router);
+ SilcServerEntry router = (SilcServerEntry)idata;
SilcServerBackupProtocolContext ctx;
SilcPacketStream sock;
- SilcIDListData idata;
unsigned char data[2];
if (!server_entry) {
return;
}
- /* Unref */
- silc_packet_stream_unref(backup_router);
-
- if (!backup_router->protocol)
- return;
- if (!server_entry->connection)
+ if (!router->backup || !server_entry->connection) {
+ silc_packet_stream_unref(backup_router);
return;
+ }
- ctx = (SilcServerBackupProtocolContext)backup_router->protocol->context;
- sock = (SilcSocketConnection)server_entry->connection;
+ ctx = router->backup_proto;
+ sock = server_entry->connection;
idata = (SilcIDListData)server_entry;
SILC_LOG_DEBUG(("Sending CONNECTED packet (session %d)", ctx->session));
data[0] = SILC_SERVER_BACKUP_CONNECTED;
data[1] = ctx->session;
silc_server_packet_send(server, backup_router,
- SILC_PACKET_RESUME_ROUTER, 0, data, 2, FALSE);
+ SILC_PACKET_RESUME_ROUTER, 0, data, 2);
/* The primary connection is disabled until it sends the RESUMED packet
to us. */
the primary router connection since it will send the subsequent
packets in this protocol. We don't talk with backup router
anymore. */
- sock->protocol = backup_router->protocol;
if (ctx->sock)
- silc_socket_free(ctx->sock); /* unref */
- ctx->sock = silc_socket_dup(server_entry->connection);
- backup_router->protocol = NULL;
-#endif /* 0 */x
+ silc_packet_stream_unref(ctx->sock);
+ ctx->sock = sock;
+ silc_packet_stream_ref(sock);
+ server_entry->backup = TRUE;
+ server_entry->backup_proto = ctx;
+ router->backup = FALSE;
+ router->backup_proto = NULL;
+
+ /* Unref */
+ silc_packet_stream_unref(backup_router);
}
/* Timeout callback used by the backup router to send the ENDING packet
SILC_TASK_CALLBACK(silc_server_backup_send_resumed)
{
-#if 0
SilcServerBackupProtocolContext ctx = context;
SilcServer server = ctx->server;
unsigned char data[2];
SILC_LOG_DEBUG(("Start"));
for (i = 0; i < ctx->sessions_count; i++)
- if (ctx->sessions[i].server_entry == ctx->sock->user_data)
+ if (ctx->sessions[i].server_entry == silc_packet_get_context(ctx->sock))
ctx->session = ctx->sessions[i].session;
/* We've received all the CONNECTED packets and now we'll send the
data, sizeof(data));
/* The protocol will go to END state. */
- protocol->state = SILC_PROTOCOL_STATE_END;
-#endif /* 0 */
+ ctx->state = 250;
}
/* Backup resuming protocol. This protocol is executed when the primary
SILC_TASK_CALLBACK(silc_server_protocol_backup)
{
-#if 0
SilcServerBackupProtocolContext ctx = context;
SilcServer server = ctx->server;
- SilcServerEntry server_entry;
+ SilcServerEntry server_entry = NULL;
SilcPacketStream sock = NULL;
unsigned char data[2];
+ SilcDList list;
int i;
- if (protocol->state == SILC_PROTOCOL_STATE_UNKNOWN)
- protocol->state = SILC_PROTOCOL_STATE_START;
+ if (!ctx->state)
+ ctx->state = 1;
- switch(protocol->state) {
- case SILC_PROTOCOL_STATE_START:
+ switch(ctx->state) {
+ case 1:
if (ctx->responder == FALSE) {
/*
* Initiator (backup router)
packet will indicate to the primary router that it has been replaced
by us. For normal servers it means that we will be resigning as
being primary router shortly. */
- for (i = 0; i < server->config->param.connections_max; i++) {
- sock = server->sockets[i];
- if (!sock || !sock->user_data ||
- sock->user_data == server->id_entry ||
- (sock->type != SILC_CONN_ROUTER &&
- sock->type != SILC_CONN_SERVER))
+ list = silc_packet_engine_get_streams(server->packet_engine);
+ if (!list)
+ return;
+
+ silc_dlist_start(list);
+ while ((sock = silc_dlist_get(list))) {
+ server_entry = silc_packet_get_context(sock);
+
+ if (!server_entry || server_entry == server->id_entry ||
+ (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+ server_entry->data.conn_type != SILC_CONN_SERVER))
continue;
- server_entry = sock->user_data;
if (server_entry->data.status & SILC_IDLIST_STATUS_DISABLED)
continue;
server_entry->server_name, ctx->sessions_count));
/* This connection is performing this protocol too now */
- sock->protocol = protocol;
+ server_entry->backup = TRUE;
+ server_entry->backup_proto = ctx;
data[0] = SILC_SERVER_BACKUP_START;
data[1] = ctx->sessions_count;
silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
- data, sizeof(data), FALSE);
+ data, sizeof(data));
ctx->sessions_count++;
}
+ silc_packet_engine_free_streams_list(list);
/* Announce data to the new primary to be. */
silc_server_announce_servers(server, TRUE, 0, ctx->sock);
silc_server_announce_clients(server, 0, ctx->sock);
silc_server_announce_channels(server, 0, ctx->sock);
- protocol->state++;
+ ctx->state++;
} else {
/*
SILC_CONN_ROUTER)) {
SILC_LOG_DEBUG(("Received START (session %d), reconnect to router",
ctx->session));
- silc_server_create_connection(server, FALSE;
+ silc_packet_stream_ref(ctx->sock);
+ silc_server_create_connection(server, FALSE, FALSE,
primary->host, primary->port,
silc_server_backup_connect_primary,
- silc_socket_dup(ctx->sock));
+ ctx->sock);
} else {
/* Nowhere to connect just return the CONNECTED packet */
SILC_LOG_DEBUG(("Received START (session %d), send CONNECTED back",
data[1] = ctx->session;
silc_server_packet_send(server, ctx->sock,
SILC_PACKET_RESUME_ROUTER, 0,
- data, sizeof(data), FALSE);
+ data, sizeof(data));
}
/* Add this resuming session */
if (server->server_type == SILC_ROUTER &&
(!server->router ||
server->router->data.status & SILC_IDLIST_STATUS_DISABLED))
- protocol->state++;
+ ctx->state++;
else
- protocol->state = SILC_PROTOCOL_STATE_END;
+ ctx->state = 250;
}
break;
/* The ENDING is sent with timeout, and then we continue to the
END state in the protocol. */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_send_resumed,
- protocol, 1, 0, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_send_resumed,
+ ctx, 1, 0);
return;
} else {
/* Switch announced informations to our primary router of using the
backup router. */
silc_server_local_servers_toggle_enabled(server, TRUE);
- silc_server_update_servers_by_server(server, ctx->sock->user_data,
- server->router);
- silc_server_update_clients_by_server(server, ctx->sock->user_data,
+ silc_server_update_servers_by_server(server,
+ silc_packet_get_context(ctx->sock),
+ server->router);
+ silc_server_update_clients_by_server(server,
+ silc_packet_get_context(ctx->sock),
server->router, TRUE);
/* We as primary router now must send RESUMED packets to all servers
and routers so that they know we are back. For backup router we
send the packet last so that we give the backup as much time as
possible to deal with message routing at this critical moment. */
- for (i = 0; i < server->config->param.connections_max; i++) {
- sock = server->sockets[i];
- if (!sock || !sock->user_data ||
- sock->user_data == server->id_entry ||
- (sock->type != SILC_CONN_ROUTER &&
- sock->type != SILC_CONN_SERVER))
+ list = silc_packet_engine_get_streams(server->packet_engine);
+ if (!list)
+ return;
+
+ silc_dlist_start(list);
+ while ((sock = silc_dlist_get(list))) {
+ server_entry = silc_packet_get_context(sock);
+
+ if (!server_entry || server_entry == server->id_entry ||
+ (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+ server_entry->data.conn_type != SILC_CONN_SERVER))
continue;
/* Send to backup last */
if (sock == ctx->sock)
continue;
- send_to_backup:
- server_entry = sock->user_data;
+ server_entry = silc_packet_get_context(sock);
server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
SILC_LOG_DEBUG(("Sending RESUMED to %s", server_entry->server_name));
SILC_LOG_INFO(("Sending RESUMED to %s", server_entry->server_name));
/* This connection is performing this protocol too now */
- sock->protocol = protocol;
+ server_entry->backup = TRUE;
+ server_entry->backup_proto = ctx;
data[0] = SILC_SERVER_BACKUP_RESUMED;
data[1] = 0;
silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
- data, sizeof(data), FALSE);
+ data, sizeof(data));
}
/* Now send the same packet to backup */
if (sock != ctx->sock) {
sleep(1);
sock = ctx->sock;
- goto send_to_backup;
+ server_entry = silc_packet_get_context(sock);
+ server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
+
+ SILC_LOG_DEBUG(("Sending RESUMED to %s", server_entry->server_name));
+ SILC_LOG_INFO(("Sending RESUMED to %s", server_entry->server_name));
+
+ /* This connection is performing this protocol too now */
+ server_entry->backup = TRUE;
+ server_entry->backup_proto = ctx;
+
+ data[0] = SILC_SERVER_BACKUP_RESUMED;
+ data[1] = 0;
+ silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
+ data, sizeof(data));
}
+ silc_packet_engine_free_streams_list(list);
/* We are now resumed and are back as primary router in the cell. */
SILC_LOG_INFO(("We are now the primary router of our cell again"));
server->wait_backup = FALSE;
/* Announce WATCH list a little later */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_announce_watches,
- silc_socket_dup(ctx->sock), 4, 0,
- SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+ silc_packet_stream_ref(ctx->sock);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_announce_watches,
+ ctx->sock, 4, 0);
/* For us this is the end of this protocol. */
- if (protocol->final_callback)
- silc_protocol_execute_final(protocol, server->schedule);
- else
- silc_protocol_free(protocol);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup_done,
+ ctx, 0, 1);
}
break;
- case SILC_PROTOCOL_STATE_END:
+ case 250:
{
/*
* Responder (backup router, servers, and remote router)
server->server_type = SILC_BACKUP_ROUTER;
/* We have now new primary router. All traffic goes there from now on. */
- router = ctx->sock->user_data;
+ router = silc_packet_get_context(ctx->sock);
if (silc_server_backup_replaced_get(server, router->id,
&backup_router)) {
server->router->server_name));
/* Protocol has ended, call the final callback */
- if (protocol->final_callback)
- silc_protocol_execute_final(protocol, server->schedule);
- else
- silc_protocol_free(protocol);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup_done,
+ ctx, 0, 1);
}
break;
- case SILC_PROTOCOL_STATE_ERROR:
+ case 251:
/* Protocol has ended, call the final callback */
- if (protocol->final_callback)
- silc_protocol_execute_final(protocol, server->schedule);
- else
- silc_protocol_free(protocol);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup_done,
+ ctx, 0, 1);
break;
- case SILC_PROTOCOL_STATE_FAILURE:
+ case 252:
/* Protocol has ended, call the final callback */
SILC_LOG_ERROR(("Error during backup resume: received Failure"));
ctx->received_failure = TRUE;
- if (protocol->final_callback)
- silc_protocol_execute_final(protocol, server->schedule);
- else
- silc_protocol_free(protocol);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_protocol_backup_done,
+ ctx, 0, 1);
break;
- case SILC_PROTOCOL_STATE_UNKNOWN:
+ default:
break;
}
-#endif /* 0 */
}
/* Final resuming protocol completion callback */
SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
{
-#if 0
SilcServerBackupProtocolContext ctx = context;
SilcServer server = ctx->server;
+ SilcDList list;
SilcServerEntry server_entry;
SilcPacketStream sock;
SilcBool error;
- int i;
- silc_schedule_task_del_by_context(server->schedule, protocol);
+ silc_schedule_task_del_by_context(server->schedule, ctx);
error = ctx->error;
- if (error) {
+ if (error)
SILC_LOG_ERROR(("Error occurred during backup router resuming protcool"));
- if (server->server_type == SILC_SERVER)
- silc_schedule_task_del_by_callback(server->schedule,
- silc_server_backup_connect_to_router);
- }
if (server->server_shutdown)
return;
/* Remove this protocol from all server entries that has it */
- for (i = 0; i < server->config->param.connections_max; i++) {
- sock = server->sockets[i];
- if (!sock || !sock->user_data ||
- (sock->type != SILC_CONN_ROUTER &&
- sock->type != SILC_CONN_SERVER))
- continue;
+ list = silc_packet_engine_get_streams(server->packet_engine);
+ if (!list)
+ return;
- server_entry = sock->user_data;
+ silc_dlist_start(list);
+ while ((sock = silc_dlist_get(list))) {
+ server_entry = silc_packet_get_context(sock);
+ if (!server_entry)
+ continue;
- /* The SilcProtocol context was shared between all connections, clear
- it from all connections. */
- if (sock->protocol == protocol) {
- sock->protocol = NULL;
+ if (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+ server_entry->data.conn_type != SILC_CONN_SERVER)
+ continue;
+ if (server_entry->backup_proto == ctx) {
if (error) {
if (server->server_type == SILC_SERVER &&
/* Backup router */
if (SILC_PRIMARY_ROUTE(server) == sock && server->backup_router) {
if (ctx->sock == sock) {
- silc_socket_free(sock); /* unref */
+ silc_packet_stream_unref(sock);
ctx->sock = NULL;
}
/* Restart the protocol. */
proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
proto_ctx->server = server;
- proto_ctx->sock = silc_socket_dup(sock);
+ proto_ctx->sock = sock;
proto_ctx->responder = FALSE;
proto_ctx->type = SILC_SERVER_BACKUP_START;
proto_ctx->start = time(0);
proto_ctx->initiator_restart = ctx->initiator_restart + 1;
+ silc_packet_stream_ref(sock);
/* Start through scheduler */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_connected_later,
- proto_ctx, 5, 0,
- SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_connected_later,
+ proto_ctx, 5, 0);
} else {
/* If failure was received, switch back to normal backup router.
For some reason primary wouldn't accept that we were supposed
silc_server_local_servers_toggle_enabled(server, FALSE);
server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
silc_server_update_servers_by_server(server, server->id_entry,
- sock->user_data);
+ silc_packet_get_context(sock));
silc_server_update_clients_by_server(server, NULL,
- sock->user_data, TRUE);
+ silc_packet_get_context(sock),
+ TRUE);
/* Announce our clients and channels to the router */
silc_server_announce_clients(server, 0, sock);
silc_server_announce_channels(server, 0, sock);
/* Announce WATCH list a little later */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_announce_watches,
- silc_socket_dup(sock), 5, 0,
- SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ silc_packet_stream_ref(sock);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_announce_watches,
+ sock, 5, 0);
}
continue;
server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
}
}
+ silc_packet_engine_free_streams_list(list);
if (!error) {
SILC_LOG_INFO(("Backup resuming protocol ended successfully"));
silc_server_announce_channels(server, 0, server->router->connection);
/* Announce WATCH list a little later */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_announce_watches,
- silc_socket_dup(server->router->connection), 4, 0,
- SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+ silc_packet_stream_ref(server->router->connection);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_announce_watches,
+ server->router->connection, 4, 0);
}
} else {
/* Error */
FALSE);
/* Check couple of times same START_USE just in case. */
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_check_status,
- silc_socket_dup(server->router->connection),
- 5, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_check_status,
- silc_socket_dup(server->router->connection),
- 20, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
- silc_schedule_task_add(server->schedule, 0,
- silc_server_backup_check_status,
- silc_socket_dup(server->router->connection),
- 60, 1, SILC_TASK_TIMEOUT,
- SILC_TASK_PRI_NORMAL);
+ silc_packet_stream_ref(server->router->connection);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_check_status,
+ server->router->connection,
+ 5, 1);
+ silc_packet_stream_ref(server->router->connection);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_check_status,
+ server->router->connection,
+ 20, 1);
+ silc_packet_stream_ref(server->router->connection);
+ silc_schedule_task_add_timeout(server->schedule,
+ silc_server_backup_check_status,
+ server->router->connection,
+ 60, 1);
}
}
}
- if (ctx->sock && ctx->sock->protocol)
- ctx->sock->protocol = NULL;
- if (ctx->sock)
- silc_socket_free(ctx->sock); /* unref */
- silc_protocol_free(protocol);
+ if (ctx->sock) {
+ SilcServerEntry r = silc_packet_get_context(ctx->sock);
+ if (r) {
+ r->backup = FALSE;
+ r->backup_proto = NULL;
+ }
+ silc_packet_stream_unref(ctx->sock);
+ }
silc_free(ctx->sessions);
silc_free(ctx);
-#endif /* 0 */
}
SILC_TASK_CALLBACK(silc_server_backup_announce_watches)
{
-#if 0
SilcPacketStream sock = context;
SilcServer server = app_context;
- if (sock->users > 1)
+ if (silc_packet_stream_is_valid(sock))
silc_server_announce_watches(server, sock);
- silc_socket_free(sock);
-#endif /* 0 */
+ silc_packet_stream_unref(sock);
}
void silc_server_http_init(SilcServer server)
{
+ if (!server->config->httpd_ip)
+ return;
+
/* Allocate HTTP server */
server->httpd = silc_http_server_alloc(server->config->httpd_ip,
server->config->httpd_port,
/* Pending command queue */
SilcDList pending_commands;
- /* Purge context for disconnected clients */
- SilcIDListPurge purge_i;
- SilcIDListPurge purge_g;
-
unsigned int server_type : 2; /* Server type (server.h) */
unsigned int standalone : 1; /* Set if server is standalone, and
does not have connection to network. */
SilcDList attrs; /* Requested Attributes in WHOIS */
/* Query session data */
+ SilcPacketStream router; /* Router to send our query */
SilcServerCommandContext cmd; /* Command context for query */
SilcServerQueryList querylist; /* Temporary query list context */
SilcServerQueryID queries; /* Ongoing queries */
SilcUInt16 queries_count; /* Number of ongoing queries */
SilcUInt16 queries_left; /* Number of ongoing queries left */
SilcUInt16 errors_count; /* number of errors */
- unsigned int querycmd : 7; /* Query command (SilcCommand) */
- unsigned int resolved : 1; /* TRUE if normal server has resolved
+ unsigned int querycmd : 7; /* Query command (SilcCommand) */
+ unsigned int resolved : 1; /* TRUE if normal server has resolved
information from router */
+ unsigned int dynamic_prim : 1; /* Dynamic connection attempt to primary */
+ unsigned int dynamic_retry : 1; /* Primary returned error, send to
+ nick@serv server. */
+ unsigned int parsed : 1; /* Set when query is parsed */
} *SilcServerQuery;
+
void silc_server_query_free(SilcServerQuery query);
void silc_server_query_send_error(SilcServer server,
SilcServerQuery query,
void *id, SilcIdType id_type);
void silc_server_query_send_router(SilcServer server, SilcServerQuery query);
void silc_server_query_send_router_reply(void *context, void *reply);
-void silc_server_query_parse(SilcServer server, SilcServerQuery query);
+SilcBool silc_server_query_parse(SilcServer server, SilcServerQuery query,
+ SilcBool parse_only);
void silc_server_query_process(SilcServer server, SilcServerQuery query,
SilcBool resolve);
void silc_server_query_resolve(SilcServer server, SilcServerQuery query,
to the entity who sent this query to us automatically. Returns
TRUE if the query is being processed or FALSE on error. */
-SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
- SilcServerCommandContext cmd)
+SilcBool silc_server_query_command(SilcServer server,
+ SilcCommand querycmd,
+ SilcServerCommandContext cmd,
+ void *old_query)
{
SilcServerQuery query;
SILC_LOG_DEBUG(("Query %s command", silc_get_command_name(querycmd)));
- query = silc_calloc(1, sizeof(*query));
- query->querycmd = querycmd;
- query->cmd = silc_server_command_dup(cmd);
+ if (!old_query) {
+ query = silc_calloc(1, sizeof(*query));
+ query->querycmd = querycmd;
+ query->cmd = silc_server_command_dup(cmd);
+ query->router = SILC_PRIMARY_ROUTE(server);
+ } else
+ query = old_query;
switch (querycmd) {
(!silc_argument_get_arg_type(cmd->args, 1, NULL) &&
!silc_argument_get_arg_type(cmd->args, 4, NULL) &&
silc_argument_get_arg_type(cmd->args, 3, NULL)))) {
+ if (!silc_server_query_parse(server, query, TRUE))
+ return FALSE;
silc_server_query_send_router(server, query);
return TRUE;
}
if (server->server_type == SILC_SERVER && !server->standalone &&
cmd->sock != SILC_PRIMARY_ROUTE(server) &&
!silc_argument_get_arg_type(cmd->args, 5, NULL)) {
+ if (!silc_server_query_parse(server, query, TRUE))
+ return FALSE;
silc_server_query_send_router(server, query);
return TRUE;
}
}
/* Now parse the request */
- silc_server_query_parse(server, query);
+ silc_server_query_parse(server, query, FALSE);
return TRUE;
}
+/* Remote server connected callback. */
+
+void silc_server_query_connected(SilcServer server,
+ SilcServerEntry server_entry,
+ void *context)
+{
+ SilcServerQuery query = context;
+
+ if (!server_entry) {
+ /* Connecting failed */
+ SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+ SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+ if (query->dynamic_prim /* && @serv != prim.host.name */ &&
+ !silc_server_num_sockets_by_remote(server, query->nick_server,
+ query->nick_server, 706, type)) {
+ /* Connection attempt to primary router failed, now try to the one
+ specified in nick@server. */
+ silc_server_create_connection(server, FALSE, TRUE, query->nick_server,
+ 706, silc_server_query_connected,
+ query);
+ query->dynamic_prim = FALSE;
+ return;
+ }
+
+ /* Process the query after failed connect. This will send error back
+ because such nick was not found. */
+ SILC_LOG_DEBUG(("Process query, connecting failed"));
+ silc_server_query_process(server, query, TRUE);
+ return;
+ }
+
+ /* Reprocess the query */
+ SILC_LOG_DEBUG(("Reprocess query after creating connection to %s",
+ server_entry->server_name));
+ query->router = server_entry->data.sconn->sock;
+ silc_server_query_command(server, query->querycmd, query->cmd, query);
+}
+
/* Send the received query to our primary router since we could not
handle the query directly. We will reprocess the query after our
router replies back. */
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
- SILC_LOG_DEBUG(("Forwarding the query to router for processing"));
+ SILC_LOG_DEBUG(("Forwarding the query to router %p for processing",
+ query->router));
/* Statistics */
server->stat.commands_sent++;
old_ident = silc_command_get_ident(query->cmd->payload);
silc_command_set_ident(query->cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(query->cmd->payload);
- silc_server_packet_send(server,
- SILC_PRIMARY_ROUTE(server),
+ silc_server_packet_send(server, query->router,
SILC_PACKET_COMMAND, 0,
tmpbuf->data, silc_buffer_len(tmpbuf));
silc_command_set_ident(query->cmd->payload, old_ident);
/* Check if router sent error reply */
if (cmdr && !silc_command_get_status(cmdr->payload, NULL, NULL)) {
SilcBuffer buffer;
+ SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+ SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+ /* If this was nick@server query, retry to @serv if the primary router
+ returned error. */
+ if (query->nick_server[0] && !query->dynamic_retry &&
+ !silc_server_num_sockets_by_remote(server, query->nick_server,
+ query->nick_server, 1334, type)) {
+ SILC_LOG_DEBUG(("Retry query by connecting to %s:%d",
+ query->nick_server, 706));
+ silc_server_create_connection(server, FALSE, TRUE, query->nick_server,
+ 1334, silc_server_query_connected,
+ query);
+ query->dynamic_retry = TRUE;
+ query->resolved = FALSE;
+ return;
+ }
SILC_LOG_DEBUG(("Sending error to original query"));
}
/* Continue with parsing */
- silc_server_query_parse(server, query);
+ silc_server_query_parse(server, query, FALSE);
}
/* Parse the command query and start processing the queries in detail. */
-void silc_server_query_parse(SilcServer server, SilcServerQuery query)
+SilcBool silc_server_query_parse(SilcServer server, SilcServerQuery query,
+ SilcBool parse_only)
{
SilcServerCommandContext cmd = query->cmd;
SilcIDListData idata = silc_packet_get_context(cmd->sock);
SILC_LOG_DEBUG(("Parsing %s query",
silc_get_command_name(query->querycmd)));
+ if (query->parsed)
+ goto parsed;
+
switch (query->querycmd) {
case SILC_COMMAND_WHOIS:
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
/* Get the nickname@server string and parse it */
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_NICKNAME, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
/* Check nickname */
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_NICKNAME, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
memset(query->nickname, 0, sizeof(query->nickname));
silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
silc_free(query->ids);
query->ids = NULL;
query->ids_count = 0;
- return;
+ return FALSE;
}
}
}
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
/* Get the nickname@server string and parse it */
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_NICKNAME, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
/* Check nickname */
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_NICKNAME, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
memset(query->nickname, 0, sizeof(query->nickname));
silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_NICKNAME, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
memset(query->nickname, 0, sizeof(query->nickname));
silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_SERVER, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
query->server_name = tmp;
}
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_BAD_CHANNEL, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
query->channel_name = tmp;
}
silc_server_query_send_error(server, query,
SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
silc_server_query_free(query);
- return;
+ return FALSE;
}
} else {
silc_free(query->ids);
query->ids = NULL;
query->ids_count = 0;
- return;
+ return FALSE;
}
}
} else {
silc_free(query->ids);
query->ids = NULL;
query->ids_count = 0;
- return;
+ return FALSE;
}
}
break;
}
+ query->parsed = TRUE;
+
+ parsed:
+ if (!parse_only && query->nickname) {
+ switch (query->querycmd) {
+ case SILC_COMMAND_WHOIS:
+ case SILC_COMMAND_IDENTIFY:
+ /* Check server name. If we are open server and don't yet have
+ connection to remote router, create it now. */
+ if (query->nick_server[0] && server->config->dynamic_server &&
+ !query->resolved) {
+ /* If primary router is specified, use that. Otherwise connect
+ to the server in nick@server string. */
+ SilcServerConfigRouter *router;
+ SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+ SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+ router = silc_server_config_get_primary_router(server);
+ if (router && server->standalone) {
+ /* Create connection to primary router */
+ SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+ router->host, router->port));
+ query->dynamic_prim = TRUE;
+ silc_server_create_connection(server, FALSE, TRUE,
+ router->host, router->port,
+ silc_server_query_connected, query);
+ return FALSE;
+ } else if (!silc_server_num_sockets_by_remote(server,
+ query->nick_server,
+ query->nick_server,
+ 706, type)) {
+ /* Create connection and handle the query after connection */
+ SILC_LOG_DEBUG(("Create dynamic connection to %s:%d",
+ query->nick_server, 706));
+ silc_server_create_connection(server, FALSE, TRUE,
+ query->nick_server, 706,
+ silc_server_query_connected, query);
+ return FALSE;
+ }
+ }
+ }
+ }
+
/* Start processing the query information */
- silc_server_query_process(server, query, TRUE);
+ if (!parse_only)
+ silc_server_query_process(server, query, TRUE);
+
+ return TRUE;
}
/* Context for holding clients searched by public key. */
if (query->nickname[0]) {
/* Get all clients matching nickname from local list */
if (!silc_idlist_get_clients_by_hash(server->local_list,
- query->nickname, server->md5hash,
+ query->nickname,
+ query->nick_server[0] ?
+ query->nick_server : NULL,
+ server->md5hash,
&clients, &clients_count))
silc_idlist_get_clients_by_nickname(server->local_list,
query->nickname,
- query->nick_server,
- /* XXX nick_server may not be set */
+ query->nick_server[0] ?
+ query->nick_server : NULL,
&clients, &clients_count);
/* Check global list as well */
if (check_global) {
if (!silc_idlist_get_clients_by_hash(server->global_list,
- query->nickname, server->md5hash,
+ query->nickname,
+ query->nick_server[0] ?
+ query->nick_server : NULL,
+ server->md5hash,
&clients, &clients_count))
silc_idlist_get_clients_by_nickname(server->global_list,
query->nickname,
- query->nick_server,
- /* XXX nick_server may not be set */
+ query->nick_server[0] ?
+ query->nick_server : NULL,
&clients, &clients_count);
}
to the entity who sent this query to us automatically. Returns
TRUE if the query is being processed or FALSE on error. */
SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
- SilcServerCommandContext cmd);
+ SilcServerCommandContext cmd,
+ void *old_query);
/* Find client by the Client ID indicated by the `client_id', and if not
found then query it by using WHOIS command. The client information
if (server_signoff) {
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
- argv = silc_realloc(argv, sizeof(*argv) * (argc + 1));
- argv_lens = silc_realloc(argv_lens, sizeof(*argv_lens) *
- (argc + 1));
- argv_types = silc_realloc(argv_types, sizeof(*argv_types) *
- (argc + 1));
- argv[argc] = silc_calloc(silc_buffer_len(idp), sizeof(*argv[0]));
- memcpy(argv[argc], idp->data, silc_buffer_len(idp));
- argv_lens[argc] = silc_buffer_len(idp);
- argv_types[argc] = argc + 1;
- argc++;
- silc_buffer_free(idp);
+ if (idp) {
+ argv = silc_realloc(argv, sizeof(*argv) * (argc + 1));
+ argv_lens = silc_realloc(argv_lens, sizeof(*argv_lens) *
+ (argc + 1));
+ argv_types = silc_realloc(argv_types, sizeof(*argv_types) *
+ (argc + 1));
+ argv[argc] = silc_calloc(silc_buffer_len(idp), sizeof(*argv[0]));
+ memcpy(argv[argc], idp->data, silc_buffer_len(idp));
+ argv_lens[argc] = silc_buffer_len(idp);
+ argv_types[argc] = argc + 1;
+ argc++;
+ silc_buffer_free(idp);
+ }
}
/* Update statistics */
since the server is local. */
if (!local) {
SILC_LOG_DEBUG(("Moving client to local list"));
- silc_idcache_add(server->local_list->clients, client_cache->name,
- client_cache->id, client_cache->context);
- silc_idcache_del_by_context(server->global_list->clients, client,
- NULL);
+ silc_idcache_move(server->global_list->clients,
+ server->local_list->clients, client_cache);
}
server_entry = server_entry->router;
} else {
since the server is local. */
if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) {
SILC_LOG_DEBUG(("Moving client to local list"));
- silc_idcache_add(server->local_list->clients, client_cache->name,
- client_cache->id, client_cache->context);
- silc_idcache_del_by_context(server->global_list->clients, client,
- NULL);
+ silc_idcache_move(server->global_list->clients,
+ server->local_list->clients, client_cache);
} else if (server->server_type == SILC_BACKUP_ROUTER && local) {
/* If we are backup router and this client is on local list, we
must move it to global list, as it is not currently local to
us (we are not primary). */
SILC_LOG_DEBUG(("Moving client to global list"));
- silc_idcache_add(server->global_list->clients, client_cache->name,
- client_cache->id, client_cache->context);
- silc_idcache_del_by_context(server->local_list->clients, client,
- NULL);
+ silc_idcache_move(server->local_list->clients,
+ server->global_list->clients, client_cache);
}
}
since the server is global. */
if (local) {
SILC_LOG_DEBUG(("Moving client to global list"));
- silc_idcache_add(server->global_list->clients, client_cache->name,
- client_cache->id, client_cache->context);
- silc_idcache_del_by_context(server->local_list->clients, client,
- NULL);
+ silc_idcache_move(server->local_list->clients,
+ server->global_list->clients, client_cache);
}
server_entry = server_entry->router;
} else {
since the server is global. */
if (server_entry->server_type != SILC_BACKUP_ROUTER && local) {
SILC_LOG_DEBUG(("Moving client to global list"));
- silc_idcache_add(server->global_list->clients, client_cache->name,
- client_cache->id, client_cache->context);
- silc_idcache_del_by_context(server->local_list->clients, client,
- NULL);
+ silc_idcache_move(server->local_list->clients,
+ server->global_list->clients, client_cache);
}
}
return server_entry;
SilcUInt32 silc_server_num_sockets_by_remote(SilcServer server,
const char *ip,
const char *hostname,
- SilcUInt16 port)
+ SilcUInt16 port,
+ SilcConnectionType type)
{
SilcServerConnection conn;
+ SilcIDListData idata;
+ SilcConnectionType t = SILC_CONN_UNKNOWN;
int count = 0;
if (!ip && !hostname)
return 0;
+ SILC_LOG_DEBUG(("Num connections %d", silc_dlist_count(server->conns)));
+
silc_dlist_start(server->conns);
while ((conn = silc_dlist_get(server->conns))) {
+ if (conn->sock) {
+ idata = silc_packet_get_context(conn->sock);
+ if (idata)
+ t = idata->conn_type;
+ }
if (((ip && !strcmp(conn->remote_host, ip)) ||
(hostname && !strcmp(conn->remote_host, hostname))) &&
- conn->remote_port == port)
+ conn->remote_port == port && t == type)
count++;
}
global->connections_max_per_host);
if (max_hosts && conn_number >= max_hosts) {
+ SILC_LOG_DEBUG(("Server is full, %d >= %d", conn_number, max_hosts));
SILC_LOG_INFO(("Server is full, closing %s (%s) connection",
hostname, ip));
silc_server_disconnect_remote(server, sock,
}
if (num_sockets >= max_per_host) {
+ SILC_LOG_DEBUG(("Too many connections, %d >= %d", num_sockets,
+ max_per_host));
SILC_LOG_INFO(("Too many connections from %s (%s), closing connection",
hostname, ip));
silc_server_disconnect_remote(server, sock,
silc_schedule_task_del_by_callback(server->schedule,
silc_server_connect_to_router);
silc_schedule_task_add_timeout(server->schedule,
- silc_server_connect_to_router, server, 0, 1);
+ silc_server_connect_to_router, server, 1, 0);
}
static void
SilcUInt32 silc_server_num_sockets_by_remote(SilcServer server,
const char *ip,
const char *hostname,
- SilcUInt16 port);
+ SilcUInt16 port,
+ SilcConnectionType type);
/* Get public key by key usage and key context. */
SilcPublicKey silc_server_get_public_key(SilcServer server,
SilcPublicKey public_key;
SilcSKR skr = *auth_data;
SilcSKRFind find;
- SilcSKRStatus status;
+ SilcSKRStatus status = SILC_SKR_NOT_FOUND;
if (!silc_pkcs_load_public_key(p, &public_key)) {
SILC_SERVER_LOG_ERROR(("Error while parsing config file: "
find = silc_skr_find_alloc();
silc_skr_find_set_public_key(find, public_key);
silc_skr_find_set_usage(find, usage);
- silc_skr_find_set_context(find, key_context ? key_context : (void *)usage);
+ if (!key_context)
+ silc_skr_find_set_context(find, SILC_32_TO_PTR(usage));
silc_skr_find(skr, NULL, find, my_find_callback, &status);
- if (status == SILC_SKR_ALREADY_EXIST) {
+ if (status == SILC_SKR_OK) {
+ /* Already added, ignore error */
silc_pkcs_public_key_free(public_key);
- SILC_SERVER_LOG_WARNING(("Warning: public key file \"%s\" already "
- "configured, ignoring this key", p));
- return TRUE; /* non fatal error */
+ return TRUE;
}
/* Add the public key to repository */
- if (silc_skr_add_public_key(skr, public_key, usage,
- key_context ? key_context : (void *)usage,
- NULL) != SILC_SKR_OK) {
+ status = silc_skr_add_public_key(skr, public_key, usage,
+ key_context ? key_context :
+ (void *)usage, NULL);
+ if (status != SILC_SKR_OK) {
SILC_SERVER_LOG_ERROR(("Error while adding public key \"%s\"", p));
return FALSE;
}
}
config->httpd_port = (SilcUInt16)port;
}
+ else if (!strcmp(name, "dynamic_server")) {
+ config->dynamic_server = *(SilcBool *)val;
+ }
+ else if (!strcmp(name, "local_channels")) {
+ config->local_channels = *(SilcBool *)val;
+ }
else
return SILC_CONFIG_EINTERNAL;
CONFIG_IS_DOUBLE(tmp->server_ip);
tmp->server_ip = strdup((char *) val);
}
+ else if (!strcmp(name, "public_ip")) {
+ SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
+ CONFIG_IS_DOUBLE(tmp->public_ip);
+ tmp->public_ip = strdup((char *) val);
+ }
else if (!strcmp(name, "port")) {
int port = *(int *)val;
SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
else if (!strcmp(name, "backuplocal")) {
tmp->backup_local = *(SilcBool *)val;
}
+ else if (!strcmp(name, "dynamic_connection")) {
+ tmp->dynamic_connection = *(SilcBool *)val;
+ }
else
return SILC_CONFIG_EINTERNAL;
{ "http_server", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
{ "http_server_ip", SILC_CONFIG_ARG_STRE, fetch_generic, NULL },
{ "http_server_port", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
+ { "dynamic_server", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
+ { "local_channels", SILC_CONFIG_ARG_TOGGLE, fetch_generic, NULL },
{ 0, 0, 0, 0 }
};
static const SilcConfigTable table_serverinfo_c[] = {
{ "ip", SILC_CONFIG_ARG_STR, fetch_serverinfo, NULL},
+ { "public_ip", SILC_CONFIG_ARG_STR, fetch_serverinfo, NULL},
{ "port", SILC_CONFIG_ARG_INT, fetch_serverinfo, NULL},
{ 0, 0, 0, 0 }
};
{ "backuphost", SILC_CONFIG_ARG_STRE, fetch_router, NULL },
{ "backupport", SILC_CONFIG_ARG_INT, fetch_router, NULL },
{ "backuplocal", SILC_CONFIG_ARG_TOGGLE, fetch_router, NULL },
+ { "dynamic_connection", SILC_CONFIG_ARG_TOGGLE, fetch_router, NULL },
{ 0, 0, 0, 0 }
};
ret = FALSE;
}
+ if (!config->server_info->public_key ||
+ !config->server_info->private_key) {
+ SILC_SERVER_LOG_ERROR(("\nError: Server keypair is missing"));
+ ret = FALSE;
+ }
+
+ if (!config->server_info->primary) {
+ SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory block `Primary' "
+ "in `ServerInfo'"));
+ ret = FALSE;
+ }
+
+ if (!config->server_info->primary->server_ip) {
+ SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory field `Ip' "
+ "in `Primary' in `ServerInfo'"));
+ ret = FALSE;
+ }
+
/* RouterConnection sanity checks */
if (config->routers && config->routers->backup_router == TRUE &&
"connection. You have marked it incorrectly as backup router."));
ret = FALSE;
}
-#if 0
- if (config->routers && config->routers->initiator == FALSE &&
- config->routers->backup_router == FALSE) {
- SILC_SERVER_LOG_ERROR((
- "\nError: First RouterConnection block must be primary router "
- "connection and it must be marked as Initiator."));
- ret = FALSE;
- }
-#endif
if (config->routers && config->routers->backup_router == TRUE &&
!config->servers && !config->routers->next) {
SILC_SERVER_LOG_ERROR((
typedef struct SilcServerConfigServerInfoInterfaceStruct {
char *server_ip;
+ char *public_ip;
SilcUInt16 port;
struct SilcServerConfigServerInfoInterfaceStruct *next;
} SilcServerConfigServerInfoInterface;
SilcServerConfigConnParams *param;
SilcBool initiator;
SilcBool backup_router;
+ SilcBool dynamic_connection;
char *backup_replace_ip;
SilcUInt16 backup_replace_port;
SilcBool backup_local;
SilcBool httpd;
char *httpd_ip;
SilcUInt16 httpd_port;
+ SilcBool dynamic_server;
+ SilcBool local_channels;
/* Other configuration sections */
SilcServerConfigCipher *cipher;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
(*new_id)->ip.data_len = silc_net_is_ip4(ip) ? 4 : 16;
(*new_id)->port = SILC_SWAB_16(port);
- (*new_id)->rnd = silc_rng_get_rn16(rng);
+ (*new_id)->rnd = 0xff;
SILC_LOG_DEBUG(("New ID (%s)", silc_id_render(*new_id, SILC_ID_SERVER)));
}
SilcUInt16 port;
SilcSocket sock;
SilcIDListData idata = silc_packet_get_context(s);
- if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(s),
+ if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(s),
&sock, &hostname, &ip, &port))
continue;
fprintf(fdd, " %d: host %s ip %s port %d type %d\n",
{ 15, "*silcd*,*serverid*,silc_server_*,*idlist*" },
/* All from silcd/ and basic stuff from libs */
- { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,*silcske*" },
+ { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*silcske*" },
/* All from silcd/ and more stuff from libs */
- { 25, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 25, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*" },
/* All from silcd/ and even more stuff from libs */
- { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*" },
/* All from silcd/ and even more stuff from libs + all from silccore */
- { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*" },
/* All from silcd/, all from silccore, silccrypt and silcmath */
- { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + stuff
from silcutil */
- { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
from silcutil */
- { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*,*net*" },
/* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
from silcutil */
- { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+ { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
"*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
"*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
"*sockconn*,*net*,*log*,*config*" },
silc_pkcs_register_default();
silc_hash_register_default();
silc_hmac_register_default();
- silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
- opt_identifier, "", NULL, NULL, FALSE);
+ if (!silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
+ opt_identifier, "", NULL, NULL, FALSE))
+ exit(1);
exit(0);
}
# Put here any platform specific stuff
#
case "$target" in
+ *-*-linux*)
+ check_threads=true
+ CFLAGS=`echo $CFLAGS -D_GNU_SOURCE`
+ ;;
*-*-freebsd*)
check_threads=true
;;
__SILC_HAVE_SIM=""
__SILC_ENABLE_DEBUG=""
+#ifdef SILC_DIST_TOOLKIT
+toolkitver=`echo $VERSION | sed 's/\./ /g'`
+maj=0
+min=0
+bld=0
+for v in $toolkitver
+do
+ if test $maj -eq 0; then
+ maj=$v
+ continue
+ fi
+ if test $min -eq 0; then
+ min=$v
+ continue
+ fi
+ if test $bld -eq 0; then
+ bld=$v
+ continue
+ fi
+done
+__SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
+#endif SILC_DIST_TOOLKIT
+
AC_PROG_RANLIB
#ifndef SILC_DIST_TOOLKIT
AC_DISABLE_SHARED
AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
-AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep tzset)
+AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
-#ifdef SILC_DIST_SIM
-# SIM support checking
-# XXX These needs to be changed as more supported platforms appear.
-# XXX This probably needs to be made platform dependant check.
-#
-sim_support=false
-AC_MSG_CHECKING(for SIM support)
-AC_MSG_RESULT()
-AC_CHECK_HEADERS(dlfcn.h,
- [
- AC_CHECK_LIB(dl, dlopen,
- [
- AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
- sim_support=true
- LIBS="$LIBS -ldl"
- ],
- [
- AC_CHECK_LIB(c, dlopen,
- [
- AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
- sim_support=true
- ])
- ])
- ])
-
-AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
-if test x$sim_support = xtrue; then
- AC_MSG_RESULT(Enabled SIM support.)
- __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
-else
- AC_MSG_RESULT(No SIM support found.)
-fi
-#endif SILC_DIST_SIM
-
# lib/contrib conditionals
#
AC_CHECK_HEADER(regex.h,
AC_MSG_RESULT(no)
])
+# Disable all compiler optimizations
+#
+AC_MSG_CHECKING(whether to enable compiler optimizations)
+want_cc_optimizations=true
+AC_ARG_ENABLE(optimizations,
+ [ --disable-optimizations do not use any compiler optimizations],
+ [
+ AC_MSG_RESULT(no)
+ AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
+ want_cc_optimizations=false
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ want_cc_optimizations=true
+ ])
+AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
+
# Disable all assembler optimizations
#
AC_MSG_CHECKING(whether to enable assembler optimizations)
if test "$GCC"; then
# GCC specific options
if test "x$summary_debug" = "xyes"; then
- SILC_ADD_CFLAGS(-g -O)
+ SILC_ADD_CFLAGS(-g)
else
- SILC_ADD_CFLAGS(-g -O2)
+ SILC_ADD_CFLAGS(-g)
fi
SILC_ADD_CFLAGS(-Wall -finline-functions)
SILC_ADD_CFLAGS(-Wno-pointer-sign)
# Other compilers
case "$target" in
alpha*-dec-osf*)
- SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+ SILC_ADD_CFLAGS(-g3)
;;
mips*-sgi-irix*)
- SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+ SILC_ADD_CFLAGS(-g3)
;;
*)
SILC_ADD_CFLAGS(-g)
- SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
;;
esac
fi
fi
+if test x$want_cc_optimizations = xtrue; then
+ if test "$GCC"; then
+ # GCC specific options
+ if test "x$summary_debug" = "xyes"; then
+ SILC_ADD_CFLAGS(-O)
+ else
+ SILC_ADD_CFLAGS(-O2)
+ fi
+ else
+ # Other compilers
+ case "$target" in
+ alpha*-dec-osf*)
+ SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+ ;;
+ mips*-sgi-irix*)
+ SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+ ;;
+ *)
+ SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+ ;;
+ esac
+ fi
+fi
+
#
# Workaround a bug in GCC 2.x which causes memory exhaustion
# when compiling sha1 with optimizations on UltraSPARC.
# Default installation destination
#
-#ifdef SILC_DIST_AUTODIST
AC_PREFIX_DEFAULT(/usr/local)
-#else !SILC_DIST_AUTODIST
-AC_PREFIX_DEFAULT(/usr/local/silc)
-#endif SILC_DIST_AUTODIST
if test "x$prefix" != xNONE; then
silc_prefix="$prefix"
else
silc_prefix="$ac_default_prefix"
+ prefix="$silc_prefix"
fi
#ifndef SILC_DIST_AUTODIST
-# etc directory
-#
-if test "x$sysconfdir" != 'x${prefix}/etc'; then
- ETCDIR="$sysconfdir"
-else
- ETCDIR="$silc_prefix/etc"
-fi
-
-AC_ARG_WITH(etcdir,
- [[ --with-etcdir=DIR directory for system files [/etc/silc]]],
- [
- case "$withval" in
- no|yes)
- ;;
- *)
- ETCDIR="$withval"
- ;;
- esac
- ])
+ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
AC_SUBST(ETCDIR)
AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
-# doc directory
-#
-DOCDIR="$silc_prefix/doc"
-AC_ARG_WITH(docdir,
- [[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
- [
- case "$withval" in
- no|yes)
- ;;
- *)
- DOCDIR="$withval"
- ;;
- esac
- ])
+DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
AC_SUBST(DOCDIR)
AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
#endif SILC_DIST_AUTODIST
if test "$ac_silc_libs" != "no"; then
compile_libs=false
LIBSUBDIR=
- LIBS="$LIBS -L$ac_silc_libs"
+ LDFLAGS="-L$ac_silc_libs $LDFLAGS"
+ else
+ LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
fi
# Check libs to link against
else
# pkg-config check
- PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
+ PKG_CHECK_MODULES(SILC, [silc >= 1.1], compile_libs=false, compile_libs=true)
#ifdef SILC_DIST_CLIENTLIB
- PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
+ PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.1.1], compile_libs=false, compile_libs=true)
#endif SILC_DIST_CLIENTLIB
#ifdef SILC_DIST_SERVERLIB
PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
if test x$compile_libs = xfalse; then
LIBSUBDIR=
- LIBS="$LIBS $SILC_LIBS"
+ LIBS="$SILC_LIBS $LIBS"
CFLAGS="$CFLAGS $SILC_CFLAGS"
#ifdef SILC_DIST_CLIENTLIB
- LIBS="$LIBS $SILCCLIENT_LIBS"
+ LIBS="$SILCCLIENT_LIBS $LIBS"
CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
#endif SILC_DIST_CLIENTLIB
#ifdef SILC_DIST_SERVERLIB
LIBS="$LIBS $SILCSERVER_LIBS"
CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
#endif SILC_DIST_SERVERLIB
+ else
+ LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
fi
fi
+#else SILC_DIST_TOOLKIT
+LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
#endif SILC_DIST_TOOLKIT
-AC_SUBST(LIBSUBDIR)
+#ifdef SILC_DIST_SIM
+# SIM support checking
+# XXX These needs to be changed as more supported platforms appear.
+# XXX This probably needs to be made platform dependant check.
+#
+sim_support=false
+AC_MSG_CHECKING(for SIM support)
+AC_MSG_RESULT()
+AC_CHECK_HEADERS(dlfcn.h,
+ [
+ AC_CHECK_LIB(dl, dlopen,
+ [
+ AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
+ sim_support=true
+ LIBS="$LIBS -ldl"
+ ],
+ [
+ AC_CHECK_LIB(c, dlopen,
+ [
+ AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
+ sim_support=true
+ ])
+ ])
+ ])
+
+AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
+if test x$sim_support = xtrue; then
+ AC_MSG_RESULT(Enabled SIM support.)
+ __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
+else
+ AC_MSG_RESULT(No SIM support found.)
+fi
+#endif SILC_DIST_SIM
# SOCKS4 support checking
#
__SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
fi
+#
+# Check for timezone and tm_gmtoff for timezone information
+#
+AC_MSG_CHECKING(whether system has timezone)
+AC_RUN_IFELSE(
+ [
+ #include <stdio.h>
+ #include <time.h>
+ int main()
+ {
+ timezone = 0;
+ return 0;
+ }
+ ],
+ [ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
+ [ AC_MSG_RESULT(no) ],
+ [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has tm_gmtoff)
+AC_RUN_IFELSE(
+ [
+ #include <stdio.h>
+ #include <time.h>
+ int main()
+ {
+ struct tm tm;
+ tm.tm_gmtoff = 0;
+ return 0;
+ }
+ ],
+ [ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
+ [ AC_MSG_RESULT(no) ],
+ [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has __tm_gmtoff)
+AC_RUN_IFELSE(
+ [
+ #include <stdio.h>
+ #include <time.h>
+ int main()
+ {
+ struct tm tm;
+ tm.__tm_gmtoff = 0;
+ return 0;
+ }
+ ],
+ [ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
+ [ AC_MSG_RESULT(no) ],
+ [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has __tm_gmtoff__)
+AC_RUN_IFELSE(
+ [
+ #include <stdio.h>
+ #include <time.h>
+ int main()
+ {
+ struct tm tm;
+ tm.__tm_gmtoff__ = 0;
+ return 0;
+ }
+ ],
+ [ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
+ [ AC_MSG_RESULT(no) ],
+ [ AC_MSG_RESULT(no) ]
+)
+
# Native WIN32 compilation under cygwin
#
AC_MSG_CHECKING(whether to compile native WIN32 code)
#
# Substitutions
#
+AC_SUBST(LIBSUBDIR)
AC_SUBST(SILC_TOP_SRCDIR)
+AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(SILC_LIB_INCLUDES)
AC_SUBST(__SILC_HAVE_PTHREAD)
AC_SUBST(__SILC_HAVE_SIM)
AC_SUBST(__SILC_ENABLE_DEBUG)
+AC_SUBST(__SILC_PACKAGE_VERSION)
#
# Fix the libtool to support run-time configuration. This allows us
name SILC Autodist
package autodist
bug-report autodist-bugs@silcnet.org
+prereq 1.3.2
license apps/autodist/COPYING
license-header distdir/GPL-header distdir/BSD-header
noprocess apps/autodist/doc/* apps/autodist/tests/*
-post-process-dist-hook distdir/post-process-dist
+post-process-dist-hook distdir/autodist-post-process-dist
post-dist-hook distdir/post-dist
--- /dev/null
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+# Remove all CVS directories, as some may be left when we put directories
+# in EXTRA_DIST or 'include' them in distribution.
+
+if test -d $distdir; then
+ rm -rf `find $distdir -name CVS`
+ rm -rf `find $distdir -name Makefile`
+fi
+
+release=$5
+if test -z $release; then
+ release="0.fc7"
+fi
+
+sed -e "s/AUTODIST_VERSION/$dist_version/" -e "s/AUTODIST_RELEASE/$release/" \
+ apps/autodist/autodist.spec.in > $distdir/autodist.spec
+
name Client
package silc-client
bug-report silc-devel@lists.silcnet.org
+prereq 1.3.2
inherit common
define SILC_DIST_CLIENT
define SILC_DIST_LIB
define SILC_DIST_INCLUDES
define SILC_DIST_DOC
-define SILC_DIST_SIM
define SILC_DIST_SFTP
define SILC_DIST_COMPILER
define SILC_DIST_IDCACHE
inherit toolkit
define SILC_DIST_INPLACE
+define SILC_DIST_SIM
# SFTP is undefined in server, so force it here
define SILC_DIST_SFTP
dist_version=$2
package=$3
distdir=$4
+release=$5
+
+if test -z $release; then
+ release="0.fc7"
+fi
+
+sed -e "s/SILC_VERSION/$dist_version/" -e "s/SILC_RELEASE/$release/" \
+ apps/irssi/silc-client.spec.in > apps/irssi/silc-client.spec
cd doc
make dist-hook
dist_version=$2
package=$3
distdir=$4
+release=$5
+
+if test -z $release; then
+ release="0.fc7"
+fi
+
+sed -e "s/SILC_VERSION/$dist_version/" -e "s/SILC_RELEASE/$release/" \
+ silc-toolkit.spec.in > silc-toolkit.spec
./configure
make toolkit-ref-html
cp ../lib/doc/*.gif toolkit
cd ..
-
define SILC_DIST_SERVER
#define SILC_DIST_SERVERLIB
define SILC_DIST_HTTP
+define SILC_DIST_SIM
undef SILC_DIST_SFTP
post-process-dist-hook distdir/post-process-dist
name Toolkit
package silc-toolkit
bug-report silc-devel@lists.silcnet.org
+prereq 1.3.2
# Inherits
inherit common
define SILC_DIST_TOOLKIT
define SILC_DIST_CLIENTLIB
define SILC_DIST_HTTP
+define SILC_DIST_SIM
# Includes
include README.CVS
AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
+#ifdef SILC_DIST_TOOLKIT
all:
touch draft-riikonen-silc-spec-09.txt
touch draft-riikonen-silc-pp-09.txt
touch draft-riikonen-silc-multimedia-session-00.txt
touch draft-riikonen-presence-attrs-04.txt
-#ifdef SILC_DIST_TOOLKIT
makerfc = $(SILC_TOP_SRCDIR)/scripts/makerfc
toolkit-ref-html:
fi
dist-hook:
- $(SILC_TOP_SRCDIR)/scripts/manpages.pl
touch draft-riikonen-silc-spec-09.txt
touch draft-riikonen-silc-pp-09.txt
touch draft-riikonen-silc-ke-auth-09.txt
#else !SILC_DIST_TOOLKIT
dist-hook:
$(SILC_TOP_SRCDIR)/scripts/manpages.pl
- rm -f draft-riikonen*.txt
- touch draft-riikonen-silc-spec-09.txt
- touch draft-riikonen-silc-pp-09.txt
- touch draft-riikonen-silc-ke-auth-09.txt
- touch draft-riikonen-silc-commands-07.txt
- touch draft-riikonen-silc-flags-payloads-04.txt
- touch draft-riikonen-silc-multimedia-session-00.txt
- touch draft-riikonen-presence-attrs-04.txt
#endif SILC_DIST_TOOLKIT
doc-install:
-$(INSTALL_DATA) $(top_srcdir)/doc/CodingStyle $(docdir)/
-$(INSTALL_DATA) $(top_srcdir)/GPL $(docdir)/
-$(INSTALL_DATA) $(top_srcdir)/BSD $(docdir)/
+ -$(INSTALL_DATA) $(top_srcdir)/doc/*.txt $(docdir)/
#endif SILC_DIST_TOOLKIT
-$(INSTALL_DATA) $(top_srcdir)/doc/FAQ $(docdir)/
- -$(INSTALL_DATA) $(top_srcdir)/doc/*.txt $(docdir)/
-$(INSTALL_DATA) $(top_srcdir)/COPYING $(docdir)/
-$(INSTALL_DATA) $(top_srcdir)/CHANGES $(docdir)/
-$(INSTALL_DATA) $(top_srcdir)/CREDITS $(docdir)/
#ifdef SILC_DIST_SERVER
examples silcd.8 silcd.conf.5 \
example_silcd.conf \
+ silcalgs.conf \
#endif SILC_DIST_SERVER
#ifdef SILC_DIST_TOOLKIT
toolkit \
CodingStyle \
+ draft-riikonen*.txt \
+ silcalgs.conf \
#endif SILC_DIST_TOOLKIT
- FAQ \
- silcalgs.conf \
- draft-riikonen*.txt
+ FAQ
include $(top_srcdir)/Makefile.defines.in
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2002 - 2006 Pekka Riikonen
+ Copyright (C) 2002 - 2007 Pekka Riikonen
- The contents of this file are subject to one of the Licenses specified
- in the COPYING file; You may not use this file except in compliance
- with the License.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
- The software distributed under the License is distributed on an "AS IS"
- basis, in the hope that it will be useful, but WITHOUT WARRANTY OF ANY
- KIND, either expressed or implied. See the COPYING file for more
- information.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
*/
/* Native Symbian specific includes and definitions. */
extern "C" {
#endif
+/* Version check macro. Use this to check that package is of specific
+ version compile time. Use the __SILC_XXX_VERSION below in comparison. */
+#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)
+@__SILC_PACKAGE_VERSION@
+
#define SILC_VERSION_STRING "@VERSION@"
#define SILC_DIST_VERSION_STRING "@VERSION@"
#define SILC_PROTOCOL_VERSION_STRING "SILC-1.2-@VERSION@ @PACKAGE@"
LIB_BASE_VERSION=1.1
# libsilc versions
-LIBSILC_CURRENT=1 # prev = 0
+LIBSILC_CURRENT=2 # prev = 1
LIBSILC_REVISION=0 # prev = 0
LIBSILC_AGE=0 # prev = 0
# libsilcclient versions
-LIBSILCCLIENT_CURRENT=1 # prev = 0
+LIBSILCCLIENT_CURRENT=2 # prev = 1
LIBSILCCLIENT_REVISION=0 # prev = 0
LIBSILCCLIENT_AGE=0 # prev = 0
)
])
+MODULESDIR="$silc_prefix/lib/modules"
#ifdef SILC_DIST_SIM
# SIM modules directory
#
-MODULESDIR="$silc_prefix/modules"
AC_ARG_WITH(simdir,
[[ --with-simdir=DIR directory for SIM modules [PREFIX/modules]]],
[
;;
esac
])
-AC_SUBST(MODULESDIR)
AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
#endif SILC_DIST_SIM
+AC_SUBST(MODULESDIR)
#ifdef SILC_DIST_TOOLKIT
# Stack trace checking
<br /><br />
<li><a href="http://silcnet.org">SILC Project Website</a><br />
-<li><a href="http://silcnet.org/?page=docs">SILC Protocol Documentation</a><br />
-<li><a href="http://silcnet.org/?page=whitepaper">SILC White Paper</a><br />
-<li><a href="http://silcnet.org/?page=faq">SILC FAQ</a><br />
+<li><a href="http://silcnet.org/support/documentation/">SILC Protocol Documentation</a><br />
+<li><a href="http://silcnet.org/support/documentation/wp/">SILC White Paper</a><br />
+<li><a href="http://silcnet.org/support/faq/">SILC FAQ</a><br />
<tt>
void (*command_reply)(SilcClient client, SilcClientConnection conn,<br />
-
-SilcCommandPayload cmd_payload, bool success, SilcCommand command,<br />
-
-SilcStatus status, ...);
+ SilcCommand command, SilcStatus status,<br />
+ SilcStatus error, va_list ap);
</tt>
<br /> <br />
Sent to the client if the user is invited on a channel. The 'channel
argument may be NULL but the `channel_name' is always provided.
</td>
-<td width="50%"><small>SilcClientChannel channel, char *channel_name,
+<td width="50%"><small>SilcChannelEntry channel, char *channel_name,
SilcClientEntry inviter
</td>
</tr>
NULL. The `signoff_client' is the client signing off. The `channel' is
the channel where the client was joined. The `channel' may be NULL.
</td>
-<td width="50%"><small>SilcClientEntry signoff_client, char
+<td width="50%"><small>SilcClientEntry signoff_client, char
*signoff_message, SilcChannelEntry channel
</td>
</tr>
<br /> <br />
<li><a href="#general">General</a><br />
+<li><a href="#platform">Platform changes</a>
<li><a href="#client">Client library</a><br />
<li><a href="#util">Utility library</a><br />
<li><a href="#apputil">Application utility library</a>
<li><a href="#vcard">VCard library</a>
<li><a href="#http">HTTP library</a>
<li><a href="#asn1">ASN.1 library</a>
-<li><a href="#other">Other libraries</a>
<br /> <br />
<h3><a name="general"></a>General changes</h3>
filenames in your source tree.
+<br /> <br />
+<h3><a name="platform"></a>Platform changes</h3>
+
+The Windows support has been made better by improving the SILC scheduler
+and network routines. Calling silc_net_win32_init and silc_net_win32_uninit
+is not needed anymore. The network routines on Windows are enabled
+automatically.
+
+
<br /> <br />
<h3><a name="client"></a>Client library, lib/silcclient/</h3>
<h4>SilcClientOperations structure</h4>
-The SilcClientOperation structure has changed significantly. It no longer
+The SilcClientOperations structure has changed significantly. It no longer
has `connected', `disconnected' and `failure' function pointers. Instead a
new SilcClientConnectCallback has been defined that is given as argument to
functions like silc_client_connect_to_server, silc_client_connect_to_client
<br /> <br />
Also the `detach' client operation function pointer has been removed. Instead
-the detachment data is now simply delivered in the SILC_COMMNAD_DETACH
+the detachment data is now simply delivered in the SILC_COMMAND_DETACH
command reply.
<br /> <br />
The functions silc_client_connect_to_server, silc_client_connect_to_client
and silc_client_key_exchange can all be used to create new SILC session with
a remote. To connect SILC server use silc_client_connect_to_server. You
-now give the SilcClientCnnectionParams as argument which includes the nickname
-user wants to use, you now can give the public key pair as argument that is
+now give the SilcClientConnectionParams as argument which includes the
+nicknameuser wants to use, you now can give the public key pair as argument that is
to be used in the connecting. The new SilcClientConnectCallback will be
called once the connection has been established and it delivers the
SilcClientConection context to the application. It will be later called
<br /> <br />
<pre>
-SilcAsyncOperations op;
+SilcAsyncOperation op;
SilcClientConnectionParams params;
memset(¶ms, 0, sizeof(params));
Just like in Toolkit 1.0 we now have SilcClientEntry to represent user,
SilcChannelEntry to represent channel and SilcServerEntry to represent
server. In the past these structures and all API functions that dealt
-with them were in silcclient.h file. They are now in silcclient_entry.h
-in Toolkit 1.1.
+with them were in <a href="silcclient.html">silcclient.h</a> file. They
+are now in <a href="silcclient_entry.html">silcclient_entry.h</a> in
+Toolkit 1.1.
<br /> <br />
As an general convention each of these new entries now are reference
The Utility library (runtime library) has had several changes and has several
new interfaces. Some interfaces has also been removed or moved to some
other library. Removed interfaces rae: silcprotocol.h and silcsockconn.h.
-Moved interfaces are: silcapputil.h and silcvcard.h.
+Moved interfaces are: <a href="silcapputil.html">silcapputil.h</a> and
+<a href="silcvcard.html">silcvcard.h</a>.
<h4>SILC Async Operation Interface</h4>
-A new asynchronous operation API (silcasync.h) has been added. It can be
-used to control asynchronous operations, like to cancel them. Many
-asynchronous routines in SILC Toolkit now return SilcAsyncOperation context
-so that the operation can be controlled by the caller. It especiallly
-provides a generic way to cancel asynchronous operations which
-can be difficult.
+A new asynchronous operation API (<a href="silcasync.html">silcasync.h</a>)
+has been added. It can be used to control asynchronous operations, like
+to cancel them. Many asynchronous routines in SILC Toolkit now return
+SilcAsyncOperation context so that the operation can be controlled by the
+caller. It especiallly provides a generic way to cancel asynchronous
+operations which can be difficult.
<h4>SILC Atomic Operations Interface</h4>
-A new atomic operations API (silcatomic.h) has been added. It provides
-routines to perform various operations on integeres and pointers atomically.
+A new atomic operations API (<a href="silcatomic.html">silcatomic.h</a>)
+has been added. It provides routines to perform various operations on
+integeres and pointers atomically.
<h4>SILC Data Stack Interface</h4>
-A new data stack (memory pool system) API (silcstack.h) has been added.
+A new data stack (memory pool system) API
+(<a href="silcstack.html">silcstack.h</a>) has been added.
It provides a fast memory allocation system. Many routines in the SILC Toolkit
are SilcStack aware thus enabling them to use the SilcStack as their source
for memory allocation. All routines that are SilcStack aware automatically
<h4>SILC Condition Variable Interface</h4>
-A new condition variable API (silccond.h) has been added. It provides
-condition variables for multithreaded applications.
+A new condition variable API (<a href="silccond.html">silccond.h</a>)
+has been added. It provides condition variables for multithreaded
+applications.
<h4>SILC Stream Interface</h4>
-A new abstract stream API (silcstream.h) has been added. The SilcStream
+A new abstract stream API (<a href="silcstream.html">silcstream.h</a>)
+has been added. The SilcStream
provides an abstract way of representing different kinds of streams. The
API provides functions that can be used to read, write, control and destroy
streams. The API is not used to create streams but separate interfaces
<h4>SILC FD Stream Interface</h4>
-A new file descriptor stream API (silcfdstream.h) has been added. It
+A new file descriptor stream API
+(<a href="silcfdstream.html">silcfdstream.h</a>) has been added. It
provides a blocking and non-blocking file descriptor stream through the
SilcStream abstraction.
<h4>SILC Socket Stream Interface</h4>
-A new socket stream API (silcsocketstream.h) has been added. It provides
-a blocking and non-blocking socket stream through the SilcStream
+A new socket stream API
+(<a href="silcsocketstream.html">silcsocketstream.h</a>) has been added.
+It provides a blocking and non-blocking socket stream through the SilcStream
abstraction.
<h4>SILC FSM Interface</h4>
-A new Finite State Machine API (silcfsm.h) has been added. It provides
+A new Finite State Machine API
+(<a href="silcfsm.html">silcfsm.h</a>) has been added. It provides
an FSM that can be used to implement all kinds of machines and protocols.
The machine also supports threads, and threads that are actually executed
in real system threads. The SILC FSM API also supports asynchronous
<h4>SILC Time Interface</h4>
-A new SILC Time API (silctime.h) has been added. It provides utility
+A new SILC Time API
+(<a href="silctime.html">silctime.h</a>) has been added. It provides utility
functions to retrieve and represent time in different ways. It supports
Universal and Generalized time string creation and parsing and adds a new
SilcTime structure to represent time.
<h4>SILC Snprintf Interface</h4>
-A new snprintf API (silcsnprintf.h) has been added. It provides snprintf
-and other string formatting routines.
+A new snprintf API
+(<a href="silcsnprintf.html">silcsnprintf.h</a>) has been added. It
+provides snprintf and other string formatting routines.
<h4>SILC Mutex Interface changes</h4>
-The SILC Mutex API (silcmutex) has several changes. A support for read/write
-locks has been added (SilcRwLock). Also silc_mutex_assert_locked function
-is added.
+The SILC Mutex API (<a href="silcmutex.html">silcmutex.h</a>)
+has several changes. A support for read/write locks has been added
+(SilcRwLock). Also silc_mutex_assert_locked function is added.
<h4>SILC Network Interface changes</h4>
-The SILC Network API (silcnet.h) has several changes. The API is almost
+The SILC Network API
+(<a href="silcnet.html">silcnet.h</a>) has several changes. The API is almost
entirely rewritten and most of the old functions have been removed. The
API has now both TCP and UDP support, and as previously supports IPv4
and IPv6. New functions are silc_net_tcp_create_listener,
<h4>SILC Scheduler Interface changes</h4>
-The SILC Schedule API (silcschedule.h) has several changes. The scheduler
-has been entirely rewritten but most of the API remains the same.
+The SILC Schedule API
+(<a href="silcschedule.html">silcschedule.h</a>) has several changes. The
+scheduler has been entirely rewritten but most of the API remains the same.
The SILC_TASK_GENERIC and SILC_TASK_CALLBACK_GLOCAL have been removed.
The way signal are dispatched has been changed. The SILC Schedule is now
able to itself dispatch all signals. New functions are
<h4>SILC Types Interface changes</h4>
-The SILC Type API (silctypes.h) has several changes. The bool type is
-replaced with SilcBool. Sockets are now represented by SilcSocket.
+The SILC Type API (<a href="silctypes.html">silctypes.h</a>) has several
+changes. The bool type is replaced with SilcBool. Sockets are now
+represented by SilcSocket.
<h4>SILC String util Interface changes</h4>
-The SILC string utility API (silcstrutil.h) has changes. The PEM encoding
+The SILC string utility API
+(<a href="silcstrutil.html">silcstrutil.h</a>) has changes. The PEM encoding
and decoding routines has been renamed, silc_base64_encode,
silc_base64_encode_file and silc_base64_decode. The silc_mime_parse has
been removed. A new silc_string_split function has been added.
<h4>SILC File Util Interface changes</h4>
-The SILC file utility API (silcfileutil.h) has changes. A new function
-silc_file_set_nonblock has been added.
+The SILC file utility API (<a href="silcfileutil.html">silcfileutil.h</a>)
+has changes. A new function silc_file_set_nonblock has been added.
<h4>SILC List and Dynamic List Interface changes</h4>
-The SILC List (silclist.h) and SILC Dynamic List (silcdlist.h) APIs have
-changes. New functions silc_list_insert and silc_dlist_insert have been
-added.
+The SILC List (<a href="silclist.html">silclist.h</a>) and SILC Dynamic List
+(silcdlist.h) APIs have changes. New functions silc_list_insert and
+silc_dlist_insert have been added.
<h4>SILC Buffer Interface changes</h4>
-The SILC Buffer API (silcbuffer.h) has several changes. The SilcBuffer
+The SILC Buffer API (<a href="silcbuffer.html">silcbuffer.h</a>) has several
+changes. The SilcBuffer
structure no longer contain the buffer length and true length fields
but silc_buffer_len() and silc_buffr_truelen() macros are available
instead. Also silc_buffer_data(), silc_buffer_datalen(), silc_buffer_purge(),
<h4>SILC Buffer Formatting Interface changes</h4>
-The SILC Buffer Formatting API (silcbuffmt.h) has several changes. The
+The SILC Buffer Formatting API
+(<a href="silcbuffmt.html">silcbuffmt.h</a>) has several changes. The
silc_buffer_format now automatically allocates memory to the destination
buffer if it does not have space. Also new the following new formatters
have been added: SILC_STR_DATA (replaces SILC_STR_UI_XNSTRING),
<h4>SILC Memory Interface changes</h4>
-The memory allocation API (silcmemory.h) has several changes. It supports
-now SilcStack as memory source. Also all memory allocation routines can
-now fail and return NULL as opposed to fatally failing when memory allocation
-fails.
+The memory allocation API (<a href="silcmemory.html">silcmemory.h</a>) has
+several changes. It supports now SilcStack as memory source. Also all
+memory allocation routines can now fail and return NULL as opposed to fatally
+failing when memory allocation fails.
<br /> <br />
<h3><a name="apputil"></a>SILC Application Utility library, lib/silcapputil/</h3>
<h4>SILC Application Utility Interface</h4>
-The silcapputil.h contains various application utility functions. It
+The <a href="silcapputil.html">silcapputil.h</a> contains various application
+utility functions. It
existed in Toolkit 1.0 but some of the APIs has been changed. The
silc_create_key_pair, silc_load_key_pair and silc_show_public_key APIs
has changed. A new silc_show_public_key_file has been added. Functions
<h4>SILC ID Cache Interface</h4>
-The ID Cache interface (silcidcache.h) has been moved from lib/silccore
-into lib/silcapputil/.
+The ID Cache interface (<a href="silcidcache.html">silcidcache.h</a>) has
+been moved from lib/silccore into lib/silcapputil/.
<br /> <br />
<h3><a name="skr"></a>SILC Key Repository library, lib/silcskr/</h3>
A new SILC Key Repository library has been added. The library provides
-a SILC Key Repository API (silcskr.h) which provides a repository for
-storing and retrieving public keys.
+a SILC Key Repository API (<a href="silcskr.html">silcskr.h</a>) which provides
+a repository for storing and retrieving public keys.
<br /> <br />
<h3><a name="vcard"></a>SILC VCard library, lib/silcvcard/</h3>
<h4>SILC HTTP Server Interface</h4>
-The SILC HTTP Server API (silchttpservder.h) provides a simple HTTP
-server implementation for applications that want to integrate a small
-HTTP server.
+The SILC HTTP Server API (<a href="silchttpserver.html">silchttpservder.h</a>)
+provides a simple HTTP server implementation for applications that want to
+integrate a small HTTP server.
<h4>SILC HTTP PHP Translator Interface</h4>
-The SILC HTTP PHP Translator API (silchttpphp.h) provides PHP translates
-PHP code into HTML. It can be used to serve PHP pages in HTTP server.
+The SILC HTTP PHP Translator API (<a href="silchttpphp.html">silchttpphp.h</a>)
+ provides PHP translates PHP code into HTML. It can be used to serve PHP
+pages in HTTP server.
<br /> <br />
<h3><a name="asn1"></a>SILC ASN.1 library, lib/silcasn1/</h3>
<h4>SILC ASN.1 Interface</h4>
-The SILC ASN.1 API (silcasn1.h) provides ASN.1 encoder and decoder. The
-interface provides efficient encoder and decoder and is support SilcStack
-as memory source. The interface is simple and it supports almost all ASN.1
-features.
+The SILC ASN.1 API (<a href="silcasn1.html">silcasn1.h</a>) provides ASN.1
+encoder and decoder. The interface provides efficient encoder and decoder
+and is support SilcStack as memory source. The interface is simple and it
+supports almost all ASN.1 features.
<h4>SILC BER Interface</h4>
-The SILC BER API (silcber.h) provides BER/DER encoder and decoder. It is
-integral part of the ASN.1 library and the ASN.1 encoder and decoder.
+The SILC BER API (<a href="silcber.html">silcber.h</a>) provides BER/DER
+encoder and decoder. It is integral part of the ASN.1 library and the ASN.1
+encoder and decoder.
it wants. The library is entirely transparent to the user interface and
it does not include any user interface specific issues such as window
handling or item handling on the screen etc. These does not interest
-the library. The `silcclient.h' also defines the client libary interface
-the application can call. The interface includes for example functions
-for sending channel and private messages, client and channel retrieval
-and other utility functions.
+the library. The `silcclient.h' and `silcclient_entry.h' also defines the
+client libary interface the application can call. The interface includes
+for example functions for sending channel and private messages, client and
+channel retrieval and other utility functions.
<br /> <br /> <br />
<b>Including Library Headers</b>
#include "silcclient.h"
</tt>
-<br /> <br /> <br />
-<b>Network Initialization on Win32</b>
-
-<br /> <br />
-If you are programming your SILC client application on Windows system,
-you will need to initialize the network routines in order to be able
-to use the client library. The network initialization is done by
-calling the silc_net_win32_init at the start of your Windows application.
-Usually this is done either in main() or WinMain() function, or other
-similar place. This function should be called before calling any other
-SILC routine.
-
-<br /> <br />
-<tt>
-if (silc_net_win32_init() == FALSE)<br />
- exit_with_error();
-</tt>
-
-<br /> <br />
-This function is available only on Win32 platforms, and on other platforms
-the network routines are initialized automatically by the operating system.
-
<br /> <br /> <br />
<b>Creating Client</b>
manner:
<br /> <br />
-<tt> SilcClient client = silc_client_alloc(&ops, params, context, silc_version_string);</tt>
+<tt> SilcClient client = silc_client_alloc(&ops, params, context, NULL);</tt>
<br /> <br />
`ops' is the static structure of client operations that library will call.
`context' can be some application specific context that will be saved into
the SilcClient object. It is up to the caller to free this context.
SilcClient is always passed to the application thus the application
-specific context can be retrieved from the SilcClient object. See
-`client.h' file for detailed definition of SilcClient object.
-
-<br /> <br />
-The `silc_version_string' is the current protocol version string, and you
-can get it by including `silcversion.h' header in your source code.
+specific context can be retrieved from the SilcClient object.
<br /> <br />
`ops' can be defined for example as follows:
silc_notify,<br />
silc_command,<br />
silc_command_reply,<br />
- silc_connect,<br />
- silc_disconnect,<br />
silc_get_auth_method,<br />
silc_verify_public_key,<br />
silc_ask_passphrase,<br />
- silc_failure,<br />
silc_key_agreement,<br />
+ silc_file_transfer,<br />
};<br />
</tt>
<b>Initializing the Client</b>
<br /> <br />
-The client must be initialized before running. However, there are also
-some other tasks that must be done before initializing the client.
-The following pointers must be set by the application before calling
-the initializing function:
+The client must be initialized before running. The client is initialized
+simply by calling silc_client_init function:
<br /> <br />
-<tt>
- client->username<br />
- client->hostname<br />
- client->realname<br />
- client->pkcs<br />
- client->public_key<br />
- client->private_key
-</tt>
-
-<br /> <br />
-You may also set client->nickname if you want. If it is set then the
-library will change the nickname to that one after the client is connected
-to the server. If not set, then server will initially give the nickname
-which is same as the username.
-
-<br /> <br />
-After setting the pointers one must call:
+<tt> silc_client_init(client, username, hostname, realname,
+ foo_client_running, foo_ctx);</tt>
<br /> <br />
-<tt> silc_client_init(client);</tt>
-
-<br /> <br />
-which then initializes the client library for the `client'. If the
-pointers mentioned above are not initialized the silc_client_init will
-fail. The application should check the return value of the silc_client_init
-function.
+which then initializes the client library for the `client'. The `username'
+and `hostname' pointers are required. The `foo_client_running' with
+`foo_ctx' in this example will be called by the client library after the
+client is up and running. After you receive this callback you may start
+using other API functions, such as creating connection to remote server.
<br /> <br /> <br />
can use an timeout task, or an idle task provided by your GUI library to
accomplish this. After you have initialized the client library with
silc_client_init, you should register the timeout task or idle task that
-will call the silc_client_run_one periodically. In the Toolkit package
-there is GTK-- GUI example in silcer/ directory. That example calls the
-silc_client_run_one every 50 milliseconds, and it should be sufficient for
-smooth working.
+will call the silc_client_run_one periodically.
<br /> <br />
For Win32 the silc_client_run can be used instead of using the Windows's
own event loop. However, if you would like to use the silc_client_run_one
-also on Win32 systems it is possible.
+also on Win32 system it is possible.
<br /> <br /> <br />
<b>Creating Connection to Server</b>
<br /> <br />
-Connection to remote SILC server is done by calling:
+After your client is up and running you may create connection to remote
+SILC server. It is done simply by calling:
<br /> <br />
-<tt> silc_client_connect_to_server(client, port, hostname, context);</tt>
+<tt> silc_client_connect_to_server(client, ¶ms,
+ public_key, private_key,
+ remote_host, remote_port,
+ foo_connected_cb, foo_ctx);</tt>
<br /> <br />
The function will create the connection asynchronously to the server, ie.
-the function will return before the actual connection is created. After
-the connection is created the client->ops->connect operation is called.
-
-<br /> <br />
-Generally speaking the connections are associated with windows' on the
-screen. IRC is usually implemented this way, however it is not the
-necessary way to associate the client's connections. SilcClientConnection
-object is provided by the library (and is always passed to the application)
-that can be used in the application to associate the connection from the
-library. Application specific context can be saved to the
-SilcClientConnection object which then can be retrieved in the application,
-thus perhaps associate the connection with what ever object in
-application (window or something else).
-
-
-<br /> <br /> <br />
-<b>Using Own Connecting</b>
-
-<br /> <br />
-Application might not want to use silc_client_connect_to_server function
-if it wants to perform its own connecting for some reason. In this case
-application must call function silc_client_start_key_exchange after it
-has created the connection by itself. This function starts the key
-exhange protocol between the client and server and the library takes care
-of everything after that.
-
-<br /> <br />
-After connection has been created application must call:
-
-<br /> <br />
-<tt>
- SilcClientConnection conn;
-
-<br /> <br />
- /* Add new connection to client */<br />
- conn = silc_client_add_connection(client, hostname, port, context);
-
-<br /> <br />
- /* Start key exchange and let the library handle everything<br />
- after this point on. */<br />
- silc_client_start_key_exchange(client, conn, sock);
-</tt>
-
-<br /> <br />
-NOTE: These calls are performed only and only if application did not call
-silc_client_connect_to_server function, but performed the connecting
-process manually.
+the function will return before the actual connection is created. The
+`foo_connected_cb' will be called once the connection has been established.
+The `params' may be NULL but it may be used to provide additional parameters
+to the connecting. For example it is possible to set the initial nickname
+you would like to use into the `params'.
<br /> <br /> <br />
<br /> <br />
Then, to say in your application you would like to use the debugging use
-the SILC_ENABLE_DEBUG macro. Put this macro to your main header file, or
+the SILC_DEBUG macro. Put this macro to your main header file, or
some other file that needs the debugging enabled. After using this macro
you are able to use the debugging routines provided by the SILC Toolkit.
Note that, the Toolkit library must be compiled with --enable-debug for
<br /> <br />
<tt>
- silc_log_set_debug_string("silc_client*,*socket*,*ske*");<br />
+ silc_log_set_debug_string("silc_client*,*sock*,*ske*");<br />
</tt>
<br /> <br />
Note that the variable arguments in SILC_LOG_HEXDUMP are before the second
last parenthesis, and the last two arguments are the data, and its length that
are hexdumped.
-
-
-<br /> <br /> <br />
-<b>Example Client</b>
-
-<br /> <br />
-This section includes an example SILC client implementation in pseudo-like
-C code. It creates and initializes the client and sets up an imaginary
-user interface. The user will use the user interface then to create
-the connections. The SilcClientOperations are expected to be implemented.
-
-<br /> <br />
-<pre>
-#include "silc.h"
-#include "silcclient.h"
-
-int main()
-{
- SilcClientOperations ops = {
- silc_say,
- silc_channel_message,
- silc_private_message,
- silc_notify,
- silc_command,
- silc_command_reply,
- silc_connect,
- silc_disconnect,
- silc_get_auth_method,
- silc_verify_public_key,
- silc_ask_passphrase,
- silc_failure,
- silc_key_agreement,
- silc_ftp,
- silc_detach
- };
-
- SilcClient client;
-
- /* Allocate SILC client. The `silc_version_string' is defined
- in includes/version.h file. */
- client = silc_client_alloc(&ops, NULL, NULL, silc_version_string);
-
- /* Set the mandatory pointers, read public and private key from
- files (or somewhere) and return pointers and PKCS context. */
- client->username = silc_get_username();
- client->hostname = silc_net_localhost();
- client->realname = silc_get_real_name();
- client->pkcs = get_public_and_private_key(&client->public_key,
- &client->private_key);
-
- /* If the keys does not exist, create a key pair since we must
- provide key pair to the library. */
- if (!client->pkcs)
- generate_key_new_key_pair(client);
-
- /* Iinitialize client */
- if (!silc_client_init(client))
- fatal_error("Could not initialize client");
-
- /* Initialize user interface. The user interface can be generally
- initialized at any phase, including before actually allocating
- and initializing the client, if wished. */
- InitUserInterface();
- DoCoolThings();
-
- /* Start the client. This will start the scheduler. At this phase
- the user might have the user interface in front of him already.
- He will use the user interface to create the connection to the
- server for example. When this function returns the program is
- ended. */
- silc_client_run(client);
-
- /* Client is ended */
- return 0;
-}
-</pre>
silc_free(def);
}
+ if (!strstr(identifier, "UN=") || !strstr(identifier, "HN=")) {
+ fprintf(stderr, "Invalid public key identifier. You must specify both "
+ "UN and HN\n");
+ return FALSE;
+ }
+
rng = silc_rng_alloc();
silc_rng_init(rng);
silc_rng_global_init(rng);
return FALSE;
/* Save public key into file */
- silc_pkcs_save_public_key(pkfile, public_key, SILC_PKCS_FILE_BASE64);
+ if (!silc_pkcs_save_public_key(pkfile, public_key, SILC_PKCS_FILE_BASE64))
+ return FALSE;
/* Save private key into file */
- silc_pkcs_save_private_key(prvfile, private_key,
- (const unsigned char *)pass, strlen(pass),
- SILC_PKCS_FILE_BIN, rng);
+ if (!silc_pkcs_save_private_key(prvfile, private_key,
+ (const unsigned char *)pass, strlen(pass),
+ SILC_PKCS_FILE_BIN, rng))
+ return FALSE;
if (return_public_key)
*return_public_key = public_key;
if (!silc_pkcs_load_private_key(prv_filename,
(const unsigned char *)pass, strlen(pass),
return_private_key)) {
+ silc_pkcs_public_key_free(*return_public_key);
+ *return_public_key = NULL;
memset(pass, 0, strlen(pass));
silc_free(pass);
return FALSE;
return silc_idcache_update(cache, c, new_id, new_name, free_old_name);
}
+/* Move entry to another cache */
+
+SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+ SilcIDCacheEntry entry)
+{
+ SilcIDCacheEntry c;
+
+ SILC_LOG_DEBUG(("Moving entry %p from %p cache to %p cache", entry,
+ from_cache, to_cache));
+
+ if (!from_cache || !to_cache || !entry)
+ return FALSE;
+
+ if (from_cache->id_type != to_cache->id_type) {
+ SILC_LOG_ERROR(("Incompatible ID caches, cannot move entry"));
+ return FALSE;
+ }
+
+ if (entry->context) {
+ if (!silc_hash_table_find(from_cache->context_table, entry->context,
+ NULL, (void *)&c))
+ return FALSE;
+ } else if (entry->name) {
+ if (!silc_hash_table_find(from_cache->name_table, entry->name,
+ NULL, (void *)&c))
+ return FALSE;
+ } else if (entry->id) {
+ if (!silc_hash_table_find(from_cache->id_table, entry->id,
+ NULL, (void *)&c))
+ return FALSE;
+ } else {
+ return FALSE;
+ }
+
+ if (entry != c)
+ return FALSE;
+
+ /* See if this entry is added already to cache */
+ if (c->id && silc_idcache_find_by_id_one(to_cache, c->id, NULL)) {
+ SILC_LOG_ERROR(("Attempted to add same ID twice to ID Cache, id %s",
+ silc_id_render(c->id, to_cache->id_type)));
+ SILC_ASSERT(FALSE);
+ return FALSE;
+ }
+
+ /* Remove from original cache */
+ if (c->name)
+ silc_hash_table_del_by_context(from_cache->name_table, c->name, c);
+ if (c->context)
+ silc_hash_table_del_by_context(from_cache->context_table, c->context, c);
+ if (c->id)
+ silc_hash_table_del_by_context(from_cache->id_table, c->id, c);
+
+ /* Move to the other cache */
+ if (c->id)
+ silc_hash_table_add(to_cache->id_table, c->id, c);
+ if (c->name)
+ silc_hash_table_add(to_cache->name_table, c->name, c);
+ if (c->context)
+ silc_hash_table_add(to_cache->context_table, c->context, c);
+
+ return TRUE;
+}
+
/* Returns all cache entrys from the ID cache to the `ret' ID Cache List. */
SilcBool silc_idcache_get_all(SilcIDCache cache, SilcList *ret_list)
void *new_id, char *new_name,
SilcBool free_old_name);
+/****f* silcapputil/SilcIDCacheAPI/silc_idcache_move
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+ * SilcIDCacheEntry entry);
+ *
+ * DESCRIPTION
+ *
+ * Moves the ID cache entry indicated by `entry' from the `from_cache'
+ * to `to_cache'. After this returns TRUE the `entry' is available only
+ * from the `to_cache'. Return FALSE if `entry' is not in `from_cache'
+ * or system is out of memory.
+ *
+ ***/
+SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+ SilcIDCacheEntry entry);
+
/****f* silcapputil/SilcIDCacheAPI/silc_idcache_get_all
*
* SYNOPSIS
ret = FALSE; \
goto fail; \
} \
- *s = silc_smalloc_ua(stack1, *s_len + 1); \
+ *s = silc_smalloc(stack1, *s_len + 1); \
if (*s) { \
silc_utf8_encode(rdata, rdata_len, (enc), *s, *s_len); \
(*s)[*s_len] = '\0'; \
goto fail; \
} \
silc_stack_push(asn1->stack2, &frame); \
- s = silc_smalloc_ua(stack2, s_len + 1); \
+ s = silc_smalloc(stack2, s_len + 1); \
if (s) { \
silc_utf8_decode(d, d_len, (enc), s, s_len); \
s[s_len] = '\0'; \
{
SILC_LOG_DEBUG(("Stopping client"));
+ if (!silc_fsm_is_started(&client->internal->fsm)) {
+ SILC_LOG_WARNING(("Attempting to stop client library before it has been "
+ "started (silc_client_init not called)"));
+ return;
+ }
+
client->internal->running = (SilcClientRunning)stopped;
client->internal->running_context = context;
/* Allocate SKE */
conn->internal->ske =
- silc_ske_alloc(client->rng, conn->internal->schedule,
- conn->internal->params.repository,
- conn->public_key, conn->private_key, fsm);
+ silc_ske_alloc(client->rng, conn->internal->schedule, NULL,
+ conn->public_key, NULL, fsm);
if (!conn->internal->ske)
return SILC_FSM_FINISH;
SilcList list;
SilcDList clients;
SilcClientEntry entry;
- char *nicknamec, *parsed = NULL, *format = NULL;
+ char nick[128 + 1], *nicknamec, *parsed = NULL, *format = NULL;
+ char server[256 + 1];
if (!client || !conn || !nickname)
return NULL;
+ /* Get nickname from nickname@server string */
+ silc_parse_userfqdn(nickname, nick, sizeof(nick), server, sizeof(server));
+
/* Parse nickname in case it is formatted */
- if (!silc_client_nickname_parse(client, conn, (char *)nickname, &parsed))
+ if (!silc_client_nickname_parse(client, conn, (char *)nick, &parsed))
return NULL;
if (!get_all && parsed)
- format = (char *)nickname;
+ format = (char *)nick;
if (!parsed) {
- parsed = silc_memdup(nickname, strlen(nickname));
+ parsed = silc_memdup(nick, strlen(nick));
if (!parsed)
return NULL;
}
/* Check multiple cache entries for exact match */
while ((id_cache = silc_list_get(list))) {
entry = id_cache->context;
+
+ /* If server was provided, find entries that either have no server
+ set or have the same server. Ignore those that have different
+ server. */
+ if (server[0] && entry->server &&
+ !silc_utf8_strcasecmp(entry->server, server))
+ continue;
+
if (silc_utf8_strcasecmp(entry->nickname,
format ? format : parsed) &&
(!get_valid || entry->internal.valid)) {
/* Parse server name from the nickname if set */
if (silc_parse_userfqdn(nickname, nick, sizeof(nick),
- serv, sizeof(serv) == 2))
+ serv, sizeof(serv)) == 2)
server = (const char *)serv;
nickname = (const char *)nick;
SilcUInt32 mode)
{
SilcClientEntry client_entry;
- char *nick = NULL;
+ char *nick = NULL, parsed[128 + 1];
SILC_LOG_DEBUG(("Adding new client entry"));
client_entry->id = *id;
client_entry->mode = mode;
client_entry->realname = userinfo ? strdup(userinfo) : NULL;
- silc_parse_userfqdn(nickname, client_entry->nickname,
- sizeof(client_entry->nickname),
- client_entry->server,
- sizeof(client_entry->server));
+
+ silc_parse_userfqdn(nickname, parsed, sizeof(parsed),
+ client_entry->server, sizeof(client_entry->server));
+ if (nickname && client->internal->params->full_nicknames)
+ silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+ nickname);
+ else if (nickname)
+ silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+ parsed);
+
silc_parse_userfqdn(username, client_entry->username,
sizeof(client_entry->username),
client_entry->hostname,
sizeof(client_entry->hostname));
+
client_entry->channels = silc_hash_table_alloc(1, silc_hash_ptr, NULL, NULL,
NULL, NULL, NULL, TRUE);
if (!client_entry->channels) {
/* Normalize nickname */
if (client_entry->nickname[0]) {
- nick = silc_identifier_check(client_entry->nickname,
- strlen(client_entry->nickname),
+ nick = silc_identifier_check(parsed, strlen(parsed),
SILC_STRING_UTF8, 128, NULL);
if (!nick) {
silc_free(client_entry->realname);
const char *userinfo,
SilcUInt32 mode)
{
- char *nick = NULL;
+ char *nick = NULL, parsed[128 + 1];
SILC_LOG_DEBUG(("Update client entry"));
if (!client_entry->realname && userinfo)
client_entry->realname = strdup(userinfo);
+
if ((!client_entry->username[0] || !client_entry->hostname[0]) && username)
silc_parse_userfqdn(username, client_entry->username,
sizeof(client_entry->username),
client_entry->hostname,
sizeof(client_entry->username));
+
if (!client_entry->nickname[0] && nickname) {
- silc_parse_userfqdn(nickname, client_entry->nickname,
- sizeof(client_entry->nickname),
- client_entry->server,
- sizeof(client_entry->server));
+ silc_parse_userfqdn(nickname, parsed, sizeof(parsed),
+ client_entry->server, sizeof(client_entry->server));
+ if (client->internal->params->full_nicknames)
+ silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+ nickname);
+ else
+ silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+ parsed);
/* Normalize nickname */
- nick = silc_identifier_check(client_entry->nickname,
- strlen(client_entry->nickname),
+ nick = silc_identifier_check(parsed, strlen(parsed),
SILC_STRING_UTF8, 128, NULL);
if (!nick) {
silc_rwlock_unlock(client_entry->internal.lock);
}
/* Is the requested client formatted already */
- if (!silc_utf8_strcasecmp(client_entry->nickname,
+ if (client_entry->nickname_normalized &&
+ !silc_utf8_strcasecmp(client_entry->nickname,
client_entry->nickname_normalized))
formatted = TRUE;
unformatted = entry;
break;
}
- }
+ }
/* If there are no other unformatted clients and the requested client is
unformatted, just return it. */
return client_entry;
}
- /* If priority formatting then the requested client will get the
+ /* If priority formatting then the requested client will get the
unformatted nickname, and the unformatted client will get a new
formatted nickname. */
if (priority) {
&cp))
return NULL;
- silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+ silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
cp);
silc_free(cp);
}
SilcClientConnection conn,
char *channel)
{
+ SilcList list;
SilcIDCacheEntry id_cache;
- SilcChannelEntry entry;
+ SilcChannelEntry entry = NULL;
+ char chname[256 + 1], server[256 + 1];
if (!client || !conn || !channel)
return NULL;
SILC_LOG_DEBUG(("Find channel %s", channel));
+ /* Parse server name from channel name */
+ silc_parse_userfqdn(channel, chname, sizeof(chname), server, sizeof(server));
+
/* Normalize name for search */
- channel = silc_channel_name_check(channel, strlen(channel), SILC_STRING_UTF8,
+ channel = silc_channel_name_check(chname, strlen(chname), SILC_STRING_UTF8,
256, NULL);
if (!channel)
return NULL;
silc_mutex_lock(conn->internal->lock);
- if (!silc_idcache_find_by_name_one(conn->internal->channel_cache, channel,
- &id_cache)) {
+ if (!silc_idcache_find_by_name(conn->internal->channel_cache, channel,
+ &list)) {
silc_mutex_unlock(conn->internal->lock);
silc_free(channel);
return NULL;
}
- SILC_LOG_DEBUG(("Found"));
+ /* If server name was specified with channel name, find the correct
+ channel entry with the server name. There can only be one channel
+ with same name on same server. */
+ silc_list_start(list);
+ if (server[0]) {
+ while ((id_cache = silc_list_get(list))) {
+ entry = id_cache->context;
+ if (!entry->server[0])
+ continue;
+ if (silc_utf8_strcasecmp(entry->server, server))
+ break;
+ }
+ } else {
+ /* Get first channel without server name specified or one with our
+ current server connection name */
+ while ((id_cache = silc_list_get(list))) {
+ entry = id_cache->context;
+ if (!entry->server[0])
+ break;
+ if (silc_utf8_strcasecmp(entry->server, conn->remote_host))
+ break;
+ }
+ }
- entry = id_cache->context;
+ if (!id_cache) {
+ silc_mutex_unlock(conn->internal->lock);
+ silc_free(channel);
+ return NULL;
+ }
+
+ SILC_LOG_DEBUG(("Found channel %s%s%s", entry->channel_name,
+ entry->server[0] ? "@" : "", entry->server));
/* Reference */
silc_client_ref_channel(client, conn, entry);
SilcChannelID *channel_id)
{
SilcChannelEntry channel;
- char *channel_namec;
+ char *channel_namec, name[256 + 1];
- SILC_LOG_DEBUG(("Start"));
+ SILC_LOG_DEBUG(("Adding channel %s", channel_name));
channel = silc_calloc(1, sizeof(*channel));
if (!channel)
channel->id = *channel_id;
channel->mode = mode;
- channel->channel_name = strdup(channel_name);
+ silc_parse_userfqdn(channel_name, name, sizeof(name),
+ channel->server, sizeof(channel->server));
+ if (client->internal->params->full_channel_names)
+ channel->channel_name = strdup(channel_name);
+ else
+ channel->channel_name = strdup(name);
+
if (!channel->channel_name) {
+ silc_rwlock_free(channel->internal.lock);
+ silc_atomic_uninit16(&channel->internal.refcnt);
silc_free(channel);
return NULL;
}
channel->user_list = silc_hash_table_alloc(1, silc_hash_ptr, NULL, NULL,
NULL, NULL, NULL, TRUE);
if (!channel->user_list) {
+ silc_rwlock_free(channel->internal.lock);
+ silc_atomic_uninit16(&channel->internal.refcnt);
silc_free(channel->channel_name);
silc_free(channel);
return NULL;
}
/* Normalize channel name */
- channel_namec = silc_channel_name_check(channel_name, strlen(channel_name),
+ channel_namec = silc_channel_name_check(name, strlen(name),
SILC_STRING_UTF8, 256, NULL);
if (!channel_namec) {
+ silc_rwlock_free(channel->internal.lock);
+ silc_atomic_uninit16(&channel->internal.refcnt);
silc_free(channel->channel_name);
silc_hash_table_free(channel->user_list);
silc_free(channel);
/* Add channel to cache, the normalized channel name is saved to cache */
if (!silc_idcache_add(conn->internal->channel_cache, channel_namec,
&channel->id, channel)) {
+ silc_rwlock_free(channel->internal.lock);
+ silc_atomic_uninit16(&channel->internal.refcnt);
silc_free(channel_namec);
silc_free(channel->channel_name);
silc_hash_table_free(channel->user_list);
SilcChannelEntry channel)
{
SilcIDCacheEntry id_cache;
- SilcBool ret;
+ SilcBool ret = TRUE;
SilcCipher key;
SilcHmac hmac;
+ char *namec;
if (!channel)
return FALSE;
silc_mutex_lock(conn->internal->lock);
if (silc_idcache_find_by_context(conn->internal->channel_cache, channel,
- &id_cache))
- silc_free(id_cache->name);
- ret = silc_idcache_del_by_context(conn->internal->channel_cache,
- channel, NULL);
+ &id_cache)) {
+ namec = id_cache->name;
+ ret = silc_idcache_del_by_context(conn->internal->channel_cache,
+ channel, NULL);
+ silc_free(namec);
+ }
silc_mutex_unlock(conn->internal->lock);
if (!ret)
SilcServerEntry server)
{
SilcIDCacheEntry id_cache;
- SilcBool ret;
+ SilcBool ret = TRUE;
+ char *namec;
if (!server)
return FALSE;
silc_mutex_lock(conn->internal->lock);
if (silc_idcache_find_by_context(conn->internal->server_cache, server,
- &id_cache))
- silc_free(id_cache->name);
- ret = silc_idcache_del_by_context(conn->internal->server_cache,
- server, NULL);
+ &id_cache)) {
+ namec = id_cache->name;
+ ret = silc_idcache_del_by_context(conn->internal->server_cache,
+ server, NULL);
+ silc_free(namec);
+ }
silc_mutex_unlock(conn->internal->lock);
silc_free(server->server_name);
SilcClient client = conn->client;
SilcChannelEntry channel;
SilcBuffer idp;
- char *name;
+ char *name, tmp[512];
if (cmd->argc < 2 || cmd->argc > 3) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
- name = conn->current_channel->channel_name;
+
+ if (client->internal->params->full_channel_names)
+ silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+ else
+ silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+ conn->current_channel->channel_name,
+ conn->current_channel->server[0] ? "@" : "",
+ conn->current_channel->server);
+ name = tmp;
} else {
name = cmd->argv[1];
}
SilcBuffer idp, idp2;
SilcClientEntry target;
SilcDList clients = NULL;
- char *name;
+ char *name, tmp[512];
if (cmd->argc < 3) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
- name = conn->current_channel->channel_name;
+
+ if (client->internal->params->full_channel_names)
+ silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+ else
+ silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+ conn->current_channel->channel_name,
+ conn->current_channel->server[0] ? "@" : "",
+ conn->current_channel->server);
+ name = tmp;
} else {
name = cmd->argv[1];
}
SilcClient client = conn->client;
SilcChannelEntry channel;
SilcBuffer idp;
- char *name;
+ char *name, tmp[512];
if (cmd->argc != 2) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
- name = conn->current_channel->channel_name;
+
+ if (client->internal->params->full_channel_names)
+ silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+ else
+ silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+ conn->current_channel->channel_name,
+ conn->current_channel->server[0] ? "@" : "",
+ conn->current_channel->server);
+ name = tmp;
} else {
name = cmd->argv[1];
}
{
SilcClientCommandContext cmd = fsm_context;
SilcClientConnection conn = cmd->conn;
- char *name;
+ char *name, tmp[512];
if (cmd->argc != 2) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
- name = conn->current_channel->channel_name;
+
+ if (conn->client->internal->params->full_channel_names)
+ silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+ else
+ silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+ conn->current_channel->channel_name,
+ conn->current_channel->server[0] ? "@" : "",
+ conn->current_channel->server);
+ name = tmp;
} else {
name = cmd->argv[1];
}
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID) {
SilcChannelEntry channel;
- /* Remove unknown client entry from cache */
+ /* Remove unknown channel entry from cache */
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_SERVER_ID) {
SilcServerEntry server_entry;
- /* Remove unknown client entry from cache */
+ /* Remove unknown server entry from cache */
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
/** Wait for command reply */
silc_fsm_set_state_context(fsm, NULL);
silc_fsm_next_later(fsm, silc_client_command_reply_timeout,
- cmd->cmd != SILC_COMMAND_PING ? 25 : 60, 0);
+ cmd->cmd != SILC_COMMAND_PING ? 40 : 60, 0);
return SILC_FSM_WAIT;
}
}
/* Notify application */
- silc_client_command_callback(cmd, channel_entry, name, info);
+ silc_client_command_callback(cmd, channel_entry,
+ channel_entry->channel_name, info);
silc_client_unref_channel(client, conn, channel_entry);
break;
}
if (!silc_client_change_nickname(client, conn, conn->local_entry,
nick, &id.u.client_id, idp, idp_len)) {
ERROR_CALLBACK(SILC_STATUS_ERR_BAD_NICKNAME);
+ silc_rwlock_unlock(conn->local_entry->internal.lock);
goto out;
}
}
/* Notify application */
- silc_client_command_callback(cmd, channel_entry, name, topic, usercount);
+ silc_client_command_callback(cmd, channel_entry, channel_entry->channel_name,
+ topic, usercount);
out:
silc_client_unref_channel(client, conn, channel_entry);
silc_hash_table_list(channel->user_list, &htl);
/* Notify application */
- silc_client_command_callback(cmd, channel_name, channel, mode, &htl,
+ silc_client_command_callback(cmd, channel->channel_name, channel, mode, &htl,
topic, cipher, hmac, channel->founder_key,
channel->channel_pubkeys, channel->user_limit);
}
}
+ silc_rwlock_unlock(channel->internal.lock);
+
/* Notify application */
silc_hash_table_list(channel->user_list, &htl);
silc_client_command_callback(cmd, channel, &htl);
*
* SYNOPSIS
*
- * typedef void (*SilcGetAuthMeth)(SilcBool success,
- * SilcAuthMethod auth_meth,
+ * typedef void (*SilcGetAuthMeth)(SilcAuthMethod auth_meth,
* const void *auth, SilcUInt32 auth_len,
* void *context);
*
%H full hostname - the full hostname of the client
Example format strings: "%n#%a" (fe. nick#2, nick#3)
- "%n@%h%a" (fe. nick@host, nick@host2)
- "%a!%n@%h" (fe. nick@host, 2!nick@host)
+ "%n#%h%a" (fe. nick#host, nick#host2)
+ "%a!%n#%h" (fe. nick#host, 2!nick#host)
Note that there must always be some separator characters around '%n'
format. It is not possible to put format characters before or after
'%n' without separators (such ash '#'). Also note that the separator
character should be a character that cannot be part of normal nickname.
+ Note that, using '@' as a separator is not recommended as the nickname
+ string may contain it to separate a server name from the nickname (eg.
+ nickname@silcnet.org).
*/
char nickname_format[32];
value. */
SilcBool nickname_force_format;
+ /* If this is set to TRUE then all nickname strings returned by the library
+ and stored by the library are in the format of 'nickname@server', eg.
+ nickname@silcnet.org. If this is FALSE then the server name of the
+ nickname is available only from the SilcClientEntry structure. When this
+ is TRUE the server name is still parsed to SilcClientEntry. */
+ SilcBool full_nicknames;
+
+ /* If this is set to TRUE then all channel name strings returned by the
+ library and stored by the library are in the format of 'channel@server',
+ eg. silc@silcnet.org. If this is FALSE then the server name of the
+ channel is available only from the SilcChannelEntry structure. When this
+ is TRUE the server name is still parsed to SilcChannelEntry. Note that,
+ not all SILC server versions return such channel name strings. */
+ SilcBool full_channel_names;
+
/* If this is set to TRUE, the silcclient library will not register and
deregister the cipher, pkcs, hash and hmac algorithms. The application
itself will need to handle that. */
* be the command name. The variable argument list must be terminated
* with NULL.
*
- * Returns FALSE if the command is not known and TRUE after command.
- * execution. The `command' client operation callback will be called when
- * the command is executed to indicate whether or not the command executed
+ * Returns command identifier for this sent command. It can be used
+ * to additionally attach to the command reply using the function
+ * silc_client_command_pending, if needed. Returns 0 on error.
+ *
+ * The `command' client operation callback will be called when the
+ * command is executed to indicate whether or not the command executed
* successfully.
*
* The `command_reply' client operation callbak will be called when reply
* SOURCE
*/
struct SilcClientEntryStruct {
- char nickname[128 + 1]; /* Nickname */
+ char nickname[256 + 1]; /* Nickname */
char username[128 + 1]; /* Username */
char hostname[256 + 1]; /* Hostname */
char server [256 + 1]; /* SILC server name */
*/
struct SilcChannelEntryStruct {
char *channel_name; /* Channel name */
+ char server[256 + 1]; /* SILC server name */
char *topic; /* Current topic, may be NULL */
SilcPublicKey founder_key; /* Founder key, may be NULL */
SilcDList channel_pubkeys; /* Channel public keys, may be NULL */
const char *nickname,
SilcBool return_all);
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_channel
- *
- * SYNOPSIS
- *
- * void silc_client_get_clients_by_channel(SilcClient client,
- * SilcClientConnection conn,
- * SilcChannelEntry channel,
- * SilcGetClientCallback completion,
- * void *context);
- *
- * DESCRIPTION
- *
- * Gets client entries by the channel indicated by `channel'. Thus,
- * it resovles the users currently on that channel. If all users are
- * already resolved this returns the users from the channel. If the
- * users are resolved only partially this resolves the complete user
- * information. If no users are resolved on this channel at all, this
- * calls USERS command to resolve all users on the channel. The `completion'
- * will be called after the entries are available. When server returns
- * the client information it will be cached and can be accessed locally
- * at a later time.
- *
- * This function can be used for example in SILC_COMMAND_JOIN command
- * reply handling in application to resolve users on that channel. It
- * also can be used after calling silc_client_get_channel_resolve to
- * resolve users on that channel.
- *
- * NOTES
- *
- * The resolving is done with WHOIS command. For this reason this
- * command may take a long time because it resolves detailed user
- * information.
- *
- ***/
-void silc_client_get_clients_by_channel(SilcClient client,
- SilcClientConnection conn,
- SilcChannelEntry channel,
- SilcGetClientCallback completion,
- void *context);
-
/****f* silcclient/SilcClientAPI/silc_client_get_client_by_id
*
* SYNOPSIS
* Resolves entry for channel by the channel name from the server.
* The resolving is done with IDENTIFY command. Note that users on
* the channel are not resolved at the same time. Use for example
- * silc_client_get_clients_by_channel to resolve all users on a channel.
+ * USERS command to resolve all users on a channel.
*
***/
void silc_client_get_channel_resolve(SilcClient client,
* a pending command to it, if needed. Returns 0 on error.
*
* Note that users on the channel are not resolved at the same time.
- * Use for example silc_client_get_clients_by_channel to resolve all
- * users on a channel.
+ * Use for example USERS command to resolve all users on a channel.
*
***/
SilcUInt16
@LINK=silcid.html:SILC ID Interface
@LINK=silcargument.html:SILC Argument Interface
@LINK=silcattrs.html:SILC Attributes Interface
-@LINK=silcpacket.html:Packet Protocol Interface
+@LINK=silcpacket.html:Packet Engine Interface
@LINK=silcpubkey.html:SILC Public Key Payload Interface
-->
Currently the engine lock is used only when the packet free list is accessed,
or new stream is added or removed. The packet free list, however, is
accessed for all incoming packets. Application free's the packet context so
-the lock must later be acquired be putting the unused packet context back
+the lock must later be acquired for putting the unused packet context back
to the free list. It might be possible to later put the packet free list to
per-thread context.
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 2006 Pekka Riikonen
+ Copyright (C) 2001 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
SILC_STR_UI_SHORT(&p_len),
SILC_STR_UI_CHAR(&arg_type),
SILC_STR_END);
- if (ret == -1 || p_len > silc_buffer_len(&buffer) - 3)
+ if (ret == -1 || p_len > silc_buffer_len(&buffer) - 3) {
+ SILC_LOG_DEBUG(("Malformed argument payload"));
goto err;
+ }
newp->argv_lens[i] = p_len;
newp->argv_types[i] = arg_type;
SILC_STR_UI_XNSTRING_ALLOC(&newp->argv[i],
p_len),
SILC_STR_END);
- if (ret == -1)
+ if (ret == -1) {
+ SILC_LOG_DEBUG(("Malformed argument payload"));
goto err;
+ }
silc_buffer_pull(&buffer, p_len);
pull_len += 3 + p_len;
str = silc_mime_encode(mime, &object_size);
if (!str)
return NULL;
+ object = str;
}
break;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2000 - 2005 Pekka Riikonen
+ Copyright (C) 2000 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
newp->args = silc_argument_payload_parse(buffer.data,
silc_buffer_len(&buffer),
newp->argc);
+ if (!newp->args)
+ goto err;
silc_buffer_push(&buffer, 5);
}
inbuf = silc_dlist_get(ps->sc->inbufs);
if (!inbuf) {
/* Allocate new data input buffer */
- inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 61);
+ inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 65);
if (!inbuf) {
silc_mutex_unlock(ps->lock);
return FALSE;
const char *silc_packet_error_string(SilcPacketError error)
{
if (error < SILC_PACKET_ERR_READ || error > SILC_PACKET_ERR_NO_MEMORY)
- return "";
+ return "<invalid error code>";
return packet_error[error];
}
silc_mutex_lock(engine->lock);
silc_list_start(engine->streams);
- while ((ps = silc_list_get(engine->streams)))
+ while ((ps = silc_list_get(engine->streams))) {
+ silc_packet_stream_ref(ps);
silc_dlist_add(list, ps);
+ }
silc_mutex_unlock(engine->lock);
return list;
}
+/* Free list returned by silc_packet_engine_get_streams */
+
+void silc_packet_engine_free_streams_list(SilcDList streams)
+{
+ SilcPacketStream ps;
+
+ silc_dlist_start(streams);
+ while ((ps = silc_dlist_get(streams)))
+ silc_packet_stream_unref(ps);
+
+ silc_dlist_uninit(streams);
+}
+
/* Create new packet stream */
SilcPacketStream silc_packet_stream_create(SilcPacketEngine engine,
ps->sc->schedule = schedule;
/* Allocate data input buffer */
- inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 61);
+ inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 65);
if (!inbuf) {
silc_free(ps->sc);
ps->sc = NULL;
if (!src_id && !dst_id)
return FALSE;
- SILC_LOG_DEBUG(("Setting new IDs to packet stream"));
-
silc_mutex_lock(stream->lock);
if (src_id) {
+ SILC_LOG_DEBUG(("Setting source ID to packet stream %p", stream));
+
silc_free(stream->src_id);
if (!silc_id_id2str(src_id, src_id_type, tmp, sizeof(tmp), &len)) {
silc_mutex_unlock(stream->lock);
}
if (dst_id) {
+ SILC_LOG_DEBUG(("Setting destination ID to packet stream %p", stream));
+
silc_free(stream->dst_id);
if (!silc_id_id2str(dst_id, dst_id_type, tmp, sizeof(tmp), &len)) {
silc_mutex_unlock(stream->lock);
SilcBool *src_id_set, SilcID *src_id,
SilcBool *dst_id_set, SilcID *dst_id)
{
- if (src_id && stream->src_id) {
- (*src_id).type = stream->src_id_type;
- switch (stream->src_id_type) {
- case SILC_ID_CLIENT:
- (*src_id).u.client_id = *(SilcClientID *)stream->src_id;
- break;
- case SILC_ID_SERVER:
- (*src_id).u.server_id = *(SilcServerID *)stream->src_id;
- break;
- case SILC_ID_CHANNEL:
- (*src_id).u.channel_id = *(SilcChannelID *)stream->src_id;
- break;
- }
- }
+ if (src_id && stream->src_id)
+ if (!silc_id_str2id2(stream->src_id, stream->src_id_len,
+ stream->src_id_type, src_id))
+ return FALSE;
+
if (stream->src_id && src_id_set)
*src_id_set = TRUE;
- if (dst_id && stream->dst_id) {
- (*dst_id).type = stream->dst_id_type;
- switch (stream->dst_id_type) {
- case SILC_ID_CLIENT:
- (*dst_id).u.client_id = *(SilcClientID *)stream->dst_id;
- break;
- case SILC_ID_SERVER:
- (*dst_id).u.server_id = *(SilcServerID *)stream->dst_id;
- break;
- case SILC_ID_CHANNEL:
- (*dst_id).u.channel_id = *(SilcChannelID *)stream->dst_id;
- break;
- }
- }
+ if (dst_id && stream->dst_id)
+ if (!silc_id_str2id2(stream->dst_id, stream->dst_id_len,
+ stream->dst_id_type, dst_id))
+ return FALSE;
+
if (stream->dst_id && dst_id_set)
*dst_id_set = TRUE;
silc_buffer_len(buffer)), buffer->head,
silc_buffer_headlen(buffer) + silc_buffer_len(buffer));
- SILC_LOG_DEBUG(("Incoming packet type: %d (%s)", packet->type,
- silc_get_packet_name(packet->type)));
+ SILC_LOG_DEBUG(("Incoming packet type: %d (%s), flags %d", packet->type,
+ silc_get_packet_name(packet->type), packet->flags));
return TRUE;
}
#define SILC_PACKET_FLAG_ACK 0x10 /* Acknowledge packet */
/* Impelemntation specific flags */
-#define SILC_PACKET_FLAG_LONG_PAD 0x12 /* Use maximum padding */
+#define SILC_PACKET_FLAG_LONG_PAD 0x20 /* Use maximum padding */
/***/
/****s* silccore/SilcPacketAPI/SilcPacketEngine
* DESCRIPTION
*
* Returns list of packet streams added to the packet engine. The caller
- * must free the list with silc_dlist_uninit.
+ * must free the list with silc_packet_engine_free_streams_list.
*
***/
SilcDList silc_packet_engine_get_streams(SilcPacketEngine engine);
+/****f* silccore/SilcPacketAPI/silc_packet_engine_free_streams_list
+ *
+ * SYNOPSIS
+ *
+ * void silc_packet_engine_free_streams_list(SilcDList streams);
+ *
+ * DESCRIPTION
+ *
+ * Free's the streams list returned by silc_packet_engine_get_streams.
+ *
+ ***/
+void silc_packet_engine_free_streams_list(SilcDList streams);
+
/****f* silccore/SilcPacketAPI/silc_packet_stream_create
*
* SYNOPSIS
SilcIdType src_id_type, const void *src_id,
SilcIdType dst_id_type, const void *dst_id);
-/****f* silccore/SilcPacketAPI/silc_packet_set_ids
+/****f* silccore/SilcPacketAPI/silc_packet_get_ids
*
* SYNOPSIS
*
SilcIdType dst_id_type, void *dst_id,
SilcCipher cipher, SilcHmac hmac, ...);
-/****f* silccore/SilcPacketAPI/silc_packet_wait
+/****f* silccore/SilcPacketAPI/silc_packet_wait_init
*
* SYNOPSIS
*
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2000 - 2006 Pekka Riikonen
+# Copyright (C) 2000 - 2007 Pekka Riikonen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
libsilccrypt_la_SOURCES = \
none.c \
- rc5.c \
md5.c \
$(SILC_AES_S) \
rsa.c \
sha256.c \
twofish.c \
blowfish.c \
- cast.c \
silccipher.c \
silchash.c \
silchmac.c \
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2000 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#define CIPHERS_H
#include "none.h"
-#include "rc5.h"
#include "twofish.h"
#include "aes.h"
#include "blowfish.h"
-#include "cast.h"
#endif
fi
SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove)
-if test x$summary_debug = xno; then
+if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then
SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3)
fi
SILC_CIPHER_MODE_CBC),
SILC_CIPHER_API_DEF("twofish-128-cbc", twofish_cbc, 128, 16, 16,
SILC_CIPHER_MODE_CBC),
- SILC_CIPHER_API_DEF("cast-256-cbc", cast_cbc, 256, 16, 16,
- SILC_CIPHER_MODE_CBC),
- SILC_CIPHER_API_DEF("cast-192-cbc", cast_cbc, 192, 16, 16,
- SILC_CIPHER_MODE_CBC),
- SILC_CIPHER_API_DEF("cast-128-cbc", cast_cbc, 128, 16, 16,
- SILC_CIPHER_MODE_CBC),
#ifdef SILC_DEBUG
SILC_CIPHER_API_DEF("none", none, 0, 0, 0, 0),
#endif /* SILC_DEBUG */
silc_free(data);
silc_free(public_key);
+ *ret_public_key = NULL;
return FALSE;
}
silc_free(data);
silc_free(private_key);
+ *ret_private_key = NULL;
return FALSE;
}
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2005 Pekka Riikonen
+# Copyright (C) 2005 - 2007 Pekka Riikonen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
AC_MSG_NOTICE([configuring math library])
#ifdef SILC_DIST_TMA
-SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
-SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops)
+if test x$want_cc_optimizations = xtrue; then
+ SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops)
+fi
if test x$enable_stack_trace != xyes; then
-SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
+ SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
fi
#endif SILC_DIST_TMA
alpha*-*-*)
if test ! "$GCC"; then
SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
- SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000)
+ if test x$want_cc_optimizations = xtrue; then
+ SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000)
+ fi
SILC_ADD_CC_FLAGS(MATH, -std1 -DOSF1)
fi
;;
sparcv9-*-* | sparc64-*-*)
- SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ if test x$want_cc_optimizations = xtrue; then
+ SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ fi
if test ! "$GCC"; then
SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
fi
;;
ultrasparc*-*-*)
- SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ if test x$want_cc_optimizations = xtrue; then
+ SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ fi
if test ! "$GCC"; then
SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
fi
;;
*)
- SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ if test x$want_cc_optimizations = xtrue; then
+ SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+ fi
if test x$enable_stack_trace != xyes; then
SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
fi
void *context)
{
SilcSFTPClient sftp = context;
- unsigned char inbuf[63488];
+ unsigned char inbuf[65536];
SilcBufferStruct packet;
int ret;
/* Generates absolute path from relative path that may include '.' and '..'
in the path. */
-static char *mem_expand_path(MemFSEntry root, const char *path)
+static char *memfs_expand_path(MemFSEntry root, const char *path)
{
if (!strstr(path, "./") && !strstr(path, "../") &&
!strstr(path, "/..") && !strstr(path, "/."))
/* Add `entry' to directory `dir'. */
-static SilcBool mem_add_entry(MemFSEntry dir, MemFSEntry entry,
- SilcBool check_perm)
+static SilcBool memfs_add_entry(MemFSEntry dir, MemFSEntry entry,
+ SilcBool check_perm)
{
int i;
/* Removes entry `entry' and all entries under it recursively. */
-static SilcBool mem_del_entry(MemFSEntry entry, SilcBool check_perm)
+static SilcBool memfs_del_entry(MemFSEntry entry, SilcBool check_perm)
{
int i;
/* Delete all entries recursively under this entry */
for (i = 0; i < entry->entry_count; i++) {
if (entry->entry[i]) {
- if (!mem_del_entry(entry->entry[i], FALSE))
+ if (!memfs_del_entry(entry->entry[i], FALSE))
return FALSE;
}
}
/* Finds first occurence of entry named `name' under the directory `dir'.
This does not check subdirectories recursively. */
-static MemFSEntry mem_find_entry(MemFSEntry dir, const char *name,
- SilcUInt32 name_len)
+static MemFSEntry memfs_find_entry(MemFSEntry dir, const char *name,
+ SilcUInt32 name_len)
{
int i;
/* Finds the entry by the `path' which may include full path or
relative path. */
-static MemFSEntry mem_find_entry_path(MemFSEntry dir, const char *p)
+static MemFSEntry memfs_find_entry_path(MemFSEntry dir, const char *p)
{
MemFSEntry entry = NULL;
int len;
char *path, *cp;
- cp = path = mem_expand_path(dir, p);
+ cp = path = memfs_expand_path(dir, p);
if (strlen(cp) == 1 && cp[0] == '/')
return dir;
cp++;
len = strcspn(cp, DIR_SEPARATOR);
while (cp && len) {
- entry = mem_find_entry(dir, cp, len);
+ entry = memfs_find_entry(dir, cp, len);
if (!entry) {
silc_free(cp);
return NULL;
/* Deletes entry by the name `name' from the directory `dir'. This does
not check subdirectories recursively. */
-static SilcBool mem_del_entry_name(MemFSEntry dir, const char *name,
- SilcUInt32 name_len, SilcBool check_perm)
+static SilcBool memfs_del_entry_name(MemFSEntry dir, const char *name,
+ SilcUInt32 name_len, SilcBool check_perm)
{
MemFSEntry entry;
if (check_perm)
return FALSE;
- entry = mem_find_entry(dir, name, name_len);
+ entry = memfs_find_entry(dir, name, name_len);
if (entry)
- return mem_del_entry(entry, check_perm);
+ return memfs_del_entry(entry, check_perm);
return FALSE;
}
/* Create new handle and add it to the list of open handles. */
-static MemFSFileHandle mem_create_handle(MemFS fs, int fd, MemFSEntry entry)
+static MemFSFileHandle memfs_create_handle(MemFS fs, int fd, MemFSEntry entry)
{
MemFSFileHandle handle;
int i;
/* Deletes the handle and remove it from the open handle list. */
-static SilcBool mem_del_handle(MemFS fs, MemFSFileHandle handle)
+static SilcBool memfs_del_handle(MemFS fs, MemFSFileHandle handle)
{
if (handle->handle > fs->handles_count)
return FALSE;
/* Find handle by handle index. */
-static MemFSFileHandle mem_find_handle(MemFS fs, SilcUInt32 handle)
+static MemFSFileHandle memfs_find_handle(MemFS fs, SilcUInt32 handle)
{
if (handle > fs->handles_count)
return NULL;
return NULL;
}
- if (!mem_add_entry(dir ? dir : memfs->root, entry, FALSE)) {
+ if (!memfs_add_entry(dir ? dir : memfs->root, entry, FALSE)) {
silc_free(entry->name);
silc_free(entry);
return NULL;
SilcBool ret;
if (dir)
- return mem_del_entry(dir, FALSE);
+ return memfs_del_entry(dir, FALSE);
/* Remove from root */
- ret = mem_del_entry(memfs->root, FALSE);
+ ret = memfs_del_entry(memfs->root, FALSE);
memfs->root = silc_calloc(1, sizeof(*memfs->root));
if (!memfs->root)
return FALSE;
}
- return mem_add_entry(dir ? dir : memfs->root, entry, FALSE);
+ return memfs_add_entry(dir ? dir : memfs->root, entry, FALSE);
}
/* Removes a file indicated by the `filename' from the directory
if (!filename)
return FALSE;
- return mem_del_entry_name(dir ? dir : memfs->root, filename,
+ return memfs_del_entry_name(dir ? dir : memfs->root, filename,
strlen(filename), FALSE);
}
-SilcSFTPHandle mem_get_handle(void *context, SilcSFTP sftp,
- const unsigned char *data,
- SilcUInt32 data_len)
+SilcSFTPHandle memfs_get_handle(void *context, SilcSFTP sftp,
+ const unsigned char *data,
+ SilcUInt32 data_len)
{
MemFS fs = (MemFS)context;
SilcUInt32 handle;
return NULL;
SILC_GET32_MSB(handle, data);
- return (SilcSFTPHandle)mem_find_handle(fs, handle);
+ return (SilcSFTPHandle)memfs_find_handle(fs, handle);
}
-unsigned char *mem_encode_handle(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcUInt32 *handle_len)
+unsigned char *memfs_encode_handle(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcUInt32 *handle_len)
{
unsigned char *data;
MemFSFileHandle h = (MemFSFileHandle)handle;
return data;
}
-void mem_open(void *context, SilcSFTP sftp,
- const char *filename,
- SilcSFTPFileOperation pflags,
- SilcSFTPAttributes attrs,
- SilcSFTPHandleCallback callback,
- void *callback_context)
+void memfs_open(void *context, SilcSFTP sftp,
+ const char *filename,
+ SilcSFTPFileOperation pflags,
+ SilcSFTPAttributes attrs,
+ SilcSFTPHandleCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
MemFSEntry entry;
}
/* Find such file */
- entry = mem_find_entry_path(fs->root, filename);
+ entry = memfs_find_entry_path(fs->root, filename);
if (!entry) {
(*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
return;
}
/* File opened, return handle */
- handle = mem_create_handle(fs, fd, entry);
+ handle = memfs_create_handle(fs, fd, entry);
if (handle)
(*callback)(sftp, SILC_SFTP_STATUS_OK, (SilcSFTPHandle)handle,
callback_context);
callback_context);
}
-void mem_close(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_close(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
MemFSFileHandle h = (MemFSFileHandle)handle;
}
}
- mem_del_handle(fs, h);
+ memfs_del_handle(fs, h);
(*callback)(sftp, SILC_SFTP_STATUS_OK, NULL, NULL, callback_context);
}
-void mem_read(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcUInt64 offset,
- SilcUInt32 len,
- SilcSFTPDataCallback callback,
- void *callback_context)
+void memfs_read(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcUInt64 offset,
+ SilcUInt32 len,
+ SilcSFTPDataCallback callback,
+ void *callback_context)
{
MemFSFileHandle h = (MemFSFileHandle)handle;
unsigned char data[63488];
ret, callback_context);
}
-void mem_write(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcUInt64 offset,
- const unsigned char *data,
- SilcUInt32 data_len,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_write(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcUInt64 offset,
+ const unsigned char *data,
+ SilcUInt32 data_len,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
MemFSFileHandle h = (MemFSFileHandle)handle;
int ret;
(*callback)(sftp, SILC_SFTP_STATUS_OK, NULL, NULL, callback_context);
}
-void mem_remove(void *context, SilcSFTP sftp,
- const char *filename,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_remove(void *context, SilcSFTP sftp,
+ const char *filename,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Remove is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_rename(void *context, SilcSFTP sftp,
- const char *oldname,
- const char *newname,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_rename(void *context, SilcSFTP sftp,
+ const char *oldname,
+ const char *newname,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Rename is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_mkdir(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPAttributes attrs,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_mkdir(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPAttributes attrs,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Mkdir is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_rmdir(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_rmdir(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Rmdir is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_opendir(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPHandleCallback callback,
- void *callback_context)
+void memfs_opendir(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPHandleCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
MemFSEntry entry;
path = (const char *)DIR_SEPARATOR;
/* Find such directory */
- entry = mem_find_entry_path(fs->root, path);
+ entry = memfs_find_entry_path(fs->root, path);
if (!entry) {
(*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
return;
}
/* Directory opened, return handle */
- handle = mem_create_handle(fs, 0, entry);
+ handle = memfs_create_handle(fs, 0, entry);
if (handle)
(*callback)(sftp, SILC_SFTP_STATUS_OK, (SilcSFTPHandle)handle,
callback_context);
callback_context);
}
-void mem_readdir(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcSFTPNameCallback callback,
- void *callback_context)
+void memfs_readdir(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcSFTPNameCallback callback,
+ void *callback_context)
{
MemFSFileHandle h = (MemFSFileHandle)handle;
MemFSEntry entry;
silc_sftp_name_free(name);
}
-void mem_stat(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPAttrCallback callback,
- void *callback_context)
+void memfs_stat(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPAttrCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
MemFSEntry entry;
path = (const char *)DIR_SEPARATOR;
/* Find such directory */
- entry = mem_find_entry_path(fs->root, path);
+ entry = memfs_find_entry_path(fs->root, path);
if (!entry) {
(*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
return;
silc_sftp_attr_free(attrs);
}
-void mem_lstat(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPAttrCallback callback,
- void *callback_context)
+void memfs_lstat(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPAttrCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
MemFSEntry entry;
path = (const char *)DIR_SEPARATOR;
/* Find such directory */
- entry = mem_find_entry_path(fs->root, path);
+ entry = memfs_find_entry_path(fs->root, path);
if (!entry) {
(*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
return;
silc_sftp_attr_free(attrs);
}
-void mem_fstat(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcSFTPAttrCallback callback,
- void *callback_context)
+void memfs_fstat(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcSFTPAttrCallback callback,
+ void *callback_context)
{
MemFSFileHandle h = (MemFSFileHandle)handle;
SilcSFTPAttributes attrs;
silc_sftp_attr_free(attrs);
}
-void mem_setstat(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPAttributes attrs,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_setstat(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPAttributes attrs,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Setstat is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_fsetstat(void *context, SilcSFTP sftp,
- SilcSFTPHandle handle,
- SilcSFTPAttributes attrs,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_fsetstat(void *context, SilcSFTP sftp,
+ SilcSFTPHandle handle,
+ SilcSFTPAttributes attrs,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Fsetstat is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_readlink(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPNameCallback callback,
- void *callback_context)
+void memfs_readlink(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPNameCallback callback,
+ void *callback_context)
{
/* Readlink is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL,
callback_context);
}
-void mem_symlink(void *context, SilcSFTP sftp,
- const char *linkpath,
- const char *targetpath,
- SilcSFTPStatusCallback callback,
- void *callback_context)
+void memfs_symlink(void *context, SilcSFTP sftp,
+ const char *linkpath,
+ const char *targetpath,
+ SilcSFTPStatusCallback callback,
+ void *callback_context)
{
/* Symlink is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
callback_context);
}
-void mem_realpath(void *context, SilcSFTP sftp,
- const char *path,
- SilcSFTPNameCallback callback,
- void *callback_context)
+void memfs_realpath(void *context, SilcSFTP sftp,
+ const char *path,
+ SilcSFTPNameCallback callback,
+ void *callback_context)
{
MemFS fs = (MemFS)context;
char *realpath;
if (!path || !strlen(path))
path = (const char *)DIR_SEPARATOR;
- realpath = mem_expand_path(fs->root, path);
+ realpath = memfs_expand_path(fs->root, path);
if (!realpath)
goto fail;
(*callback)(sftp, SILC_SFTP_STATUS_FAILURE, NULL, callback_context);
}
-void mem_extended(void *context, SilcSFTP sftp,
- const char *request,
- const unsigned char *data,
- SilcUInt32 data_len,
- SilcSFTPExtendedCallback callback,
- void *callback_context)
+void memfs_extended(void *context, SilcSFTP sftp,
+ const char *request,
+ const unsigned char *data,
+ SilcUInt32 data_len,
+ SilcSFTPExtendedCallback callback,
+ void *callback_context)
{
/* Extended is not supported */
(*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, 0,
}
const struct SilcSFTPFilesystemOpsStruct silc_sftp_fs_memory = {
- mem_get_handle,
- mem_encode_handle,
- mem_open,
- mem_close,
- mem_read,
- mem_write,
- mem_remove,
- mem_rename,
- mem_mkdir,
- mem_rmdir,
- mem_opendir,
- mem_readdir,
- mem_stat,
- mem_lstat,
- mem_fstat,
- mem_setstat,
- mem_fsetstat,
- mem_readlink,
- mem_symlink,
- mem_realpath,
- mem_extended
+ memfs_get_handle,
+ memfs_encode_handle,
+ memfs_open,
+ memfs_close,
+ memfs_read,
+ memfs_write,
+ memfs_remove,
+ memfs_rename,
+ memfs_mkdir,
+ memfs_rmdir,
+ memfs_opendir,
+ memfs_readdir,
+ memfs_stat,
+ memfs_lstat,
+ memfs_fstat,
+ memfs_setstat,
+ memfs_fsetstat,
+ memfs_readlink,
+ memfs_symlink,
+ memfs_realpath,
+ memfs_extended
};
#
# Author: Pekka Riikonen <priikone@silcnet.org>
#
-# Copyright (C) 2000 - 2005 Pekka Riikonen
+# Copyright (C) 2000 - 2007 Pekka Riikonen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
if SILC_SIM
noinst_LTLIBRARIES = libsilcsim.la
else
-noinst_LTLIBRARIES =
+noinst_LTLIBRARIES =
endif
libsilcsim_la_SOURCES = \
SIM_CIPHER_OBJS = \
none.o \
blowfish.o \
- rc5.o \
aes.o \
rsa.o \
- twofish.o \
- cast.o
+ twofish.o
#
# SILC Hash Functions to be compiled as modules
#
SIM_HASH_OBJS = \
md5.o \
- sha1.o
+ sha1.o \
+ sha256.o
if SILC_SIM
all: $(SIM_CIPHER_OBJS) $(SIM_HASH_OBJS)
SILC_LOG_DEBUG(("Authentication successful"));
connauth->success = TRUE;
} else {
- SILC_LOG_DEBUG(("Authentication failed"));
+ SILC_LOG_DEBUG(("Authentication failed, packet %s received",
+ silc_get_packet_name(connauth->packet->type)));
connauth->success = FALSE;
}
silc_packet_free(connauth->packet);
if (connauth->aborted) {
/** Aborted */
- silc_packet_free(connauth->packet);
+ if (connauth->packet)
+ silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
return SILC_FSM_CONTINUE;
}
{
SilcSKEStatus status = SILC_SKE_STATUS_OK;
SilcBuffer buf;
- unsigned char *e, *f, *KEY;
- SilcUInt32 e_len, f_len, KEY_len;
+ unsigned char *e, *f, *KEY, *s_data;
+ SilcUInt32 e_len, f_len, KEY_len, s_len;
int ret;
SILC_LOG_DEBUG(("Start"));
if (initiator == FALSE) {
+ s_data = (ske->start_payload_copy ?
+ silc_buffer_data(ske->start_payload_copy) : NULL);
+ s_len = (ske->start_payload_copy ?
+ silc_buffer_len(ske->start_payload_copy) : 0);
e = silc_mp_mp2bin(&ske->ke1_payload->x, 0, &e_len);
f = silc_mp_mp2bin(&ske->ke2_payload->x, 0, &f_len);
KEY = silc_mp_mp2bin(ske->KEY, 0, &KEY_len);
/* Format the buffer used to compute the hash value */
- buf = silc_buffer_alloc_size(silc_buffer_len(ske->start_payload_copy) +
+ buf = silc_buffer_alloc_size(s_len +
ske->ke2_payload->pk_len +
ske->ke1_payload->pk_len +
e_len + f_len + KEY_len);
if (!ske->ke1_payload->pk_data) {
ret =
silc_buffer_format(buf,
- SILC_STR_UI_XNSTRING(
- ske->start_payload_copy->data,
- silc_buffer_len(ske->start_payload_copy)),
- SILC_STR_UI_XNSTRING(ske->ke2_payload->pk_data,
- ske->ke2_payload->pk_len),
- SILC_STR_UI_XNSTRING(e, e_len),
- SILC_STR_UI_XNSTRING(f, f_len),
- SILC_STR_UI_XNSTRING(KEY, KEY_len),
+ SILC_STR_DATA(s_data, s_len),
+ SILC_STR_DATA(ske->ke2_payload->pk_data,
+ ske->ke2_payload->pk_len),
+ SILC_STR_DATA(e, e_len),
+ SILC_STR_DATA(f, f_len),
+ SILC_STR_DATA(KEY, KEY_len),
SILC_STR_END);
} else {
ret =
silc_buffer_format(buf,
- SILC_STR_UI_XNSTRING(
- ske->start_payload_copy->data,
- silc_buffer_len(ske->start_payload_copy)),
- SILC_STR_UI_XNSTRING(ske->ke2_payload->pk_data,
- ske->ke2_payload->pk_len),
- SILC_STR_UI_XNSTRING(ske->ke1_payload->pk_data,
- ske->ke1_payload->pk_len),
- SILC_STR_UI_XNSTRING(e, e_len),
- SILC_STR_UI_XNSTRING(f, f_len),
- SILC_STR_UI_XNSTRING(KEY, KEY_len),
+ SILC_STR_DATA(s_data, s_len),
+ SILC_STR_DATA(ske->ke2_payload->pk_data,
+ ske->ke2_payload->pk_len),
+ SILC_STR_DATA(ske->ke1_payload->pk_data,
+ ske->ke1_payload->pk_len),
+ SILC_STR_DATA(e, e_len),
+ SILC_STR_DATA(f, f_len),
+ SILC_STR_DATA(KEY, KEY_len),
SILC_STR_END);
}
if (ret == -1) {
silc_free(f);
silc_free(KEY);
} else {
+ s_data = (ske->start_payload_copy ?
+ silc_buffer_data(ske->start_payload_copy) : NULL);
+ s_len = (ske->start_payload_copy ?
+ silc_buffer_len(ske->start_payload_copy) : 0);
e = silc_mp_mp2bin(&ske->ke1_payload->x, 0, &e_len);
- buf = silc_buffer_alloc_size(silc_buffer_len(ske->start_payload_copy) +
- ske->ke1_payload->pk_len + e_len);
+ buf = silc_buffer_alloc_size(s_len + ske->ke1_payload->pk_len + e_len);
if (!buf)
return SILC_SKE_STATUS_OUT_OF_MEMORY;
/* Format the buffer used to compute the hash value */
ret =
silc_buffer_format(buf,
- SILC_STR_UI_XNSTRING(ske->start_payload_copy->data,
- silc_buffer_len(ske->start_payload_copy)),
- SILC_STR_UI_XNSTRING(ske->ke1_payload->pk_data,
- ske->ke1_payload->pk_len),
- SILC_STR_UI_XNSTRING(e, e_len),
+ SILC_STR_DATA(s_data, s_len),
+ SILC_STR_DATA(ske->ke1_payload->pk_data,
+ ske->ke1_payload->pk_len),
+ SILC_STR_DATA(e, e_len),
SILC_STR_END);
if (ret == -1) {
silc_buffer_free(buf);
payload = ske->ke2_payload;
+ /* Compute the HASH value */
+ SILC_LOG_DEBUG(("Computing HASH value"));
+ status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
+ if (status != SILC_SKE_STATUS_OK)
+ goto err;
+ ske->hash = silc_memdup(hash, hash_len);
+ ske->hash_len = hash_len;
+
if (ske->prop->public_key) {
SILC_LOG_DEBUG(("Public key is authentic"));
-
- /* Compute the hash value */
- status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
- if (status != SILC_SKE_STATUS_OK)
- goto err;
-
SILC_LOG_DEBUG(("Verifying signature (HASH)"));
/* Verify signature */
}
SILC_LOG_DEBUG(("Signature is Ok"));
-
- ske->hash = silc_memdup(hash, hash_len);
- ske->hash_len = hash_len;
memset(hash, 'F', hash_len);
}
SilcSKEStatus status;
SilcSKEStartPayload remote_payload = NULL;
SilcBuffer packet_buf = &ske->packet->buffer;
+ SilcID id;
SILC_LOG_DEBUG(("Start"));
return SILC_FSM_CONTINUE;
}
+ /* Get remote ID and set it to stream */
+ if (ske->packet->src_id_len) {
+ silc_id_str2id(ske->packet->src_id, ske->packet->src_id_len,
+ ske->packet->src_id_type,
+ (ske->packet->src_id_type == SILC_ID_SERVER ?
+ (void *)&id.u.server_id : (void *)&id.u.client_id),
+ (ske->packet->src_id_type == SILC_ID_SERVER ?
+ sizeof(id.u.server_id) : sizeof(id.u.client_id)));
+ silc_packet_set_ids(ske->stream, 0, NULL, ske->packet->src_id_type,
+ (ske->packet->src_id_type == SILC_ID_SERVER ?
+ (void *)&id.u.server_id : (void *)&id.u.client_id));
+ }
+
/* Take a copy of the payload buffer for future use. It is used to
compute the HASH value. */
ske->start_payload_copy = silc_buffer_copy(packet_buf);
}
ske->ke2_payload->pk_data = pk;
ske->ke2_payload->pk_len = pk_len;
+ }
- SILC_LOG_DEBUG(("Computing HASH value"));
-
- /* Compute the hash value */
- memset(hash, 0, sizeof(hash));
- status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
- if (status != SILC_SKE_STATUS_OK) {
- /** Error computing hash */
- ske->status = status;
- silc_fsm_next(fsm, silc_ske_st_responder_error);
- return SILC_FSM_CONTINUE;
- }
+ SILC_LOG_DEBUG(("Computing HASH value"));
- ske->hash = silc_memdup(hash, hash_len);
- ske->hash_len = hash_len;
+ /* Compute the hash value */
+ memset(hash, 0, sizeof(hash));
+ status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
+ if (status != SILC_SKE_STATUS_OK) {
+ /** Error computing hash */
+ ske->status = status;
+ silc_fsm_next(fsm, silc_ske_st_responder_error);
+ return SILC_FSM_CONTINUE;
+ }
+ ske->hash = silc_memdup(hash, hash_len);
+ ske->hash_len = hash_len;
+ if (ske->public_key && ske->private_key) {
SILC_LOG_DEBUG(("Signing HASH value"));
/* Sign the hash value */
silc_buffer_free(payload_buf);
- /* In case we are doing rekey move to finish it. */
+ /* In case we are doing rekey move to finish it. */
if (ske->rekey) {
/** Finish rekey */
silc_fsm_next(fsm, silc_ske_st_rekey_responder_done);
return SILC_FSM_CONTINUE;
}
+ if (!silc_hash_alloc(ske->rekey->hash, &ske->prop->hash)) {
+ /** Cannot allocate hash */
+ ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+ silc_fsm_next(fsm, silc_ske_st_initiator_error);
+ return SILC_FSM_CONTINUE;
+ }
+
/* Send REKEY packet to start rekey protocol */
if (!silc_ske_packet_send(ske, SILC_PACKET_REKEY, 0, NULL, 0)) {
/** Error sending packet */
silc_packet_get_keys(ske->stream, &send_key, NULL, &hmac_send, NULL);
key_len = silc_cipher_get_key_len(send_key);
block_len = silc_cipher_get_block_len(send_key);
-
- if (!silc_hash_alloc(ske->rekey->hash, &hash)) {
- /** Cannot allocate hash */
- ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
- silc_fsm_next(fsm, silc_ske_st_initiator_error);
- return SILC_FSM_CONTINUE;
- }
+ hash = ske->prop->hash;
hash_len = silc_hash_len(hash);
/* Process key material */
ske->prop->cipher = send_key;
ske->prop->hmac = hmac_send;
- ske->prop->hash = hash;
/* Get sending keys */
if (!silc_ske_set_keys(ske, ske->keymat, ske->prop, &send_key, NULL,
&hmac_send, NULL, NULL)) {
/** Cannot get keys */
ske->status = SILC_SKE_STATUS_ERROR;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_initiator_error);
return SILC_FSM_CONTINUE;
}
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
+
/* Set the new keys into use. This will also send REKEY_DONE packet. Any
packet sent after this call will be protected with the new keys. */
if (!silc_packet_set_keys(ske->stream, send_key, NULL, hmac_send, NULL,
/** Cannot set keys */
SILC_LOG_DEBUG(("Cannot set new keys, error sending REKEY_DONE"));
ske->status = SILC_SKE_STATUS_ERROR;
+ silc_cipher_free(send_key);
+ silc_hmac_free(hmac_send);
silc_fsm_next(fsm, silc_ske_st_initiator_error);
return SILC_FSM_CONTINUE;
}
NULL, &hmac_receive, NULL)) {
/** Cannot get keys */
ske->status = SILC_SKE_STATUS_ERROR;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_initiator_error);
return SILC_FSM_CONTINUE;
}
/** Cannot set keys */
SILC_LOG_DEBUG(("Cannot set new keys"));
ske->status = SILC_SKE_STATUS_ERROR;
+ silc_cipher_free(receive_key);
+ silc_hmac_free(hmac_receive);
silc_fsm_next(fsm, silc_ske_st_initiator_error);
return SILC_FSM_CONTINUE;
}
if (!rekey) {
/** No memory */
ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_initiator_error);
return SILC_FSM_CONTINUE;
}
{
SILC_LOG_DEBUG(("Start SKE rekey as initator"));
- if (!ske || !stream || !rekey)
+ if (!ske || !stream || !rekey) {
+ SILC_LOG_ERROR(("Missing arguments to silc_ske_rekey_initiator"));
+ SILC_ASSERT(rekey);
return NULL;
+ }
if (!silc_async_init(&ske->op, silc_ske_abort, NULL, ske))
return NULL;
silc_schedule_task_add_timeout(ske->schedule, silc_ske_timeout,
ske, 30, 0);
-
silc_fsm_next(fsm, silc_ske_st_rekey_responder_start);
/* If REKEY packet already received process it directly */
return SILC_FSM_CONTINUE;
}
+ if (!silc_hash_alloc(ske->rekey->hash, &ske->prop->hash)) {
+ /** Cannot allocate hash */
+ ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+ silc_fsm_next(fsm, silc_ske_st_responder_error);
+ return SILC_FSM_CONTINUE;
+ }
+
/* If doing rekey without PFS, move directly to the end of the protocol. */
if (!ske->rekey->pfs) {
/** Rekey without PFS */
silc_packet_get_keys(ske->stream, &send_key, NULL, &hmac_send, NULL);
key_len = silc_cipher_get_key_len(send_key);
block_len = silc_cipher_get_block_len(send_key);
-
- if (!silc_hash_alloc(ske->rekey->hash, &hash)) {
- /** Cannot allocate hash */
- ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
- silc_fsm_next(fsm, silc_ske_st_responder_error);
- return SILC_FSM_CONTINUE;
- }
+ hash = ske->prop->hash;
hash_len = silc_hash_len(hash);
/* Process key material */
ske->prop->cipher = send_key;
ske->prop->hmac = hmac_send;
- ske->prop->hash = hash;
/* Get sending keys */
if (!silc_ske_set_keys(ske, ske->keymat, ske->prop, &send_key, NULL,
&hmac_send, NULL, NULL)) {
/** Cannot get keys */
ske->status = SILC_SKE_STATUS_ERROR;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_responder_error);
return SILC_FSM_CONTINUE;
}
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
+
/* Set the new keys into use. This will also send REKEY_DONE packet. Any
packet sent after this call will be protected with the new keys. */
if (!silc_packet_set_keys(ske->stream, send_key, NULL, hmac_send, NULL,
/** Cannot set keys */
SILC_LOG_DEBUG(("Cannot set new keys, error sending REKEY_DONE"));
ske->status = SILC_SKE_STATUS_ERROR;
+ silc_cipher_free(send_key);
+ silc_hmac_free(hmac_send);
silc_fsm_next(fsm, silc_ske_st_responder_error);
return SILC_FSM_CONTINUE;
}
NULL, &hmac_receive, NULL)) {
/** Cannot get keys */
ske->status = SILC_SKE_STATUS_ERROR;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_responder_error);
return SILC_FSM_CONTINUE;
}
/** Cannot set keys */
SILC_LOG_DEBUG(("Cannot set new keys"));
ske->status = SILC_SKE_STATUS_ERROR;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
+ silc_cipher_free(receive_key);
+ silc_hmac_free(hmac_receive);
silc_fsm_next(fsm, silc_ske_st_responder_error);
return SILC_FSM_CONTINUE;
}
if (!rekey) {
/** No memory */
ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+ ske->prop->cipher = NULL;
+ ske->prop->hmac = NULL;
silc_fsm_next(fsm, silc_ske_st_responder_error);
return SILC_FSM_CONTINUE;
}
return NULL;
silc_buffer_format(buf,
SILC_STR_UI_CHAR(0),
- SILC_STR_UI_XNSTRING(data, data_len),
+ SILC_STR_DATA(data, data_len),
SILC_STR_END);
/* Take IVs */
if (!dist)
return NULL;
silc_buffer_format(dist,
- SILC_STR_UI_XNSTRING(data, data_len),
- SILC_STR_UI_XNSTRING(k1, hash_len),
+ SILC_STR_DATA(data, data_len),
+ SILC_STR_DATA(k1, hash_len),
SILC_STR_END);
memset(k2, 0, sizeof(k2));
silc_hash_make(hash, dist->data, silc_buffer_len(dist), k2);
silc_buffer_pull_tail(dist, hash_len);
silc_buffer_pull(dist, data_len + hash_len);
silc_buffer_format(dist,
- SILC_STR_UI_XNSTRING(k2, hash_len),
+ SILC_STR_DATA(k2, hash_len),
SILC_STR_END);
silc_buffer_push(dist, data_len + hash_len);
memset(k3, 0, sizeof(k3));
if (!dist)
return NULL;
silc_buffer_format(dist,
- SILC_STR_UI_XNSTRING(data, data_len),
- SILC_STR_UI_XNSTRING(k1, hash_len),
+ SILC_STR_DATA(data, data_len),
+ SILC_STR_DATA(k1, hash_len),
SILC_STR_END);
memset(k2, 0, sizeof(k2));
silc_hash_make(hash, dist->data, silc_buffer_len(dist), k2);
silc_buffer_pull_tail(dist, hash_len);
silc_buffer_pull(dist, data_len + hash_len);
silc_buffer_format(dist,
- SILC_STR_UI_XNSTRING(k2, hash_len),
+ SILC_STR_DATA(k2, hash_len),
SILC_STR_END);
silc_buffer_push(dist, data_len + hash_len);
memset(k3, 0, sizeof(k3));
if (!buf)
return NULL;
silc_buffer_format(buf,
- SILC_STR_UI_XNSTRING(tmpbuf, klen),
- SILC_STR_UI_XNSTRING(ske->hash, ske->hash_len),
+ SILC_STR_DATA(tmpbuf, klen),
+ SILC_STR_DATA(ske->hash, ske->hash_len),
SILC_STR_END);
/* Process the key material */
* SILC_SKE_SP_FLAG_MUTUAL is not set and you are initiator. For
* responder both `public_key' and `private_key' must be set.
*
+ * When allocating SKE session for rekey, the `repository' and `private_key'
+ * pointers must be NULL and the SilcSKEVerifyCb callback must not be
+ * set with silc_ske_set_callbacks.
+ *
* EXMPALE
*
* // Initiator example
* the protocol has completed. The `stream' is the network connection
* to the remote host. The SKE library will handle all key exchange
* packets sent and received in the `stream' connection. The library will
- * also set the remote host's ID automatically to the `stream'. The
- * `params' include SKE parameters, and it must be provided.
+ * also set the remote host's ID automatically to the `stream' if it is
+ * present in the exchanged packets. The `params' include SKE parameters,
+ * and it must be provided.
*
* If the `start_payload' is NULL the library will generate it
* automatically. Caller may provide it if it wants to send its own
* callback that was set in silc_ske_set_callbacks will be called once
* the protocol has completed. The `stream' is the network connection
* to the remote host. The SKE library will handle all key exchange
- * packets sent and received in the `stream' connection. The `params'
- * include SKE parameters, and must be provided.
+ * packets sent and received in the `stream' connection. The library will
+ * also set the remote hosts's ID automatically to the `stream' if it is
+ * present in the exchanged packets. The `params' include SKE parameters,
+ * and must be provided.
*
* This function returns SilcAsyncOperation operation context which can
* be used to control the protocol from the application. Application may
#if defined(SILC_DEBUG)
static const char *find_name[] = {
- "PKCS TYPE",
- "USERNAME",
- "HOST",
- "REALNAME",
- "EMAIL",
- "ORG",
- "COUNTRY",
+ "PKCS TYPE ",
+ "USERNAME ",
+ "HOST ",
+ "REALNAME ",
+ "EMAIL ",
+ "ORG ",
+ "COUNTRY ",
"PUBLIC KEY",
- "CONTEXT",
- "USAGE",
+ "CONTEXT ",
+ "USAGE ",
NULL
};
#endif /* SILC_DEBUG */
case SILC_SKR_FIND_PKCS_TYPE:
case SILC_SKR_FIND_USAGE:
silc_snprintf(retbuf, retbuf_size, "[%s] [%d]", find_name[type],
- (int)SILC_PTR_TO_32(data));
+ (int)SILC_PTR_TO_32(data));
break;
case SILC_SKR_FIND_PUBLIC_KEY:
default:
silc_snprintf(retbuf, retbuf_size, "[%s] [%s]", find_name[type],
- (char *)data);
+ (char *)data);
}
}
#endif /* SILC_DEBUG */
{
SilcSKREntry entry;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+ memset(tmp, 0, sizeof(tmp));
+ silc_skr_type_string(type, type_data, tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG(("Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
entry = silc_calloc(1, sizeof(*entry));
if (!entry)
return FALSE;
SilcSKRStatus status = SILC_SKR_ERROR;
SilcPublicKeyIdentifier ident;
SilcSILCPublicKey silc_pubkey;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+#endif /* SILC_DEBUG */
/* Get the SILC public key */
silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
- SILC_LOG_DEBUG(("Adding SILC public key [%s]", ident->username));
+ SILC_LOG_DEBUG(("Adding SILC public key %p [%s], context %p",
+ public_key, ident->username, key_context));
silc_mutex_lock(skr->lock);
key->key.key = public_key;
key->key.key_context = key_context;
+#if defined(SILC_DEBUG)
+ silc_skr_type_string(SILC_SKR_FIND_USAGE, SILC_32_TO_PTR(usage),
+ tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG((" Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
/* Add key specifics */
if (!silc_skr_add_entry(skr, SILC_SKR_FIND_PUBLIC_KEY,
SilcBool silc_skr_find_set_context(SilcSKRFind find, void *context)
{
+ if (!context)
+ return TRUE;
return silc_hash_table_add(find->constr,
SILC_32_TO_PTR(SILC_SKR_FIND_CONTEXT), context);
}
SilcHashTableList htl;
SilcDList list, results = NULL;
void *type, *ctx, *usage = NULL;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+#endif /* SILC_DEBUG */
SILC_LOG_DEBUG(("Finding key from repository"));
silc_hash_table_find(find->constr, SILC_32_TO_PTR(SILC_SKR_FIND_USAGE),
NULL, &usage);
+#if defined(SILC_DEBUG)
+ if (usage) {
+ memset(tmp, 0, sizeof(tmp));
+ silc_skr_type_string(SILC_SKR_FIND_USAGE, usage, tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG(("Finding key by %s", tmp));
+ }
+#endif /* SILC_DEBUG */
+
silc_hash_table_list(find->constr, &htl);
while (silc_hash_table_get(&htl, &type, &ctx)) {
+ /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
+ if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
+ continue;
+
#if defined(SILC_DEBUG)
- char tmp[256];
memset(tmp, 0, sizeof(tmp));
silc_skr_type_string((SilcSKRFindType)SILC_32_TO_PTR(type),
ctx, tmp, sizeof(tmp) - 1);
SILC_LOG_DEBUG(("Finding key by %s", tmp));
#endif /* SILC_DEBUG */
- /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
- if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
- continue;
-
/* Find entries by this search constraint */
if (!silc_skr_find_entry(skr, &status,
(SilcSKRFindType)SILC_32_TO_PTR(type),
}
#endif /* SILC_ATOMIC_MUTEX */
-SILC_ATOMIC_INIT(8, 8, SilcUInt8);
-SILC_ATOMIC_INIT(16, 16, SilcUInt16);
-SILC_ATOMIC_INIT(32, 32, SilcUInt32);
-SILC_ATOMIC_INIT(_pointer, Pointer, void *);
+SILC_ATOMIC_INIT(8, 8, SilcUInt8)
+SILC_ATOMIC_INIT(16, 16, SilcUInt16)
+SILC_ATOMIC_INIT(32, 32, SilcUInt32)
+SILC_ATOMIC_INIT(_pointer, Pointer, void *)
/****f* silcutil/SilcAtomicAPI/silc_atomic_uninit32
*
#define SILC_ATOMIC_UNINIT(bits, t) \
SILC_ATOMIC_UNINIT_F(bits, t) \
{ \
+ memset(atomic, 0, sizeof(*atomic)); \
}
#endif /* SILC_ATOMIC_MUTEX */
-SILC_ATOMIC_UNINIT(8, 8);
-SILC_ATOMIC_UNINIT(16, 16);
-SILC_ATOMIC_UNINIT(32, 32);
-SILC_ATOMIC_UNINIT(_pointer, Pointer);
+SILC_ATOMIC_UNINIT(8, 8)
+SILC_ATOMIC_UNINIT(16, 16)
+SILC_ATOMIC_UNINIT(32, 32)
+SILC_ATOMIC_UNINIT(_pointer, Pointer)
/****f* silcutil/SilcAtomicAPI/silc_atomic_set_int32
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_SET_INT(8, "b", "b");
-SILC_ATOMIC_SET_INT(16, "w", "w");
-SILC_ATOMIC_SET_INT(32, "l", "");
+SILC_ATOMIC_SET_INT(8, "b", "b")
+SILC_ATOMIC_SET_INT(16, "w", "w")
+SILC_ATOMIC_SET_INT(32, "l", "")
/****f* silcutil/SilcAtomicAPI/silc_atomic_set_pointer
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_GET_INT(8);
-SILC_ATOMIC_GET_INT(16);
-SILC_ATOMIC_GET_INT(32);
+SILC_ATOMIC_GET_INT(8)
+SILC_ATOMIC_GET_INT(16)
+SILC_ATOMIC_GET_INT(32)
/****f* silcutil/SilcAtomicAPI/silc_atomic_get_pointer
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_ADD_INT(8, "b");
-SILC_ATOMIC_ADD_INT(16, "w");
-SILC_ATOMIC_ADD_INT(32, "l");
+SILC_ATOMIC_ADD_INT(8, "b")
+SILC_ATOMIC_ADD_INT(16, "w")
+SILC_ATOMIC_ADD_INT(32, "l")
/****f* silcutil/SilcAtomicAPI/silc_atomic_sub_int32
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_INC(8, "b");
-SILC_ATOMIC_INC(16, "w");
-SILC_ATOMIC_INC(32, "l");
+SILC_ATOMIC_INC(8, "b")
+SILC_ATOMIC_INC(16, "w")
+SILC_ATOMIC_INC(32, "l")
/****f* silcutil/SilcAtomicAPI/silc_atomic_dec32
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_DEC(8, "b");
-SILC_ATOMIC_DEC(16, "w");
-SILC_ATOMIC_DEC(32, "l");
+SILC_ATOMIC_DEC(8, "b")
+SILC_ATOMIC_DEC(16, "w")
+SILC_ATOMIC_DEC(32, "l")
/****f* silcutil/SilcAtomicAPI/silc_atomic_cas32
*
}
#endif /* !SILC_THREADS */
-SILC_ATOMIC_CAS(8, "b");
-SILC_ATOMIC_CAS(16, "w");
-SILC_ATOMIC_CAS(32, "l");
+SILC_ATOMIC_CAS(8, "b")
+SILC_ATOMIC_CAS(16, "w")
+SILC_ATOMIC_CAS(32, "l")
/****f* silcutil/SilcAtomicAPI/silc_atomic_cas_pointer
*
return NULL;
/* Allocate the actual data area */
- sb->head = (unsigned char *)silc_smalloc_ua(stack, len);
+ sb->head = (unsigned char *)silc_smalloc(stack, len);
if (silc_unlikely(!sb->head))
return NULL;
hlen = silc_buffer_headlen(sb);
dlen = silc_buffer_len(sb);
- h = (unsigned char *)silc_srealloc_ua(stack, silc_buffer_truelen(sb),
- sb->head, newsize);
+ h = (unsigned char *)silc_srealloc(stack, silc_buffer_truelen(sb),
+ sb->head, newsize);
if (!h) {
/* Do slow and stack wasting realloc. The old sb->head is lost and
is freed eventually. */
- h = (unsigned char *)silc_smalloc_ua(stack, newsize);
+ h = (unsigned char *)silc_smalloc(stack, newsize);
if (silc_unlikely(!h))
return NULL;
memcpy(h, sb->head, silc_buffer_truelen(sb));
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2006 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
goto ok;
slen = strlen(string);
- d = silc_srealloc_ua(stack, len + 1, dst->head,
- sizeof(*dst->head) * (slen + len + 1));
+ d = silc_srealloc(stack, len + 1, dst->head,
+ sizeof(*dst->head) * (slen + len + 1));
if (silc_unlikely(!d))
return -1;
dst->head = d;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2000 - 2006 Pekka Riikonen
+ Copyright (C) 2000 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
* Application defines this object and adds contexts to this list with
* Dynamic List Interface functions.
*
- * SOURCE
- */
+ ***/
typedef struct SilcDListStruct {
SilcList list;
void *current;
void *prev;
} *SilcDList;
-/***/
/* SilcDListEntry structure, one entry in the list. This MUST NOT be used
directly by the application. */
* SYNOPSIS
*
* static inline
- * void silc_dlist_del(SilcDList list, void *context);
+ * void silc_dlist_del(SilcDList list, void *entry);
*
* DESCRIPTION
*
- * Remove entry from the list. Returns < 0 on error, 0 otherwise.
+ * Remove entry from the list.
*
***/
static inline
-void silc_dlist_del(SilcDList list, void *context)
+void silc_dlist_del(SilcDList list, void *entry)
{
SilcDListEntry e;
silc_list_start(list->list);
while ((e = (SilcDListEntry)silc_list_get(list->list)) != SILC_LIST_END) {
- if (e->context == context) {
+ if (e->context == entry) {
silc_list_del(list->list, e);
#if defined(SILC_DEBUG)
memset(e, 'F', sizeof(*e));
SILC_ASSERT(!f->finished);
- /* Machine must not have active threads */
- if (!f->thread && silc_atomic_get_int32(&f->u.m.threads))
- assert(silc_atomic_get_int32(&f->u.m.threads) == 0);
-
f->started = FALSE;
f->finished = TRUE;
fsm->destructor(fsm, fsm->fsm_context, fsm->destructor_context);
} else {
+ /* Machine must not have active threads */
+ assert(silc_atomic_get_int32(&fsm->u.m.threads) == 0);
+
if (fsm->u.m.lock) {
silc_mutex_free(fsm->u.m.lock);
fsm->u.m.lock = NULL;
(list).next_offset = silc_offsetof(type, nextfield); \
(list).prev_set = 0; \
(list).prev_offset = 0; \
+ (list).end_set = 0; \
(list).head = (list).tail = (list).current = NULL; \
} while(0)
(list).next_offset = silc_offsetof(type, nextfield); \
(list).prev_offset = silc_offsetof(type, prevfield); \
(list).prev_set = 1; \
+ (list).end_set = 0; \
(list).head = (list).tail = (list).current = NULL; \
} while(0)
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2006 Pekka Riikonen
+ Copyright (C) 1997 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
void silc_log_output_debug(char *file, const char *function,
int line, char *string)
{
+ SilcTimeStruct curtime;
+
#ifndef SILC_SYMBIAN
if (!silclog.debug)
goto end;
}
#endif /* !SILC_SYMBIAN */
+ silc_time_value(0, &curtime);
+
#ifdef SILC_WIN32
if (strrchr(function, '\\'))
fprintf(stderr, "%s:%d: %s\n", strrchr(function, '\\') + 1, line, string);
#ifdef SILC_SYMBIAN
silc_symbian_debug(function, line, string);
#else
- fprintf(stderr, "%s:%d: %s\n", function, line, string);
+ fprintf(stderr, "%02d:%02d:%02d %s:%d: %s\n", curtime.hour,
+ curtime.minute, curtime.second, function, line,
+ string);
fflush(stderr);
#endif /* SILC_SYMBIAN */
-
+
end:
silc_free(string);
}
if (field && strstr(field, "multipart")) {
char b[1024];
SilcMime p;
+ unsigned int len;
mime->multiparts = silc_dlist_init();
if (!mime->multiparts)
if (!strchr(field, ';'))
goto err;
memset(b, 0, sizeof(b));
- strncat(b, value, strchr(field, ';') - value);
+ len = (unsigned int)(strchr(field, ';') - value);
+ if (len > sizeof(b) - 1)
+ goto err;
+ strncpy(b, value, len);
if (strchr(b, '"'))
*strchr(b, '"') = '\0';
mime->multitype = silc_memdup(b, strlen(b));
* is locked by a writer the current thread will block until the other
* thread has issued silc_rwlock_unlock for the `rwlock'. This function
* may be called multiple times to acquire the read lock. There must be
- * same amount of silc_rwlock_unlock calls. If `rwlock' is NULL this
+ * same number of silc_rwlock_unlock calls. If `rwlock' is NULL this
* function has no effect.
*
***/
* Acquires write lock of the read/write lock `rwlock'. If the `rwlock'
* is locked by a writer or a reader the current thread will block until
* the other thread(s) have issued silc_rwlock_unlock for the `rwlock'.
- * If `rwlock' is NULL this function has no effect.
+ * A thread may acquire the write lock only once. A deadlock may occur
+ * if thread attempts to acquire the write lock when it has already done
+ * so. If `rwlock' is NULL this function has no effect.
*
***/
void silc_rwlock_wrlock(SilcRwLock rwlock);
*
* This function creates TCP listener. This is used to create network
* listener for incoming connections, and `callback' will be called
- * everytime new connection is received. If `local_ip_addr' is NULL any
+ * everytime new connection is received. If `local_ip_addr' is NULL 'any'
* address is used. If provided it can be used bind the listener to
* `local_ip_count' many IP addresses provided in `local_ip_addr' table.
* On success returns the SilcNetListener context, or NULL on error.
* SYNOPSIS
*
* SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
- * char *address, SilcUInt32 address_len);
+ * char *address, SilcUInt32 address_len);
*
* DESCRIPTION
*
* SYNOPSIS
*
* SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
- * SilcUInt32 name_len);
+ * SilcUInt32 name_len);
*
- * DESCRIPTION
+x * DESCRIPTION
*
* Resolves the hostname for the IP address indicated by the `addr'
* This returns TRUE and the resolved hostname to the `name' buffer,
/* There is some data available now */
SILC_LOG_DEBUG(("Running fd tasks"));
silc_schedule_dispatch_fd(schedule);
+
+ /* If timeout was very short, dispatch also timeout tasks */
+ if (schedule->has_timeout && schedule->timeout.tv_sec == 0 &&
+ schedule->timeout.tv_usec < 50000)
+ silc_schedule_dispatch_timeout(schedule, FALSE);
continue;
} else {
return schedule->app_context;
}
+/* Set notify callback */
+
+void silc_schedule_set_notify(SilcSchedule schedule,
+ SilcTaskNotifyCb notify, void *context)
+{
+ schedule->notify = notify;
+ schedule->notify_context = context;
+}
+
/* Add new task to the scheduler */
SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
task = (SilcTask)ttask;
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, TRUE, task, FALSE, 0, 0, seconds, useconds,
+ schedule->notify_context);
+
} else if (silc_likely(type == SILC_TASK_FD)) {
SilcTaskFd ftask;
task = (SilcTask)ftask;
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, TRUE, task, TRUE, ftask->fd,
+ SILC_TASK_READ, 0, 0, schedule->notify_context);
+
} else if (silc_unlikely(type == SILC_TASK_SIGNAL)) {
SILC_SCHEDULE_UNLOCK(schedule);
schedule_ops.signal_register(schedule, schedule->internal, fd,
/* Delete from fd queue */
silc_hash_table_list(schedule->fd_queue, &htl);
- while (silc_hash_table_get(&htl, NULL, (void *)&task))
+ while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, TRUE,
+ ((SilcTaskFd)task)->fd, 0, 0, 0,
+ schedule->notify_context);
+ }
silc_hash_table_list_reset(&htl);
/* Delete from timeout queue */
silc_list_start(schedule->timeout_queue);
- while ((task = (SilcTask)silc_list_get(schedule->timeout_queue))
- != SILC_LIST_END)
+ while ((task = (SilcTask)silc_list_get(schedule->timeout_queue))) {
task->valid = FALSE;
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+ schedule->notify_context);
+ }
+
SILC_SCHEDULE_UNLOCK(schedule);
return TRUE;
}
SILC_LOG_DEBUG(("Unregistering task %p", task));
SILC_SCHEDULE_LOCK(schedule);
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, !task->type, 0, 0, 0, 0,
+ schedule->notify_context);
SILC_SCHEDULE_UNLOCK(schedule);
return TRUE;
(void *)&task))) {
SILC_LOG_DEBUG(("Deleting task %p", task));
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, TRUE, fd, 0, 0, 0,
+ schedule->notify_context);
ret = TRUE;
}
while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
if (task->callback == callback) {
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, TRUE,
+ ((SilcTaskFd)task)->fd, 0, 0, 0,
+ schedule->notify_context);
ret = TRUE;
}
}
while ((task = (SilcTask)silc_list_get(list))) {
if (task->callback == callback) {
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+ schedule->notify_context);
ret = TRUE;
}
}
while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
if (task->context == context) {
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, TRUE,
+ ((SilcTaskFd)task)->fd, 0, 0, 0,
+ schedule->notify_context);
ret = TRUE;
}
}
silc_list_start(list);
while ((task = (SilcTask)silc_list_get(list))) {
if (task->context == context) {
- ret = TRUE;
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+ schedule->notify_context);
+ ret = TRUE;
}
}
while ((task = (SilcTask)silc_list_get(list))) {
if (task->callback == callback && task->context == context) {
task->valid = FALSE;
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+ schedule->notify_context);
ret = TRUE;
}
}
task->revents = mask;
silc_schedule_dispatch_fd(schedule);
}
+
+ /* Call notify callback */
+ if (schedule->notify)
+ schedule->notify(schedule, TRUE, (SilcTask)task,
+ TRUE, task->fd, mask, 0, 0,
+ schedule->notify_context);
}
SILC_SCHEDULE_UNLOCK(schedule);
SilcTaskEvent type, SilcUInt32 fd,
void *context);
+/****f* silcutil/SilcScheduleAPI/SilcTaskNotifyCb
+ *
+ * SYNOPSIS
+ *
+ * typedef void (*SilcTaskNotifyCb)(SilcSchedule schedule,
+ * SilcBool added, SilcTask task,
+ * SilcBool fd_task, SilcUInt32 fd,
+ * SilcTaskEvent event,
+ * long seconds, long useconds,
+ * void *context);
+ *
+ * DESCRIPTION
+ *
+ * Task notify callback. Callback of this type can be set to scheduler
+ * by calling silc_schedule_set_notify and will be called whenever new
+ * task is added or old task is removed. If `added' is TRUE then `task'
+ * is added to scheduler. If `added' is FALSE then `task' will be removed
+ * from the scheduler. If `fd_task' is TRUE the `task' is file descriptor
+ * task and has `fd' is its file descriptor. If `fd_task' is FALSE then
+ * the task is timeout task and `seconds' and `useconds' specify the
+ * timeout. The `context' is the context given to silc_schedule_set_notify.
+ *
+ * NOTES
+ *
+ * The `schedule' is locked while this callback is called. This means that
+ * new tasks cannot be added or removed inside this callback.
+ *
+ * When timeout task expires this callback is not called. This is called
+ * only when task is explicitly deleted from the scheduler. Note that,
+ * when timeout task expires it is removed from the scheduler and `task'
+ * will become invalid.
+ *
+ * If fd task changes its events, this will be called as if it was a new
+ * task with different `event' mask.
+ *
+ ***/
+typedef void (*SilcTaskNotifyCb)(SilcSchedule schedule,
+ SilcBool added, SilcTask task,
+ SilcBool fd_task, SilcUInt32 fd,
+ SilcTaskEvent event,
+ long seconds, long useconds,
+ void *app_context);
+
/* Macros */
/****d* silcutil/SilcScheduleAPI/SILC_ALL_TASKS
*
* DESCRIPTION
*
- * Generic macro to define task callback functions. This defines a
- * static function with name `func' as a task callback function.
+ * Generic macro to declare task callback functions. This defines a
+ * function with name `func' as a task callback function.
*
* SOURCE
*/
***/
void *silc_schedule_get_context(SilcSchedule schedule);
+/****f* silcutil/SilcScheduleAPI/silc_schedule_set_notify
+ *
+ * SYNOPSIS
+ *
+ * void silc_schedule_set_notify(SilcSchedule schedule,
+ * SilcTaskNotifyCb notify, void *context);
+ *
+ * DESCRIPTION
+ *
+ * Set notify callback to scheduler. The `notify' will be called whenever
+ * task is added to or deleted from scheduler.
+ *
+ ***/
+void silc_schedule_set_notify(SilcSchedule schedule,
+ SilcTaskNotifyCb notify, void *context);
+
/****f* silcutil/SilcScheduleAPI/silc_schedule_task_add_fd
*
* SYNOPSIS
* Add timeout task to scheduler. The `callback' will be called once
* the specified timeout has elapsed. The task will be removed from the
* scheduler automatically once the task expires. The event returned
- * to the `callback' is SILC_TASK_EXPIRE. The task added with zero (0)
+ * to the `callback' is SILC_TASK_EXPIRE. A task added with zero (0)
* timeout will be executed immediately next time tasks are scheduled.
*
***/
struct SilcScheduleStruct {
void *internal;
void *app_context; /* Application specific context */
+ SilcTaskNotifyCb notify; /* Notify callback */
+ void *notify_context; /* Notify context */
SilcHashTable fd_queue; /* FD task queue */
SilcList fd_dispatch; /* Dispatched FDs */
SilcList timeout_queue; /* Timeout queue */
the wakeup mechanism of the scheduler. In multi-threaded environment
the scheduler needs to be wakenup when tasks are added or removed from
the task queues. Returns context to the platform specific scheduler.
- If this returns NULL the scheduler initialization will fail. */
+ If this returns NULL the scheduler initialization will fail. Do not
+ add FD tasks inside function. Timeout tasks can be added. */
void *(*init)(SilcSchedule schedule, void *app_context);
/* Uninitializes the platform specific scheduler context. */
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2006 Pekka Riikonen
+ Copyright (C) 2003 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*
* The data stack is not thread-safe. If the same stack context must be
* used in multithreaded environment concurrency control must be employed.
+ * Each thread should allocate their own SilcStack.
*
***/
* Static stack frame context that optionally can be used as stack
* frame in SilcStack. By default silc_stack_push use pre-allocated
* stack frame (or allocates new one if all frames are reserved), but
- * user may also use staticly allocated SilcStackFrame instead. This
+ * user may also use statically allocated SilcStackFrame instead. This
* is recommended when using SilcStack in recursive routine and the
* recursion may become deep. Using static frame assures that during
* recursion frames never run out and silc_stack_push never allocates
- * any memory. In other normal usage staticly allocated SilcStackFrame
+ * any memory. In other normal usage statically allocated SilcStackFrame
* is not needed, unless performance is critical.
*
***/
* If this returns zero (0) the system is out of memory.
*
* If the `frame' is non-NULL then that SilcStackFrame is used as
- * stack frame. Usually `frame' is set to NULL by user. Staticly
+ * stack frame. Usually `frame' is set to NULL by user. Statically
* allocated SilcStackFrame should be used when using silc_stack_push
* in recursive function and the recursion may become deep. In this
- * case using staticly allocated SilcStackFrame is recommended since
+ * case using statically allocated SilcStackFrame is recommended since
* it assures that frames never run out and silc_stack_push never
* allocates any memory. If your routine is not recursive then
* setting `frame' to NULL is recommended, unless performance is
* silc_foo_parse_packet(packet, stack);
* silc_stack_pop(stack);
*
- * Another example with recursion and using staticly allocated
- * SilcStackFrame. After popping the staticly allocated frame can
+ * Another example with recursion and using statically allocated
+ * SilcStackFrame. After popping the statically allocated frame can
* be reused if necessary.
*
* void silc_foo_this_function(SilcStack stack)
f |= STRINGPREP_NO_UNASSIGNED;
/* Prepare */
- ret = stringprep((char *)utf8s, utf8s_len + 1, f, profile);
+ ret = stringprep((char *)utf8s, utf8s_len, f, profile);
SILC_LOG_DEBUG(("stringprep() return %d", ret));
/* Since the stringprep() doesn't allocate returned buffer, and
much space we must have for the conversion. Allocate more if it
fails, and try again. */
if (ret == STRINGPREP_TOO_SMALL_BUFFER) {
- utf8s = silc_realloc(utf8s, sizeof(*utf8s) * (utf8s_len * 2));
+ utf8s = silc_realloc(utf8s, sizeof(*utf8s) * ((utf8s_len * 2) + 1));
if (!utf8s)
return SILC_STRINGPREP_ERR_OUT_OF_MEMORY;
- memset(utf8s + utf8s_len, 0, utf8s_len);
+ memset(utf8s + utf8s_len + 1, 0, utf8s_len);
ret = stringprep((char *)utf8s, utf8s_len * 2, f, profile);
SILC_LOG_DEBUG(("stringprep() return %d", ret));
}
{
struct timeval curtime;
silc_gettimeofday(&curtime);
- return (curtime.tv_sec * 1000) + (curtime.tv_usec / 1000);
+ return (curtime.tv_sec * (SilcUInt64)1000) +
+ (curtime.tv_usec / (SilcUInt64)1000);
}
/* Return time since Epoch in microseconds */
{
struct timeval curtime;
silc_gettimeofday(&curtime);
- return (curtime.tv_sec * 1000000) + curtime.tv_usec;
+ return (curtime.tv_sec * (SilcUInt64)1000000) + curtime.tv_usec;
}
/* Returns time as string */
SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
{
- struct tm *time;
+ struct tm *t;
unsigned int msec = 0;
time_t timeval;
+ SilcInt32 ctz = 0;
if (!ret_time)
return TRUE;
msec = (SilcUInt64)time_val % (SilcUInt64)1000;
timeval = (time_t)((SilcUInt64)time_val / (SilcUInt64)1000);
- time = localtime(&timeval);
- if (!time)
+ t = localtime(&timeval);
+ if (!t)
return FALSE;
memset(ret_time, 0, sizeof(*ret_time));
- if (!silc_time_fill(ret_time, time->tm_year + 1900, time->tm_mon + 1,
- time->tm_mday, time->tm_hour, time->tm_min,
- time->tm_sec, msec))
+ if (!silc_time_fill(ret_time, t->tm_year + 1900, t->tm_mon + 1,
+ t->tm_mday, t->tm_hour, t->tm_min,
+ t->tm_sec, msec))
return FALSE;
- ret_time->dst = time->tm_isdst ? 1 : 0;
+ ret_time->dst = t->tm_isdst ? 1 : 0;
+
#ifdef SILC_WIN32
ret_time->utc_east = _timezone < 0 ? 1 : 0;
ret_time->utc_hour = (ret_time->utc_east ? (-(_timezone)) / 3600 :
ret_time->utc_minute = (ret_time->utc_east ? (-(_timezone)) % 3600 :
_timezone % 3600);
#else
-#if defined(HAVE_TZSET)
+#if defined(HAVE_TIMEZONE)
ret_time->utc_east = timezone < 0 ? 1 : 0;
- ret_time->utc_hour = (ret_time->utc_east ? (-(timezone)) / 3600 :
- timezone / 3600);
- ret_time->utc_minute = (ret_time->utc_east ? (-(timezone)) % 3600 :
- timezone % 3600);
-#endif /* HAVE_TZSET */
+ ctz = timezone;
+ if (ret_time->dst)
+ ctz -= 3600;
+#elif defined(HAVE_TM_GMTOFF)
+ ret_time->utc_east = t->tm_gmtoff > 0 ? 1 : 0;
+ ctz = -t->tm_gmtoff;
+#elif defined(HAVE___TM_GMTOFF)
+ ret_time->utc_east = t->__tm_gmtoff > 0 ? 1 : 0;
+ ctz = -t->__tm_gmtoff;
+#elif defined(HAVE___TM_GMTOFF__)
+ ret_time->utc_east = t->__tm_gmtoff__ > 0 ? 1 : 0;
+ ctz = -t->__tm_gmtoff__;
+#endif /* HAVE_TIMEZONE */
+
+ ret_time->utc_hour = (ret_time->utc_east ? (-(ctz)) / 3600 : ctz / 3600);
+ ret_time->utc_minute = (ret_time->utc_east ? (-(ctz)) % 3600 : ctz % 3600);
#endif /* SILC_WIN32 */
+ if (ret_time->utc_minute)
+ ret_time->utc_minute /= 60;
+
return TRUE;
}
st_blocks = stack->next;
st_blocks_count--;
+
+ memset(stack, 'F', SILC_ST_GET_SIZE(stack->size));
free(stack);
}
SilcSchedule schedule;
+void notify_cb(SilcSchedule schedule, SilcBool added, SilcTask task,
+ SilcBool fd_task, SilcUInt32 fd, long sec, long usec,
+ void *context)
+{
+ SILC_LOG_DEBUG(("Notify cb, %s %s task, fd %d, sec %d usec %d",
+ added ? "added" : "deleted", fd_task ? "fd" :"timeout",
+ fd, sec, usec));
+}
+
SILC_TASK_CALLBACK(foo)
{
schedule = silc_schedule_init(NUM_FTASK, NULL);
if (!schedule)
goto err;
+ silc_schedule_set_notify(schedule, notify_cb, NULL);
silc_schedule_task_add_signal(schedule, SIGINT, interrupt, NULL);
SILC_LOG_DEBUG(("day : %d", curtime.day));
SILC_LOG_DEBUG(("hour : %d", curtime.hour));
SILC_LOG_DEBUG(("minute : %d", curtime.minute));
+ SILC_LOG_DEBUG(("second : %d", curtime.second));
SILC_LOG_DEBUG(("msecond : %d", curtime.msecond));
SILC_LOG_DEBUG(("utc_hour : %d", curtime.utc_hour));
SILC_LOG_DEBUG(("utc_min : %d", curtime.utc_minute));
/* Bind to local addresses */
for (i = 0; i < local_ip_count; i++) {
- SILC_LOG_DEBUG(("Binding to local address %s",
- local_ip_addr ? local_ip_addr[i] : ipany));
+ SILC_LOG_DEBUG(("Binding to local address %s:%d",
+ local_ip_addr ? local_ip_addr[i] : ipany, port));
/* Set sockaddr for server */
if (!silc_net_set_sockaddr(&server,
}
#if defined(ECONNREFUSED)
- if (errno == ECONNREFUSED)
+ if (opt == ECONNREFUSED)
conn->status = SILC_NET_CONNECTION_REFUSED;
#endif /* ECONNREFUSED */
#if defined(ETIMEDOUT)
- if (errno == ETIMEDOUT)
+ if (opt == ETIMEDOUT)
conn->status = SILC_NET_CONNECTION_TIMEOUT;
#endif /* ETIMEDOUT */
#if defined(ENETUNREACH)
- if (errno == ENETUNREACH)
+ if (opt == ENETUNREACH)
conn->status = SILC_NET_HOST_UNREACHABLE;
#endif /* ENETUNREACH */
/** Connecting failed */
- SILC_LOG_DEBUG(("Connecting failed"));
+ SILC_LOG_DEBUG(("Connecting failed, error %s", strerror(opt)));
silc_fsm_next(fsm, silc_net_connect_st_finish);
return SILC_FSM_CONTINUE;
}
SILC_LOG_DEBUG(("Scheduling fd %lu, mask %x", task->fd, event_mask));
- event.events = 0;
+ memset(&event, 0, sizeof(event));
if (event_mask & SILC_TASK_READ)
event.events |= (EPOLLIN | EPOLLPRI);
if (event_mask & SILC_TASK_WRITE)
SILC_LOG_DEBUG(("Wokeup"));
- read(internal->wakeup_pipe[0], &c, 1);
+ (void)read(internal->wakeup_pipe[0], &c, 1);
}
+SILC_TASK_CALLBACK(silc_schedule_wakeup_init)
+{
+ SilcUnixScheduler internal = schedule->internal;
+
+ internal->wakeup_task =
+ silc_schedule_task_add(schedule, internal->wakeup_pipe[0],
+ silc_schedule_wakeup_cb, internal,
+ 0, 0, SILC_TASK_FD);
+ if (!internal->wakeup_task) {
+ SILC_LOG_WARNING(("Could not add a wakeup task, threads won't work"));
+ close(internal->wakeup_pipe[0]);
+ return;
+ }
+ silc_schedule_internal_schedule_fd(schedule, internal,
+ (SilcTaskFd)internal->wakeup_task,
+ SILC_TASK_READ);
+}
#endif /* SILC_THREADS */
/* Initializes the platform specific scheduler. This for example initializes
return NULL;
}
- internal->wakeup_task =
- silc_schedule_task_add(schedule, internal->wakeup_pipe[0],
- silc_schedule_wakeup_cb, internal,
- 0, 0, SILC_TASK_FD);
- if (!internal->wakeup_task) {
- SILC_LOG_ERROR(("Could not add a wakeup task, threads won't work"));
- close(internal->wakeup_pipe[0]);
- close(internal->wakeup_pipe[1]);
- silc_free(internal);
- return NULL;
- }
- silc_schedule_internal_schedule_fd(schedule, internal,
- (SilcTaskFd)internal->wakeup_task,
- SILC_TASK_READ);
+ silc_schedule_task_add_timeout(schedule, silc_schedule_wakeup_init,
+ internal, 0, 0);
#endif /* SILC_THREADS */
internal->app_context = app_context;
SILC_LOG_DEBUG(("Wakeup"));
- write(internal->wakeup_pipe[1], "!", 1);
+ (void)write(internal->wakeup_pipe[1], "!", 1);
#endif
}
{
int i;
+ SILC_LOG_DEBUG(("Start"));
+
for (i = 0; i < SIGNAL_COUNT; i++) {
if (signal_call[i].sig == signal) {
signal_call[i].call = TRUE;
signal_call[i].callback) {
SILC_LOG_DEBUG(("Calling signal %d callback",
signal_call[i].sig));
+ silc_schedule_internal_signals_unblock(schedule, context);
signal_call[i].callback(schedule, internal->app_context,
SILC_TASK_INTERRUPT,
signal_call[i].sig,
signal_call[i].context);
signal_call[i].call = FALSE;
+ silc_schedule_internal_signals_block(schedule, context);
}
}
{
#ifdef SILC_THREADS
if (mutex) {
- if (pthread_mutex_lock(&mutex->mutex))
- SILC_ASSERT(FALSE);
+ SILC_VERIFY(pthread_mutex_lock(&mutex->mutex) == 0);
mutex->locked = TRUE;
}
#endif /* SILC_THREADS */
{
#ifdef SILC_THREADS
if (mutex) {
- if (pthread_mutex_unlock(&mutex->mutex))
- SILC_ASSERT(FALSE);
+ SILC_VERIFY(pthread_mutex_unlock(&mutex->mutex) == 0);
mutex->locked = FALSE;
}
#endif /* SILC_THREADS */
{
#ifdef SILC_THREADS
if (mutex)
- SILC_ASSERT(mutex->locked);
+ SILC_VERIFY(mutex->locked);
#endif /* SILC_THREADS */
}
{
#ifdef SILC_THREADS
if (rwlock)
- pthread_rwlock_wrlock(&rwlock->rwlock);
+ SILC_VERIFY(pthread_rwlock_wrlock(&rwlock->rwlock) == 0);
#endif /* SILC_THREADS */
}
{
#ifdef SILC_THREADS
if (rwlock)
- pthread_rwlock_unlock(&rwlock->rwlock);
+ SILC_VERIFY(pthread_rwlock_unlock(&rwlock->rwlock) == 0);
#endif /* SILC_THREADS */
}
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tr valign="top" bgcolor="#dddddd">
- <td><small>Copyright © 2001 - 2005 SILC Project<br />
+ <td><small>Copyright © 2001 - 2007 SILC Project<br />
<a href="http://silcnet.org">SILC Project Website</a></small></td>
<td align="right"><small>
<a href="index.html">SILC Toolkit Reference Manual</a><br />
</table>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tr valign="top" bgcolor="#dddddd">
- <td><small>Copyright © 2001 - 2005 SILC Project<br />
+ <td><small>Copyright © 2001 - 2007 SILC Project<br />
<a href="http://silcnet.org">SILC Project Website</a></small></td>
<td align="right"><small>
<a href="index.html">SILC Toolkit Reference Manual</a><br />
--- /dev/null
+Summary: SILC Toolkit
+Name: silc-toolkit
+Version: SILC_VERSION
+Release: SILC_RELEASE
+License: GPL/BSD dual licensed
+Group: System Environment/Libraries
+URL: http://silcnet.org/
+Source0: silc-toolkit-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildRequires: pkgconfig
+Obsoletes: libsilc
+Obsoletes: libsilc-devel
+Obsoletes: libsilc-doc
+Provides: libsilc
+Provides: libsilc-devel
+Provides: libsilc-doc
+Epoch: 0
+
+%description
+SILC Toolkit providing SILC Protocol Core Library, SILC Client Library,
+runtime library and many other libraries. SILC Toolkit enables SILC
+application development. SILC (Secure Internet Live Conferencing) is a
+secure conferencing protocol.
+
+%package devel
+Group: Development/Libraries
+Summary: SILC Toolkit providing headers, libraries and documentation
+Requires: silc-toolkit = %{epoch}:%{version}-%{release}
+Requires: pkgconfig
+
+%description devel
+The SILC Toolkit development libraries, headers and documentation. SILC
+Toolkit enables SILC application development.
+
+%prep
+%setup -q -n silc-toolkit-%{version}
+
+%build
+%configure --libdir=%{_libdir} \
+ --includedir=%{_includedir}/silc \
+ --with-simdir=%{_libdir}/silc/modules \
+ --docdir=%{_docdir}/%{name}-%{version}
+make -j4
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/lib*
+chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/silc/modules/*.so
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(0755, root, root, 0755)
+%{_libdir}/libsilc-1.1.so*
+%{_libdir}/libsilcclient-1.1.so*
+%dir %_libdir/silc
+%dir %_libdir/silc/modules
+%{_libdir}/silc/modules/*.so
+%defattr(0644, root, root, 0755)
+%doc CHANGES COPYING GPL BSD
+
+%files devel
+%defattr(0644, root, root, 0755)
+%doc CHANGES COPYING GPL BSD doc/toolkit
+%{_libdir}/libsilc.so
+%{_libdir}/libsilc.*a
+%{_libdir}/libsilcclient.so
+%{_libdir}/libsilcclient.*a
+%{_libdir}/pkgconfig/silc.pc
+%{_libdir}/pkgconfig/silcclient.pc
+%dir %_includedir/silc
+%{_includedir}/silc/*.h
+
+%changelog
+* Wed May 30 2007 Pekka Riikonen <priikone@silcnet.org>
+- Rewrote .spec for SILC Toolkit 1.1. Obsoletes libsilc. Renamed to
+ silc-toolkit.
+
+* Tue Sep 1 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.6 - Had to remove smp_mflags because build fails with them
+ (Michael Schwendt)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.5 - corrections to lib and include path (from Michael Schwendt)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.4 - post/postun /sbin/ldconfig
+ (Patch 823 from Stu Tomlinson)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.3 - Move libs to %{_libdir} and add a silc.pc
+ (Patch 815 from Stu Tomlinson)
+
+* Tue Aug 17 2004 Toni Willberg <toniw@iki.fi>
+- fix so permissions and hardcoded paths (patch from Michael Schwendt)
+
+* Mon Jul 5 2004 Toni Willberg <toniw@iki.fi>
+- Fixed various errors
+
+* Sun Jul 4 2004 Toni Willberg <toniw@iki.fi>
+- Initial version for Fedora
silcclient_static.mmp\r
\r
PRJ_TESTMMPFILES\r
-test_silcnet.mmp\r
SOURCEPATH ..\lib\silccore\r
SOURCE silcargument.c silcattrs.c silcauth.c silcchannel.c silccommand.c silcid.c silcmessage.c silcnotify.c silcpacket.c silcpubkey.c silcstatus.c\r
SOURCEPATH ..\lib\silccrypt\r
-SOURCE aes.c blowfish.c cast.c md5.c none.c rc5.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
+SOURCE aes.c blowfish.c md5.c none.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
SOURCEPATH ..\lib\silchttp\r
SOURCE silchttpserver.c\r
SOURCEPATH ..\lib\silcmath\r
SOURCEPATH ..\lib\silccore\r
SOURCE silcargument.c silcattrs.c silcauth.c silcchannel.c silccommand.c silcid.c silcmessage.c silcnotify.c silcpacket.c silcpubkey.c silcstatus.c\r
SOURCEPATH ..\lib\silccrypt\r
-SOURCE aes.c blowfish.c cast.c md5.c none.c rc5.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
+SOURCE aes.c blowfish.c md5.c none.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
SOURCEPATH ..\lib\silchttp\r
SOURCE silchttpserver.c\r
SOURCEPATH ..\lib\silcmath\r
AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
-CFLAGS = $(INCLUDES) $(SILC_COMMON_LIBS) $(LDFLAGS)
+CFLAGS = $(INCLUDES) $(SILC_COMMON_LDFLAGS) $(SILC_COMMON_LIBS) $(LDFLAGS)
SOURCES = mybot.c
all: mybot
/*
- mybot.c
+ mybot.c
- Author: Pekka Riikonen <priikone@silcnet.org>, November 2002
+ Author: Pekka Riikonen <priikone@silcnet.org>, November 2002, 2007
This code is Public Domain.
MyBot
gcc -o mybot mybot.c -I/usr/local/silc/include -L/usr/local/silc/lib \
-lsilc -lsilcclient -lpthread -ldl
- The MyBot works as follows (logicly):
-
- main -> mybot_start -> silc_client_connect_to_server
- v
- silc_client_run (message loop...)
- v
- silc_verify_public_key
- v
- silc_get_auth_method
- v
- silc_connected -> silc_client_command_call (JOIN)
- v
- silc_command_reply -> silc_send_channel_message ("hello")
- v
- message loop...
- v
- main <- mybot_start
-
*/
#include "silc.h" /* Mandatory include for SILC applications */
SilcClientOperations ops;
+static void silc_running(SilcClient client, void *application);
+static void silc_stopped(SilcClient client, void *context);
+
/******* MyBot code **********************************************************/
/* This is context for our MyBot client */
typedef struct {
SilcClient client; /* The actual SILC Client */
SilcClientConnection conn; /* Connection to the server */
+ SilcPublicKey public_key; /* My public key */
+ SilcPrivateKey private_key; /* My private key */
} *MyBot;
+/* Connect callback called after connected to remote server. */
+
+static void
+silc_connected(SilcClient client, SilcClientConnection conn,
+ SilcClientConnectionStatus status,
+ SilcStatus error, const char *message,
+ void *context)
+{
+ MyBot mybot = client->application;
+
+ if (status == SILC_CLIENT_CONN_DISCONNECTED) {
+ SILC_LOG_DEBUG(("Disconnected %s", message ? message : ""));
+ silc_client_stop(client, silc_stopped, mybot);
+ return;
+ }
+
+ if (status != SILC_CLIENT_CONN_SUCCESS &&
+ status != SILC_CLIENT_CONN_SUCCESS_RESUME) {
+ SILC_LOG_DEBUG(("Error connecting to server %d", status));
+ silc_client_stop(client, silc_stopped, mybot);
+ return;
+ }
+
+ fprintf(stdout, "\nMyBot: Connected to server\n\n");
+
+ /* Now that we have connected to server, let's join a channel named
+ "mybot". */
+ silc_client_command_call(client, conn, "JOIN mybot");
+
+ /* Save the connection context */
+ mybot->conn = conn;
+}
+
+/* Running callback given to silc_client_init called to indicate that the
+ Client Library is running. After this Client API functions can be
+ called. */
+
+static void silc_running(SilcClient client, void *application)
+{
+ MyBot mybot = application;
+
+ SILC_LOG_DEBUG(("Client is running"));
+
+ /* Connect to server. The silc_connected callback will be called after
+ the connection is established or if an error occurs during connecting. */
+ silc_client_connect_to_server(mybot->client, NULL,
+ mybot->public_key, mybot->private_key,
+ "silc.silcnet.org", 706,
+ silc_connected, mybot);
+}
+
+/* Client stopped callback given to silc_client_stop. Called to indicate
+ that Client Library is stopped. */
+
+static void silc_stopped(SilcClient client, void *context)
+{
+ SILC_LOG_DEBUG(("Client stopped"));
+}
+
/* Start the MyBot, by creating the SILC Client entity by using the
SILC Client Library API. */
int mybot_start(void)
{
MyBot mybot;
+ SilcClientParams params;
/* Allocate the MyBot structure */
mybot = silc_calloc(1, sizeof(*mybot));
return 1;
}
- /* Allocate our SILC Client which is the MyBot. The arguments to the
- function are:
-
- ops - our client operations that the library requires
- param - parameters, but we don't have any so we pass NULL,
- application - our application, ie. the MyBot of course!
- version - silc version, provided by the library if we put NULL
- */
- mybot->client = silc_client_alloc(&ops, NULL, mybot, NULL);
+ memset(¶ms, 0, sizeof(params));
+ params.threads = TRUE;
+ mybot->client = silc_client_alloc(&ops, ¶ms, mybot, NULL);
if (!mybot->client) {
perror("Could not allocate SILC Client");
return 1;
}
- /* Now fill the allocated client with mandatory parameters the library
- requires: username, hostname and "real name". */
- mybot->client->username = silc_get_username();
- mybot->client->hostname = silc_net_localhost();
- mybot->client->realname = strdup("I am the MyBot");
-
/* Now we initialize the client. */
- if (!silc_client_init(mybot->client)) {
+ if (!silc_client_init(mybot->client, silc_get_username(),
+ silc_net_localhost(), "I am the MyBot",
+ silc_running, mybot)) {
perror("Could not init client");
return 1;
}
- /* Then we load our public key from the file. The library requires
- the key pair loaded before the client is started. The SILC Toolkit
- provides nice routines to do just that so we don't have to worry
- about much.
-
- Oh, and if the key pair doesn't exist, we create one here
- automatically, and save them to files for future. */
if (!silc_load_key_pair("mybot.pub", "mybot.prv", "",
- &mybot->client->pkcs,
- &mybot->client->public_key,
- &mybot->client->private_key)) {
+ &mybot->public_key,
+ &mybot->private_key)) {
/* The keys don't exist. Let's generate us a key pair then! There's
nice ready routine for that too. Let's do 2048 bit RSA key pair. */
fprintf(stdout, "MyBot: Key pair does not exist, generating it.\n");
if (!silc_create_key_pair("rsa", 2048, "mybot.pub", "mybot.prv", NULL, "",
- &mybot->client->pkcs,
- &mybot->client->public_key,
- &mybot->client->private_key, FALSE)) {
+ &mybot->public_key,
+ &mybot->private_key, FALSE)) {
perror("Could not generated key pair");
return 1;
}
}
- /* Start connecting to server. This is asynchronous connecting so the
- connection is actually created later after we run the client. */
- silc_client_connect_to_server(mybot->client, NULL, 706,
- "silc.silcnet.org", mybot);
-
/* And, then we are ready to go. Since we are really simple client we
don't have user interface and we don't have to deal with message loops
or interactivity. That's why we can just hand over the execution
/* Private message to the client. The `sender' is the sender of the
- message. The message is `message'and maybe NULL. The `flags'
+ message. The message is `message'and maybe NULL. The `flags'
indicates message flags and it is used to determine how the message
can be interpreted (like it may tell the message is multimedia
message). */
static void
silc_command(SilcClient client, SilcClientConnection conn,
- SilcClientCommandContext cmd_context, bool success,
- SilcCommand command, SilcStatus status)
+ SilcBool success, SilcCommand command, SilcStatus status,
+ SilcUInt32 argc, unsigned char **argv)
{
/* If error occurred in client library with our command, print the error */
if (status != SILC_STATUS_OK)
static void
silc_command_reply(SilcClient client, SilcClientConnection conn,
- SilcCommandPayload cmd_payload, bool success,
- SilcCommand command, SilcStatus status, ...)
+ SilcCommand command, SilcStatus status,
+ SilcStatus error, va_list ap)
{
- va_list va;
-
/* If error occurred in client library with our command, print the error */
if (status != SILC_STATUS_OK)
fprintf(stderr, "MyBot: COMMAND REPLY %s: %s\n",
silc_get_command_name(command),
silc_get_status_message(status));
- va_start(va, status);
-
- /* Check for successful JOIN */
+ /* Check for successful JOIN. See
+ http://silcnet.org/docs/toolkit/command_reply_args.html for the
+ different arguments the client library returns. */
if (command == SILC_COMMAND_JOIN) {
SilcChannelEntry channel;
+ SilcHash sha1hash;
- (void)va_arg(va, SilcClientEntry);
- channel = va_arg(va, SilcChannelEntry);
+ (void)va_arg(ap, SilcClientEntry);
+ channel = va_arg(ap, SilcChannelEntry);
fprintf(stdout, "MyBot: Joined '%s' channel\n", channel->channel_name);
/* Now send the "hello" to the channel */
- silc_client_send_channel_message(client, conn, channel, NULL, 0,
- "hello", strlen("hello"), FALSE);
+ silc_client_send_channel_message(client, conn, channel, NULL, 0, NULL,
+ "hello", strlen("hello"));
fprintf(stdout, "MyBot: Sent 'hello' to channel\n");
- /* Now send digitally signed "hello" to the channel */
+ /* Now send digitally signed "hello" to the channel. We have to allocate
+ hash function for the signature process. */
+ silc_hash_alloc("sha1", &sha1hash);
silc_client_send_channel_message(client, conn, channel, NULL,
- SILC_MESSAGE_FLAG_SIGNED,
- "hello, with signature",
- strlen("hello, with signature"), FALSE);
+ SILC_MESSAGE_FLAG_SIGNED, sha1hash,
+ "hello, with signature",
+ strlen("hello, with signature"));
+ silc_hash_free(sha1hash);
fprintf(stdout, "MyBot: Sent 'hello, with signature' to channel\n");
}
-
- va_end(va);
}
-
-/* Called to indicate that connection was either successfully established
- or connecting failed. This is also the first time application receives
- the SilcClientConnection objecet which it should save somewhere.
- If the `success' is FALSE the application must always call the function
- silc_client_close_connection. */
-
-static void
-silc_connected(SilcClient client, SilcClientConnection conn,
- SilcClientConnectionStatus status)
-{
- MyBot mybot = client->application;
- SilcBuffer idp;
-
- if (status == SILC_CLIENT_CONN_ERROR) {
- fprintf(stderr, "MyBot: Could not connect to server\n");
- silc_client_close_connection(client, conn);
- return;
- }
-
- fprintf(stdout, "MyBot: Connected to server.\n");
-
- /* Save the connection context */
- mybot->conn = conn;
-
- /* Now that we are connected, join to mybot channel with JOIN command. */
- silc_client_command_call(client, conn, "JOIN mybot");
-}
-
-
-/* Called to indicate that connection was disconnected to the server.
- The `status' may tell the reason of the disconnection, and if the
- `message' is non-NULL it may include the disconnection message
- received from server. */
-
-static void
-silc_disconnected(SilcClient client, SilcClientConnection conn,
- SilcStatus status, const char *message)
-{
- MyBot mybot = client->application;
-
- /* We got disconnected from server */
- mybot->conn = NULL;
- fprintf(stdout, "MyBot: %s:%s\n", silc_get_status_message(status),
- message);
-}
-
-
/* Find authentication method and authentication data by hostname and
port. The hostname may be IP address as well. When the authentication
method has been resolved the `completion' callback with the found
static void
silc_get_auth_method(SilcClient client, SilcClientConnection conn,
char *hostname, SilcUInt16 port,
+ SilcAuthMethod auth_method,
SilcGetAuthMeth completion,
void *context)
{
/* MyBot assumes that there is no authentication requirement in the
server and sends nothing as authentication. We just reply with
TRUE, meaning we know what is the authentication method. :). */
- completion(TRUE, SILC_AUTH_NONE, NULL, 0, context);
+ completion(SILC_AUTH_NONE, NULL, 0, context);
}
static void
silc_verify_public_key(SilcClient client, SilcClientConnection conn,
- SilcSocketType conn_type, unsigned char *pk,
- SilcUInt32 pk_len, SilcSKEPKType pk_type,
+ SilcConnectionType conn_type,
+ SilcPublicKey public_key,
SilcVerifyPublicKey completion, void *context)
{
- /* MyBot is also very trusting, so we just accept the public key
- we get here. Of course, we would have to verify the authenticity
- of the public key but our bot is too simple for that. We just
- reply with TRUE, meaning "yeah, we trust it". :) */
+ fprintf(stdout, "MyBot: server's public key\n");
+ silc_show_public_key(public_key);
completion(TRUE, context);
}
}
-/* Notifies application that failure packet was received. This is called
- if there is some protocol active in the client. The `protocol' is the
- protocol context. The `failure' is opaque pointer to the failure
- indication. Note, that the `failure' is protocol dependant and
- application must explicitly cast it to correct type. Usually `failure'
- is 32 bit failure type (see protocol specs for all protocol failure
- types). */
-
-static void
-silc_failure(SilcClient client, SilcClientConnection conn,
- SilcProtocol protocol, void *failure)
-{
- /* Well, something bad must have happened during connecting to the
- server since we got here. Let's just print that something failed.
- The "failure" would include more information but let's not bother
- with that now. */
- fprintf(stderr, "MyBot: Connecting failed (protocol failure)\n");
-}
-
-
/* Asks whether the user would like to perform the key agreement protocol.
This is called after we have received an key agreement packet or an
reply to our key agreement packet. This returns TRUE if the user wants
silc_client_perform_key_agreement). If TRUE is returned also the
`completion' and `context' arguments must be set by the application. */
-static bool
+static void
silc_key_agreement(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, const char *hostname,
- SilcUInt16 port, SilcKeyAgreementCallback *completion,
- void **context)
+ SilcUInt16 protocol, SilcUInt16 port)
{
/* MyBot does not support incoming key agreement protocols, it's too
simple for that. */
- return FALSE;
}
}
-/* Delivers SILC session detachment data indicated by `detach_data' to the
- application. If application has issued SILC_COMMAND_DETACH command
- the client session in the SILC network is not quit. The client remains
- in the network but is detached. The detachment data may be used later
- to resume the session in the SILC Network. The appliation is
- responsible of saving the `detach_data', to for example in a file.
-
- The detachment data can be given as argument to the functions
- silc_client_connect_to_server, or silc_client_add_connection when
- creating connection to remote server, inside SilcClientConnectionParams
- structure. If it is provided the client library will attempt to resume
- the session in the network. After the connection is created
- successfully, the application is responsible of setting the user
- interface for user into the same state it was before detaching (showing
- same channels, channel modes, etc). It can do this by fetching the
- information (like joined channels) from the client library. */
-
-static void
-silc_detach(SilcClient client, SilcClientConnection conn,
- const unsigned char *detach_data, SilcUInt32 detach_data_len)
-{
- /* Oh, and MyBot does not support session detaching either. */
-}
-
/* Our client operations for the MyBot. This structure is filled with
functions and given as argument to the silc_client_alloc function.
Even though our little bot does not need all these functions we must
silc_notify,
silc_command,
silc_command_reply,
- silc_connected,
- silc_disconnected,
silc_get_auth_method,
silc_verify_public_key,
silc_ask_passphrase,
- silc_failure,
silc_key_agreement,
- silc_ftp,
- silc_detach
+ silc_ftp
};
int main(int argc, char **argv)
{
- /* Start the bot */
+ /* Start mybot */
return mybot_start();
}
-EXPORTS
- silc_argument_get_arg_num @ 1 ;
- silc_argument_get_arg_type @ 2 ;
- silc_argument_get_decoded @ 3 ;
- silc_argument_get_first_arg @ 4 ;
- silc_argument_get_next_arg @ 5 ;
- silc_argument_list_free @ 6 ;
- silc_argument_list_parse @ 7 ;
- silc_argument_list_parse_decoded @ 8 ;
- silc_argument_payload_encode @ 9 ;
- silc_argument_payload_encode_one @ 10 ;
- silc_argument_payload_encode_payload @ 11 ;
- silc_argument_payload_free @ 12 ;
- silc_argument_payload_parse @ 13 ;
- silc_command_get @ 14 ;
- silc_command_get_args @ 15 ;
- silc_command_get_ident @ 16 ;
- silc_command_get_status @ 17 ;
- silc_command_payload_encode @ 18 ;
- silc_command_payload_encode_payload @ 19 ;
- silc_command_payload_encode_va @ 20 ;
- silc_command_payload_encode_vap @ 21 ;
- silc_command_payload_free @ 22 ;
- silc_command_payload_parse @ 23 ;
- silc_command_reply_payload_encode_va @ 24 ;
- silc_command_reply_payload_encode_vap @ 25 ;
- silc_command_set_command @ 26 ;
- silc_command_set_ident @ 27 ;
- silc_auth_get_data @ 28 ;
- silc_auth_get_method @ 29 ;
- silc_auth_get_public_data @ 30 ;
- silc_auth_payload_encode @ 31 ;
- silc_auth_payload_free @ 32 ;
- silc_auth_payload_parse @ 33 ;
- silc_auth_public_key_auth_generate @ 34 ;
- silc_auth_public_key_auth_generate_wpub @ 35 ;
- silc_auth_public_key_auth_verify @ 36 ;
- silc_auth_public_key_auth_verify_data @ 37 ;
- silc_auth_verify @ 38 ;
- silc_auth_verify_data @ 39 ;
- silc_key_agreement_get_hostname @ 40 ;
- silc_key_agreement_get_port @ 41 ;
- silc_key_agreement_get_protocol @ 42 ;
- silc_key_agreement_payload_encode @ 43 ;
- silc_key_agreement_payload_free @ 44 ;
- silc_key_agreement_payload_parse @ 45 ;
- silc_id_dup @ 46 ;
- silc_id_get_len @ 47 ;
- silc_id_id2str @ 48 ;
- silc_id_payload_encode @ 49 ;
- silc_id_payload_encode_data @ 50 ;
- silc_id_payload_free @ 51 ;
- silc_id_payload_get_data @ 52 ;
- silc_id_payload_get_id @ 53 ;
- silc_id_payload_get_len @ 54 ;
- silc_id_payload_get_type @ 55 ;
- silc_id_payload_parse @ 56 ;
- silc_id_payload_parse_id @ 57 ;
- silc_id_str2id @ 58 ;
- silc_id_str2id2 @ 59 ;
- silc_attribute_get_attribute @ 60 ;
- silc_attribute_get_data @ 61 ;
- silc_attribute_get_flags @ 62 ;
- silc_attribute_get_object @ 63 ;
- silc_attribute_get_verify_data @ 64 ;
- silc_attribute_payload_alloc @ 65 ;
- silc_attribute_payload_encode @ 66 ;
- silc_attribute_payload_encode_data @ 67 ;
- silc_attribute_payload_free @ 68 ;
- silc_attribute_payload_list_free @ 69 ;
- silc_attribute_payload_parse @ 70 ;
- silc_channel_get_id @ 71 ;
- silc_channel_get_id_parse @ 72 ;
- silc_channel_get_mode @ 73 ;
- silc_channel_get_name @ 74 ;
- silc_channel_key_get_cipher @ 75 ;
- silc_channel_key_get_id @ 76 ;
- silc_channel_key_get_key @ 77 ;
- silc_channel_key_payload_encode @ 78 ;
- silc_channel_key_payload_free @ 79 ;
- silc_channel_key_payload_parse @ 80 ;
- silc_channel_payload_encode @ 81 ;
- silc_channel_payload_free @ 82 ;
- silc_channel_payload_list_free @ 83 ;
- silc_channel_payload_parse @ 84 ;
- silc_channel_payload_parse_list @ 85 ;
- silc_packet_engine_get_streams @ 86 ;
- silc_packet_engine_start @ 87 ;
- silc_packet_engine_stop @ 88 ;
- silc_packet_error_string @ 89 ;
- silc_packet_free @ 90 ;
- silc_packet_get_context @ 91 ;
- silc_packet_get_engine @ 92 ;
- silc_packet_get_ids @ 93 ;
- silc_packet_get_keys @ 94 ;
- silc_packet_get_sender @ 95 ;
- silc_packet_send @ 96 ;
- silc_packet_send_ext @ 97 ;
- silc_packet_send_va @ 98 ;
- silc_packet_send_va_ext @ 99 ;
- silc_packet_set_context @ 100 ;
- silc_packet_set_ids @ 101 ;
- silc_packet_set_keys @ 102 ;
- silc_packet_set_sid @ 103 ;
- silc_packet_stream_add_remote @ 104 ;
- silc_packet_stream_create @ 105 ;
- silc_packet_stream_destroy @ 106 ;
- silc_packet_stream_get_stream @ 107 ;
- silc_packet_stream_inject_packet @ 108 ;
- silc_packet_stream_is_udp @ 109 ;
- silc_packet_stream_is_valid @ 110 ;
- silc_packet_stream_link @ 111 ;
- silc_packet_stream_ref @ 112 ;
- silc_packet_stream_set_iv_included @ 113 ;
- silc_packet_stream_set_router @ 114 ;
- silc_packet_stream_set_stream @ 115 ;
- silc_packet_stream_unlink @ 116 ;
- silc_packet_stream_unref @ 117 ;
- silc_packet_stream_wrap @ 118 ;
- silc_packet_wait @ 119 ;
- silc_packet_wait_init @ 120 ;
- silc_packet_wait_uninit @ 121 ;
- silc_packet_wrap_close @ 122 ;
- silc_packet_wrap_destroy @ 123 ;
- silc_packet_wrap_get_schedule @ 124 ;
- silc_packet_wrap_notifier @ 125 ;
- silc_packet_wrap_read @ 126 ;
- silc_packet_wrap_read_more @ 127 ;
- silc_packet_wrap_write @ 128 ;
- silc_notify_get_arg_num @ 129 ;
- silc_notify_get_args @ 130 ;
- silc_notify_get_type @ 131 ;
- silc_notify_payload_encode @ 132 ;
- silc_notify_payload_encode_args @ 133 ;
- silc_notify_payload_free @ 134 ;
- silc_notify_payload_parse @ 135 ;
- silc_status_get_args @ 136 ;
- silc_message_get_data @ 137 ;
- silc_message_get_flags @ 138 ;
- silc_message_get_mac @ 139 ;
- silc_message_payload_decrypt @ 140 ;
- silc_message_payload_encode @ 141 ;
- silc_message_payload_encrypt @ 142 ;
- silc_message_payload_free @ 143 ;
- silc_message_payload_parse @ 144 ;
- silc_message_signed_get_public_key @ 145 ;
- silc_message_signed_verify @ 146 ;
- silc_public_key_payload_decode @ 147 ;
- silc_public_key_payload_encode @ 148 ;
- silc_file_set_nonblock @ 149 ;
- silc_get_real_name @ 150 ;
- silc_get_username @ 151 ;
- silc_gettimeofday @ 152 ;
- silc_cond_alloc @ 153 ;
- silc_cond_broadcast @ 154 ;
- silc_cond_free @ 155 ;
- silc_cond_signal @ 156 ;
- silc_cond_timedwait @ 157 ;
- silc_cond_wait @ 158 ;
- silc_mutex_alloc @ 159 ;
- silc_mutex_assert_locked @ 160 ;
- silc_mutex_free @ 161 ;
- silc_mutex_lock @ 162 ;
- silc_mutex_unlock @ 163 ;
- silc_rwlock_alloc @ 164 ;
- silc_rwlock_free @ 165 ;
- silc_rwlock_rdlock @ 166 ;
- silc_rwlock_unlock @ 167 ;
- silc_rwlock_wrlock @ 168 ;
- silc_thread_create @ 169 ;
- silc_thread_exit @ 170 ;
- silc_thread_self @ 171 ;
- silc_thread_wait @ 172 ;
- silc_thread_yield @ 173 ;
- silc_socket_stream_close @ 174 ;
- silc_socket_stream_destroy @ 175 ;
- silc_socket_stream_notifier @ 176 ;
- silc_socket_stream_read @ 177 ;
- silc_socket_stream_write @ 178 ;
- silc_socket_udp_stream_read @ 179 ;
- silc_socket_udp_stream_write @ 180 ;
- silc_net_accept @ 181 ;
- silc_net_addr2bin @ 182 ;
- silc_net_close_connection @ 183 ;
- silc_net_close_listener @ 184 ;
- silc_net_set_socket_nonblock @ 185 ;
- silc_net_tcp_connect @ 186 ;
- silc_net_tcp_create_listener @ 187 ;
- silc_net_udp_connect @ 188 ;
- silc_net_udp_receive @ 189 ;
- silc_net_udp_send @ 190 ;
- silc_schedule_internal_init @ 191 ;
- silc_schedule_internal_schedule_fd @ 192 ;
- silc_schedule_internal_signal_register @ 193 ;
- silc_schedule_internal_signal_unregister @ 194 ;
- silc_schedule_internal_signals_block @ 195 ;
- silc_schedule_internal_signals_call @ 196 ;
- silc_schedule_internal_signals_unblock @ 197 ;
- silc_schedule_internal_uninit @ 198 ;
- silc_schedule_internal_wakeup @ 199 ;
- silc_fd_stream_close @ 200 ;
- silc_fd_stream_create @ 201 ;
- silc_fd_stream_create2 @ 202 ;
- silc_fd_stream_destroy @ 203 ;
- silc_fd_stream_file @ 204 ;
- silc_fd_stream_file2 @ 205 ;
- silc_fd_stream_get_error @ 206 ;
- silc_fd_stream_get_info @ 207 ;
- silc_fd_stream_get_schedule @ 208 ;
- silc_fd_stream_notifier @ 209 ;
- silc_fd_stream_read @ 210 ;
- silc_fd_stream_write @ 211 ;
- silc_hash_table_add @ 212 ;
- silc_hash_table_add_ext @ 213 ;
- silc_hash_table_alloc @ 214 ;
- silc_hash_table_count @ 215 ;
- silc_hash_table_del @ 216 ;
- silc_hash_table_del_by_context @ 217 ;
- silc_hash_table_del_by_context_ext @ 218 ;
- silc_hash_table_del_ext @ 219 ;
- silc_hash_table_find @ 220 ;
- silc_hash_table_find_by_context @ 221 ;
- silc_hash_table_find_by_context_ext @ 222 ;
- silc_hash_table_find_ext @ 223 ;
- silc_hash_table_find_foreach @ 224 ;
- silc_hash_table_find_foreach_ext @ 225 ;
- silc_hash_table_foreach @ 226 ;
- silc_hash_table_free @ 227 ;
- silc_hash_table_get @ 228 ;
- silc_hash_table_list @ 229 ;
- silc_hash_table_list_reset @ 230 ;
- silc_hash_table_rehash @ 231 ;
- silc_hash_table_rehash_ext @ 232 ;
- silc_hash_table_replace @ 233 ;
- silc_hash_table_replace_ext @ 234 ;
- silc_hash_table_size @ 235 ;
- silc_schedule @ 236 ;
- silc_schedule_get_context @ 237 ;
- silc_schedule_get_fd_events @ 238 ;
- silc_schedule_init @ 239 ;
- silc_schedule_one @ 240 ;
- silc_schedule_set_listen_fd @ 241 ;
- silc_schedule_stop @ 242 ;
- silc_schedule_task_add @ 243 ;
- silc_schedule_task_del @ 244 ;
- silc_schedule_task_del_by_all @ 245 ;
- silc_schedule_task_del_by_callback @ 246 ;
- silc_schedule_task_del_by_context @ 247 ;
- silc_schedule_task_del_by_fd @ 248 ;
- silc_schedule_uninit @ 249 ;
- silc_schedule_unset_listen_fd @ 250 ;
- silc_schedule_wakeup @ 251 ;
- silc_calloc @ 252 ;
- silc_free @ 253 ;
- silc_malloc @ 254 ;
- silc_memdup @ 255 ;
- silc_realloc @ 256 ;
- silc_scalloc @ 257 ;
- silc_smalloc @ 258 ;
- silc_smalloc_ua @ 259 ;
- silc_smemdup @ 260 ;
- silc_srealloc @ 261 ;
- silc_srealloc_ua @ 262 ;
- silc_sstrdup @ 263 ;
- silc_config_close @ 264 ;
- silc_config_get_filename @ 265 ;
- silc_config_get_line @ 266 ;
- silc_config_init @ 267 ;
- silc_config_main @ 268 ;
- silc_config_open @ 269 ;
- silc_config_read_current_line @ 270 ;
- silc_config_read_line @ 271 ;
- silc_config_register @ 272 ;
- silc_config_register_table @ 273 ;
- silc_config_strerror @ 274 ;
- silc_log_debug @ 275 ;
- silc_log_debug_hexdump @ 276 ;
- silc_log_fflush_callback @ 277 ;
- silc_log_flush_all @ 278 ;
- silc_log_flushdelay @ 279 ;
- silc_log_get_file @ 280 ;
- silc_log_output @ 281 ;
- silc_log_output_debug @ 282 ;
- silc_log_output_hexdump @ 283 ;
- silc_log_quick @ 284 ;
- silc_log_reset_all @ 285 ;
- silc_log_reset_callbacks @ 286 ;
- silc_log_reset_debug_callbacks @ 287 ;
- silc_log_set_callback @ 288 ;
- silc_log_set_debug_callbacks @ 289 ;
- silc_log_set_debug_string @ 290 ;
- silc_log_set_file @ 291 ;
- silc_log_timestamp @ 292 ;
- silc_net_accept_connection @ 293 ;
- silc_net_check_host_by_sock @ 294 ;
- silc_net_check_local_by_sock @ 295 ;
- silc_net_get_error_string @ 296 ;
- silc_net_get_local_port @ 297 ;
- silc_net_get_remote_port @ 298 ;
- silc_net_get_socket_opt @ 299 ;
- silc_net_gethostbyaddr @ 300 ;
- silc_net_gethostbyaddr_async @ 301 ;
- silc_net_gethostbyname @ 302 ;
- silc_net_gethostbyname_async @ 303 ;
- silc_net_is_ip @ 304 ;
- silc_net_is_ip4 @ 305 ;
- silc_net_is_ip6 @ 306 ;
- silc_net_listener_get_hostname @ 307 ;
- silc_net_listener_get_ip @ 308 ;
- silc_net_listener_get_port @ 309 ;
- silc_net_localhost @ 310 ;
- silc_net_localip @ 311 ;
- silc_net_resolve_completion @ 312 ;
- silc_net_set_socket_opt @ 313 ;
- silc_stringprep @ 314 ;
- silc_socket_host_lookup_finish @ 315 ;
- silc_socket_stream_get_error @ 316 ;
- silc_socket_stream_get_info @ 317 ;
- silc_socket_stream_get_schedule @ 318 ;
- silc_socket_stream_is_udp @ 319 ;
- silc_socket_stream_set_info @ 320 ;
- silc_socket_stream_set_qos @ 321 ;
- silc_socket_tcp_stream_create @ 322 ;
- silc_socket_udp_stream_create @ 323 ;
- silc_compare_timeval @ 324 ;
- silc_time @ 325 ;
- silc_time_generalized @ 326 ;
- silc_time_generalized_string @ 327 ;
- silc_time_msec @ 328 ;
- silc_time_string @ 329 ;
- silc_time_universal @ 330 ;
- silc_time_universal_string @ 331 ;
- silc_time_usec @ 332 ;
- silc_time_value @ 333 ;
- silc_timezone @ 334 ;
- silc_file_close @ 335 ;
- silc_file_open @ 336 ;
- silc_file_open_mode @ 337 ;
- silc_file_read @ 338 ;
- silc_file_readfile @ 339 ;
- silc_file_size @ 340 ;
- silc_file_write @ 341 ;
- silc_file_writefile @ 342 ;
- silc_file_writefile_mode @ 343 ;
- silc_check_line @ 344 ;
- silc_fingerprint @ 345 ;
- silc_format @ 346 ;
- silc_get_input @ 347 ;
- silc_gets @ 348 ;
- silc_hash_client_id_compare @ 349 ;
- silc_hash_client_id_hash @ 350 ;
- silc_hash_data @ 351 ;
- silc_hash_data_compare @ 352 ;
- silc_hash_id @ 353 ;
- silc_hash_id_compare @ 354 ;
- silc_hash_id_compare_full @ 355 ;
- silc_hash_ptr @ 356 ;
- silc_hash_public_key @ 357 ;
- silc_hash_public_key_compare @ 358 ;
- silc_hash_string @ 359 ;
- silc_hash_string_compare @ 360 ;
- silc_hash_uint @ 361 ;
- silc_hash_utf8_compare @ 362 ;
- silc_hash_utf8_string @ 363 ;
- silc_parse_command_line @ 364 ;
- silc_parse_userfqdn @ 365 ;
- silc_string_is_ascii @ 366 ;
- silc_to_lower @ 367 ;
- silc_to_upper @ 368 ;
- silc_utf8_decode @ 369 ;
- silc_utf8_decoded_len @ 370 ;
- silc_utf8_encode @ 371 ;
- silc_utf8_encoded_len @ 372 ;
- silc_utf8_strcasecmp @ 373 ;
- silc_utf8_strncasecmp @ 374 ;
- silc_utf8_valid @ 375 ;
- silc_base64_decode @ 376 ;
- silc_base64_encode @ 377 ;
- silc_base64_encode_file @ 378 ;
- silc_string_compare @ 379 ;
- silc_string_match @ 380 ;
- silc_string_regex_combine @ 381 ;
- silc_string_regex_match @ 382 ;
- silc_string_regexify @ 383 ;
- silc_string_split @ 384 ;
- silc_strncat @ 385 ;
- silc_fsm_alloc @ 386 ;
- silc_fsm_continue @ 387 ;
- silc_fsm_continue_sync @ 388 ;
- silc_fsm_event_alloc @ 389 ;
- silc_fsm_event_free @ 390 ;
- silc_fsm_event_init @ 391 ;
- silc_fsm_event_signal @ 392 ;
- silc_fsm_event_timedwait @ 393 ;
- silc_fsm_event_wait @ 394 ;
- silc_fsm_finish @ 395 ;
- silc_fsm_free @ 396 ;
- silc_fsm_get_context @ 397 ;
- silc_fsm_get_machine @ 398 ;
- silc_fsm_get_schedule @ 399 ;
- silc_fsm_get_state_context @ 400 ;
- silc_fsm_init @ 401 ;
- silc_fsm_is_started @ 402 ;
- silc_fsm_next @ 403 ;
- silc_fsm_next_later @ 404 ;
- silc_fsm_set_context @ 405 ;
- silc_fsm_set_state_context @ 406 ;
- silc_fsm_signal @ 407 ;
- silc_fsm_start @ 408 ;
- silc_fsm_start_sync @ 409 ;
- silc_fsm_thread @ 410 ;
- silc_fsm_thread_alloc @ 411 ;
- silc_fsm_thread_init @ 412 ;
- silc_fsm_thread_wait @ 413 ;
- silc_buffer_format @ 414 ;
- silc_buffer_format_vp @ 415 ;
- silc_buffer_sformat @ 416 ;
- silc_buffer_sformat_vp @ 417 ;
- silc_buffer_sstrformat @ 418 ;
- silc_buffer_strformat @ 419 ;
- silc_buffer_sunformat @ 420 ;
- silc_buffer_sunformat_vp @ 421 ;
- silc_buffer_unformat @ 422 ;
- silc_buffer_unformat_vp @ 423 ;
- silc_stream_close @ 424 ;
- silc_stream_destroy @ 425 ;
- silc_stream_get_schedule @ 426 ;
- silc_stream_read @ 427 ;
- silc_stream_set_notifier @ 428 ;
- silc_stream_write @ 429 ;
- silc_async_abort @ 430 ;
- silc_async_alloc @ 431 ;
- silc_async_free @ 432 ;
- silc_async_get_context @ 433 ;
- silc_async_halt @ 434 ;
- silc_async_init @ 435 ;
- silc_async_resume @ 436 ;
- silc_asprintf @ 437 ;
- silc_snprintf @ 438 ;
- silc_vasprintf @ 439 ;
- silc_vsnprintf @ 440 ;
- silc_mime_add_data @ 441 ;
- silc_mime_add_field @ 442 ;
- silc_mime_add_multipart @ 443 ;
- silc_mime_alloc @ 444 ;
- silc_mime_assemble @ 445 ;
- silc_mime_assembler_alloc @ 446 ;
- silc_mime_assembler_free @ 447 ;
- silc_mime_decode @ 448 ;
- silc_mime_encode @ 449 ;
- silc_mime_encode_partial @ 450 ;
- silc_mime_free @ 451 ;
- silc_mime_get_data @ 452 ;
- silc_mime_get_field @ 453 ;
- silc_mime_get_multiparts @ 454 ;
- silc_mime_is_multipart @ 455 ;
- silc_mime_is_partial @ 456 ;
- silc_mime_partial_free @ 457 ;
- silc_mime_set_multipart @ 458 ;
- silc_mime_steal_data @ 459 ;
- silc_idcache_add @ 460 ;
- silc_idcache_alloc @ 461 ;
- silc_idcache_del @ 462 ;
- silc_idcache_del_by_context @ 463 ;
- silc_idcache_del_by_id @ 464 ;
- silc_idcache_find_by_context @ 465 ;
- silc_idcache_find_by_id @ 466 ;
- silc_idcache_find_by_id_one @ 467 ;
- silc_idcache_find_by_name @ 468 ;
- silc_idcache_find_by_name_one @ 469 ;
- silc_idcache_free @ 470 ;
- silc_idcache_get_all @ 471 ;
- silc_idcache_update @ 472 ;
- silc_idcache_update_by_context @ 473 ;
- silc_change_private_key_passphrase @ 474 ;
- silc_channel_name_check @ 475 ;
- silc_channel_name_verify @ 476 ;
- silc_client_chmode @ 477 ;
- silc_client_chumode @ 478 ;
- silc_client_chumode_char @ 479 ;
- silc_create_key_pair @ 480 ;
- silc_get_command_name @ 481 ;
- silc_get_mode_list @ 482 ;
- silc_get_packet_name @ 483 ;
- silc_get_status_message @ 484 ;
- silc_id_render @ 485 ;
- silc_identifier_check @ 486 ;
- silc_identifier_verify @ 487 ;
- silc_load_key_pair @ 488 ;
- silc_parse_version_string @ 489 ;
- silc_show_public_key @ 490 ;
- silc_show_public_key_file @ 491 ;
- silc_version_to_num @ 492 ;
- silc_rc5_cbc_context_len @ 493 ;
- silc_rc5_cbc_decrypt @ 494 ;
- silc_rc5_cbc_encrypt @ 495 ;
- silc_rc5_cbc_set_iv @ 496 ;
- silc_rc5_cbc_set_key @ 497 ;
- silc_sha256_context_len @ 498 ;
- silc_sha256_final @ 499 ;
- silc_sha256_init @ 500 ;
- silc_sha256_transform @ 501 ;
- silc_sha256_update @ 502 ;
- silc_none_context_len @ 503 ;
- silc_none_decrypt @ 504 ;
- silc_none_encrypt @ 505 ;
- silc_none_set_iv @ 506 ;
- silc_none_set_key @ 507 ;
- silc_sha1_context_len @ 508 ;
- silc_sha1_final @ 509 ;
- silc_sha1_init @ 510 ;
- silc_sha1_transform @ 511 ;
- silc_sha1_update @ 512 ;
- silc_pkcs_algorithm_register @ 513 ;
- silc_pkcs_algorithm_unregister @ 514 ;
- silc_pkcs_decrypt @ 515 ;
- silc_pkcs_encrypt @ 516 ;
- silc_pkcs_find_algorithm @ 517 ;
- silc_pkcs_find_pkcs @ 518 ;
- silc_pkcs_get_algorithm @ 519 ;
- silc_pkcs_get_context @ 520 ;
- silc_pkcs_get_name @ 521 ;
- silc_pkcs_get_pkcs @ 522 ;
- silc_pkcs_get_supported @ 523 ;
- silc_pkcs_get_type @ 524 ;
- silc_pkcs_load_private_key @ 525 ;
- silc_pkcs_load_public_key @ 526 ;
- silc_pkcs_private_key_alloc @ 527 ;
- silc_pkcs_private_key_free @ 528 ;
- silc_pkcs_private_key_get_len @ 529 ;
- silc_pkcs_public_key_alloc @ 530 ;
- silc_pkcs_public_key_compare @ 531 ;
- silc_pkcs_public_key_copy @ 532 ;
- silc_pkcs_public_key_encode @ 533 ;
- silc_pkcs_public_key_free @ 534 ;
- silc_pkcs_public_key_get_len @ 535 ;
- silc_pkcs_register @ 536 ;
- silc_pkcs_register_default @ 537 ;
- silc_pkcs_save_private_key @ 538 ;
- silc_pkcs_save_public_key @ 539 ;
- silc_pkcs_sign @ 540 ;
- silc_pkcs_unregister @ 541 ;
- silc_pkcs_unregister_all @ 542 ;
- silc_pkcs_verify @ 543 ;
- silc_hash_alloc @ 544 ;
- silc_hash_alloc_by_oid @ 545 ;
- silc_hash_babbleprint @ 546 ;
- silc_hash_block_len @ 547 ;
- silc_hash_final @ 548 ;
- silc_hash_fingerprint @ 549 ;
- silc_hash_free @ 550 ;
- silc_hash_get_name @ 551 ;
- silc_hash_get_oid @ 552 ;
- silc_hash_get_supported @ 553 ;
- silc_hash_init @ 554 ;
- silc_hash_is_supported @ 555 ;
- silc_hash_len @ 556 ;
- silc_hash_make @ 557 ;
- silc_hash_register @ 558 ;
- silc_hash_register_default @ 559 ;
- silc_hash_transform @ 560 ;
- silc_hash_unregister @ 561 ;
- silc_hash_unregister_all @ 562 ;
- silc_hash_update @ 563 ;
- silc_aes_cbc_context_len @ 564 ;
- silc_aes_cbc_decrypt @ 565 ;
- silc_aes_cbc_encrypt @ 566 ;
- silc_aes_cbc_set_iv @ 567 ;
- silc_aes_cbc_set_key @ 568 ;
- silc_aes_ctr_context_len @ 569 ;
- silc_aes_ctr_decrypt @ 570 ;
- silc_aes_ctr_encrypt @ 571 ;
- silc_aes_ctr_set_iv @ 572 ;
- silc_aes_ctr_set_key @ 573 ;
- silc_pkcs1_decode @ 574 ;
- silc_pkcs1_decrypt @ 575 ;
- silc_pkcs1_encode @ 576 ;
- silc_pkcs1_encrypt @ 577 ;
- silc_pkcs1_export_private_key @ 578 ;
- silc_pkcs1_export_public_key @ 579 ;
- silc_pkcs1_generate_key @ 580 ;
- silc_pkcs1_import_private_key @ 581 ;
- silc_pkcs1_import_public_key @ 582 ;
- silc_pkcs1_private_key_bitlen @ 583 ;
- silc_pkcs1_private_key_free @ 584 ;
- silc_pkcs1_public_key_bitlen @ 585 ;
- silc_pkcs1_public_key_compare @ 586 ;
- silc_pkcs1_public_key_copy @ 587 ;
- silc_pkcs1_public_key_free @ 588 ;
- silc_pkcs1_sign @ 589 ;
- silc_pkcs1_sign_no_oid @ 590 ;
- silc_pkcs1_verify @ 591 ;
- silc_pkcs1_verify_no_oid @ 592 ;
- silc_cast_cbc_context_len @ 593 ;
- silc_cast_cbc_decrypt @ 594 ;
- silc_cast_cbc_encrypt @ 595 ;
- silc_cast_cbc_set_iv @ 596 ;
- silc_cast_cbc_set_key @ 597 ;
- silc_cipher_alloc @ 598 ;
- silc_cipher_decrypt @ 599 ;
- silc_cipher_encrypt @ 600 ;
- silc_cipher_free @ 601 ;
- silc_cipher_get_block_len @ 602 ;
- silc_cipher_get_iv @ 603 ;
- silc_cipher_get_iv_len @ 604 ;
- silc_cipher_get_key_len @ 605 ;
- silc_cipher_get_mode @ 606 ;
- silc_cipher_get_name @ 607 ;
- silc_cipher_get_supported @ 608 ;
- silc_cipher_is_supported @ 609 ;
- silc_cipher_register @ 610 ;
- silc_cipher_register_default @ 611 ;
- silc_cipher_set_iv @ 612 ;
- silc_cipher_set_key @ 613 ;
- silc_cipher_unregister @ 614 ;
- silc_cipher_unregister_all @ 615 ;
- silc_md5_context_len @ 616 ;
- silc_md5_final @ 617 ;
- silc_md5_init @ 618 ;
- silc_md5_transform @ 619 ;
- silc_md5_update @ 620 ;
- silc_rsa_generate_keys @ 621 ;
- silc_rsa_private_operation @ 622 ;
- silc_rsa_public_operation @ 623 ;
- silc_blowfish_cbc_context_len @ 624 ;
- silc_blowfish_cbc_decrypt @ 625 ;
- silc_blowfish_cbc_encrypt @ 626 ;
- silc_blowfish_cbc_set_iv @ 627 ;
- silc_blowfish_cbc_set_key @ 628 ;
- silc_twofish_cbc_context_len @ 629 ;
- silc_twofish_cbc_decrypt @ 630 ;
- silc_twofish_cbc_encrypt @ 631 ;
- silc_twofish_cbc_set_iv @ 632 ;
- silc_twofish_cbc_set_key @ 633 ;
- silc_hmac_alloc @ 634 ;
- silc_hmac_final @ 635 ;
- silc_hmac_free @ 636 ;
- silc_hmac_get_hash @ 637 ;
- silc_hmac_get_key @ 638 ;
- silc_hmac_get_name @ 639 ;
- silc_hmac_get_supported @ 640 ;
- silc_hmac_init @ 641 ;
- silc_hmac_init_with_key @ 642 ;
- silc_hmac_is_supported @ 643 ;
- silc_hmac_len @ 644 ;
- silc_hmac_make @ 645 ;
- silc_hmac_make_truncated @ 646 ;
- silc_hmac_make_with_key @ 647 ;
- silc_hmac_register @ 648 ;
- silc_hmac_register_default @ 649 ;
- silc_hmac_set_key @ 650 ;
- silc_hmac_unregister @ 651 ;
- silc_hmac_unregister_all @ 652 ;
- silc_hmac_update @ 653 ;
- silc_rng_add_noise @ 654 ;
- silc_rng_alloc @ 655 ;
- silc_rng_free @ 656 ;
- silc_rng_get_byte @ 657 ;
- silc_rng_get_byte_fast @ 658 ;
- silc_rng_get_rn16 @ 659 ;
- silc_rng_get_rn32 @ 660 ;
- silc_rng_get_rn_data @ 661 ;
- silc_rng_get_rn_string @ 662 ;
- silc_rng_global_add_noise @ 663 ;
- silc_rng_global_get_byte @ 664 ;
- silc_rng_global_get_byte_fast @ 665 ;
- silc_rng_global_get_rn16 @ 666 ;
- silc_rng_global_get_rn32 @ 667 ;
- silc_rng_global_get_rn_data @ 668 ;
- silc_rng_global_get_rn_string @ 669 ;
- silc_rng_global_init @ 670 ;
- silc_rng_global_uninit @ 671 ;
- silc_rng_init @ 672 ;
- silc_pkcs_silc_decode_identifier @ 673 ;
- silc_pkcs_silc_decrypt @ 674 ;
- silc_pkcs_silc_encode_identifier @ 675 ;
- silc_pkcs_silc_encrypt @ 676 ;
- silc_pkcs_silc_export_private_key @ 677 ;
- silc_pkcs_silc_export_private_key_file @ 678 ;
- silc_pkcs_silc_export_public_key @ 679 ;
- silc_pkcs_silc_export_public_key_file @ 680 ;
- silc_pkcs_silc_generate_key @ 681 ;
- silc_pkcs_silc_get_algorithm @ 682 ;
- silc_pkcs_silc_import_private_key @ 683 ;
- silc_pkcs_silc_import_private_key_file @ 684 ;
- silc_pkcs_silc_import_public_key @ 685 ;
- silc_pkcs_silc_import_public_key_file @ 686 ;
- silc_pkcs_silc_private_key_bitlen @ 687 ;
- silc_pkcs_silc_private_key_free @ 688 ;
- silc_pkcs_silc_public_key_bitlen @ 689 ;
- silc_pkcs_silc_public_key_compare @ 690 ;
- silc_pkcs_silc_public_key_copy @ 691 ;
- silc_pkcs_silc_public_key_free @ 692 ;
- silc_pkcs_silc_public_key_version @ 693 ;
- silc_pkcs_silc_sign @ 694 ;
- silc_pkcs_silc_verify @ 695 ;
- silc_skr_add_public_key @ 696 ;
- silc_skr_add_public_key_simple @ 697 ;
- silc_skr_alloc @ 698 ;
- silc_skr_del_public_key @ 699 ;
- silc_skr_find @ 700 ;
- silc_skr_find_alloc @ 701 ;
- silc_skr_find_free @ 702 ;
- silc_skr_find_set_context @ 703 ;
- silc_skr_find_set_country @ 704 ;
- silc_skr_find_set_email @ 705 ;
- silc_skr_find_set_host @ 706 ;
- silc_skr_find_set_org @ 707 ;
- silc_skr_find_set_pkcs_type @ 708 ;
- silc_skr_find_set_public_key @ 709 ;
- silc_skr_find_set_realname @ 710 ;
- silc_skr_find_set_usage @ 711 ;
- silc_skr_find_set_username @ 712 ;
- silc_skr_free @ 713 ;
- silc_skr_init @ 714 ;
- silc_skr_ref_public_key @ 715 ;
- silc_skr_uninit @ 716 ;
- silc_skr_unref_public_key @ 717 ;
- silc_mp_abs @ 718 ;
- silc_mp_add @ 719 ;
- silc_mp_add_ui @ 720 ;
- silc_mp_and @ 721 ;
- silc_mp_cmp @ 722 ;
- silc_mp_cmp_si @ 723 ;
- silc_mp_cmp_ui @ 724 ;
- silc_mp_div @ 725 ;
- silc_mp_div_2exp @ 726 ;
- silc_mp_div_2exp_qr @ 727 ;
- silc_mp_div_qr @ 728 ;
- silc_mp_div_ui @ 729 ;
- silc_mp_gcd @ 730 ;
- silc_mp_gcdext @ 731 ;
- silc_mp_get_str @ 732 ;
- silc_mp_get_ui @ 733 ;
- silc_mp_init @ 734 ;
- silc_mp_mod @ 735 ;
- silc_mp_mod_2exp @ 736 ;
- silc_mp_mod_ui @ 737 ;
- silc_mp_mul @ 738 ;
- silc_mp_mul_2exp @ 739 ;
- silc_mp_mul_ui @ 740 ;
- silc_mp_neg @ 741 ;
- silc_mp_or @ 742 ;
- silc_mp_pow @ 743 ;
- silc_mp_pow_mod @ 744 ;
- silc_mp_pow_mod_ui @ 745 ;
- silc_mp_pow_ui @ 746 ;
- silc_mp_set @ 747 ;
- silc_mp_set_si @ 748 ;
- silc_mp_set_str @ 749 ;
- silc_mp_set_ui @ 750 ;
- silc_mp_sinit @ 751 ;
- silc_mp_size @ 752 ;
- silc_mp_sizeinbase @ 753 ;
- silc_mp_sqrt @ 754 ;
- silc_mp_sub @ 755 ;
- silc_mp_sub_ui @ 756 ;
- silc_mp_uninit @ 757 ;
- silc_mp_xor @ 758 ;
- silc_math_gen_prime @ 759 ;
- silc_math_prime_test @ 760 ;
- silc_mp_bin2mp @ 761 ;
- silc_mp_mp2bin @ 762 ;
- silc_mp_mp2bin_noalloc @ 763 ;
- silc_mp_modinv @ 764 ;
- silc_asn1_encode @ 772 ;
- silc_asn1_alloc @ 773 ;
- silc_asn1_free @ 775 ;
- silc_asn1_init @ 776 ;
- silc_asn1_uninit @ 778 ;
- silc_asn1_decode @ 779 ;
- silc_ber_decode @ 780 ;
- silc_ber_encode @ 781 ;
- silc_ber_encoded_len @ 782 ;
- silc_connauth_alloc @ 783 ;
- silc_connauth_free @ 784 ;
- silc_connauth_get_ske @ 785 ;
- silc_connauth_initiator @ 786 ;
- silc_connauth_responder @ 787 ;
- silc_connauth_timeout @ 788 ;
- silc_ske_alloc @ 789 ;
- silc_ske_free @ 790 ;
- silc_ske_free_key_material @ 791 ;
- silc_ske_free_rekey_material @ 792 ;
- silc_ske_get_context @ 793 ;
- silc_ske_get_key_material @ 794 ;
- silc_ske_get_security_properties @ 795 ;
- silc_ske_initiator @ 796 ;
- silc_ske_map_status @ 797 ;
- silc_ske_packet_send_retry @ 798 ;
- silc_ske_parse_version @ 799 ;
- silc_ske_process_key_material @ 800 ;
- silc_ske_process_key_material_data @ 801 ;
- silc_ske_rekey_initiator @ 802 ;
- silc_ske_rekey_responder @ 803 ;
- silc_ske_responder @ 804 ;
- silc_ske_set_callbacks @ 805 ;
- silc_ske_set_keys @ 806 ;
- silc_ske_payload_ke_decode @ 807 ;
- silc_ske_payload_ke_encode @ 808 ;
- silc_ske_payload_ke_free @ 809 ;
- silc_ske_payload_start_decode @ 810 ;
- silc_ske_payload_start_encode @ 811 ;
- silc_ske_payload_start_free @ 812 ;
- silc_ske_get_supported_groups @ 813 ;
- silc_ske_group_free @ 814 ;
- silc_ske_group_get_by_name @ 815 ;
- silc_ske_group_get_by_number @ 816 ;
- silc_ske_group_get_name @ 817 ;
- silc_ske_group_get_number @ 818 ;
- silc_http_php @ 819 ;
- silc_http_php_file @ 820 ;
- silc_http_server_add_header @ 821 ;
- silc_http_server_alloc @ 822 ;
- silc_http_server_free @ 823 ;
- silc_http_server_get_header @ 824 ;
- silc_http_server_send @ 825 ;
- silc_http_server_send_error @ 826 ;
- silc_sftp_fs_memory_add_dir @ 827 ;
- silc_sftp_fs_memory_add_file @ 828 ;
- silc_sftp_fs_memory_alloc @ 829 ;
- silc_sftp_fs_memory_del_dir @ 830 ;
- silc_sftp_fs_memory_del_file @ 831 ;
- silc_sftp_fs_memory_free @ 832 ;
- silc_sftp_attr_decode @ 833 ;
- silc_sftp_attr_encode @ 834 ;
- silc_sftp_attr_free @ 835 ;
- silc_sftp_map_errno @ 836 ;
- silc_sftp_name_add @ 837 ;
- silc_sftp_name_decode @ 838 ;
- silc_sftp_name_encode @ 839 ;
- silc_sftp_name_free @ 840 ;
- silc_sftp_packet_decode @ 841 ;
- silc_sftp_packet_encode @ 842 ;
- silc_sftp_packet_encode_vp @ 843 ;
- silc_sftp_client_shutdown @ 844 ;
- silc_sftp_client_start @ 845 ;
- silc_sftp_close @ 846 ;
- silc_sftp_extended @ 847 ;
- silc_sftp_fsetstat @ 848 ;
- silc_sftp_fstat @ 849 ;
- silc_sftp_lstat @ 850 ;
- silc_sftp_mkdir @ 851 ;
- silc_sftp_open @ 852 ;
- silc_sftp_opendir @ 853 ;
- silc_sftp_read @ 854 ;
- silc_sftp_readdir @ 855 ;
- silc_sftp_readlink @ 856 ;
- silc_sftp_realpath @ 857 ;
- silc_sftp_remove @ 858 ;
- silc_sftp_rename @ 859 ;
- silc_sftp_rmdir @ 860 ;
- silc_sftp_setstat @ 861 ;
- silc_sftp_stat @ 862 ;
- silc_sftp_symlink @ 863 ;
- silc_sftp_write @ 864 ;
- silc_sftp_server_set_monitor @ 865 ;
- silc_sftp_server_shutdown @ 866 ;
- silc_sftp_server_start @ 867 ;
- silc_vcard_alloc @ 868 ;
- silc_vcard_decode @ 869 ;
- silc_vcard_encode @ 870 ;
- silc_vcard_fprintf @ 871 ;
- silc_vcard_free @ 872 ;
- silc_utf8_c2w @ 873 ;
- silc_utf8_w2c @ 874 ;
-
+EXPORTS\r
+ silc_argument_get_arg_num @ 1 ;\r
+ silc_argument_get_arg_type @ 2 ;\r
+ silc_argument_get_decoded @ 3 ;\r
+ silc_argument_get_first_arg @ 4 ;\r
+ silc_argument_get_next_arg @ 5 ;\r
+ silc_argument_list_free @ 6 ;\r
+ silc_argument_list_parse @ 7 ;\r
+ silc_argument_list_parse_decoded @ 8 ;\r
+ silc_argument_payload_encode @ 9 ;\r
+ silc_argument_payload_encode_one @ 10 ;\r
+ silc_argument_payload_encode_payload @ 11 ;\r
+ silc_argument_payload_free @ 12 ;\r
+ silc_argument_payload_parse @ 13 ;\r
+ silc_command_get @ 14 ;\r
+ silc_command_get_args @ 15 ;\r
+ silc_command_get_ident @ 16 ;\r
+ silc_command_get_status @ 17 ;\r
+ silc_command_payload_encode @ 18 ;\r
+ silc_command_payload_encode_payload @ 19 ;\r
+ silc_command_payload_encode_va @ 20 ;\r
+ silc_command_payload_encode_vap @ 21 ;\r
+ silc_command_payload_free @ 22 ;\r
+ silc_command_payload_parse @ 23 ;\r
+ silc_command_reply_payload_encode_va @ 24 ;\r
+ silc_command_reply_payload_encode_vap @ 25 ;\r
+ silc_command_set_command @ 26 ;\r
+ silc_command_set_ident @ 27 ;\r
+ silc_auth_get_data @ 28 ;\r
+ silc_auth_get_method @ 29 ;\r
+ silc_auth_get_public_data @ 30 ;\r
+ silc_auth_payload_encode @ 31 ;\r
+ silc_auth_payload_free @ 32 ;\r
+ silc_auth_payload_parse @ 33 ;\r
+ silc_auth_public_key_auth_generate @ 34 ;\r
+ silc_auth_public_key_auth_generate_wpub @ 35 ;\r
+ silc_auth_public_key_auth_verify @ 36 ;\r
+ silc_auth_public_key_auth_verify_data @ 37 ;\r
+ silc_auth_verify @ 38 ;\r
+ silc_auth_verify_data @ 39 ;\r
+ silc_key_agreement_get_hostname @ 40 ;\r
+ silc_key_agreement_get_port @ 41 ;\r
+ silc_key_agreement_get_protocol @ 42 ;\r
+ silc_key_agreement_payload_encode @ 43 ;\r
+ silc_key_agreement_payload_free @ 44 ;\r
+ silc_key_agreement_payload_parse @ 45 ;\r
+ silc_id_dup @ 46 ;\r
+ silc_id_get_len @ 47 ;\r
+ silc_id_id2str @ 48 ;\r
+ silc_id_payload_encode @ 49 ;\r
+ silc_id_payload_encode_data @ 50 ;\r
+ silc_id_payload_free @ 51 ;\r
+ silc_id_payload_get_data @ 52 ;\r
+ silc_id_payload_get_id @ 53 ;\r
+ silc_id_payload_get_len @ 54 ;\r
+ silc_id_payload_get_type @ 55 ;\r
+ silc_id_payload_parse @ 56 ;\r
+ silc_id_payload_parse_id @ 57 ;\r
+ silc_id_str2id @ 58 ;\r
+ silc_id_str2id2 @ 59 ;\r
+ silc_attribute_get_attribute @ 60 ;\r
+ silc_attribute_get_data @ 61 ;\r
+ silc_attribute_get_flags @ 62 ;\r
+ silc_attribute_get_object @ 63 ;\r
+ silc_attribute_get_verify_data @ 64 ;\r
+ silc_attribute_payload_alloc @ 65 ;\r
+ silc_attribute_payload_encode @ 66 ;\r
+ silc_attribute_payload_encode_data @ 67 ;\r
+ silc_attribute_payload_free @ 68 ;\r
+ silc_attribute_payload_list_free @ 69 ;\r
+ silc_attribute_payload_parse @ 70 ;\r
+ silc_channel_get_id @ 71 ;\r
+ silc_channel_get_id_parse @ 72 ;\r
+ silc_channel_get_mode @ 73 ;\r
+ silc_channel_get_name @ 74 ;\r
+ silc_channel_key_get_cipher @ 75 ;\r
+ silc_channel_key_get_id @ 76 ;\r
+ silc_channel_key_get_key @ 77 ;\r
+ silc_channel_key_payload_encode @ 78 ;\r
+ silc_channel_key_payload_free @ 79 ;\r
+ silc_channel_key_payload_parse @ 80 ;\r
+ silc_channel_payload_encode @ 81 ;\r
+ silc_channel_payload_free @ 82 ;\r
+ silc_channel_payload_list_free @ 83 ;\r
+ silc_channel_payload_parse @ 84 ;\r
+ silc_channel_payload_parse_list @ 85 ;\r
+ silc_packet_engine_get_streams @ 86 ;\r
+ silc_packet_engine_start @ 87 ;\r
+ silc_packet_engine_stop @ 88 ;\r
+ silc_packet_error_string @ 89 ;\r
+ silc_packet_free @ 90 ;\r
+ silc_packet_get_context @ 91 ;\r
+ silc_packet_get_engine @ 92 ;\r
+ silc_packet_get_ids @ 93 ;\r
+ silc_packet_get_keys @ 94 ;\r
+ silc_packet_get_sender @ 95 ;\r
+ silc_packet_send @ 96 ;\r
+ silc_packet_send_ext @ 97 ;\r
+ silc_packet_send_va @ 98 ;\r
+ silc_packet_send_va_ext @ 99 ;\r
+ silc_packet_set_context @ 100 ;\r
+ silc_packet_set_ids @ 101 ;\r
+ silc_packet_set_keys @ 102 ;\r
+ silc_packet_set_sid @ 103 ;\r
+ silc_packet_stream_add_remote @ 104 ;\r
+ silc_packet_stream_create @ 105 ;\r
+ silc_packet_stream_destroy @ 106 ;\r
+ silc_packet_stream_get_stream @ 107 ;\r
+ silc_packet_stream_inject_packet @ 108 ;\r
+ silc_packet_stream_is_udp @ 109 ;\r
+ silc_packet_stream_is_valid @ 110 ;\r
+ silc_packet_stream_link @ 111 ;\r
+ silc_packet_stream_ref @ 112 ;\r
+ silc_packet_stream_set_iv_included @ 113 ;\r
+ silc_packet_stream_set_router @ 114 ;\r
+ silc_packet_stream_set_stream @ 115 ;\r
+ silc_packet_stream_unlink @ 116 ;\r
+ silc_packet_stream_unref @ 117 ;\r
+ silc_packet_stream_wrap @ 118 ;\r
+ silc_packet_wait @ 119 ;\r
+ silc_packet_wait_init @ 120 ;\r
+ silc_packet_wait_uninit @ 121 ;\r
+ silc_packet_wrap_close @ 122 ;\r
+ silc_packet_wrap_destroy @ 123 ;\r
+ silc_packet_wrap_get_schedule @ 124 ;\r
+ silc_packet_wrap_notifier @ 125 ;\r
+ silc_packet_wrap_read @ 126 ;\r
+ silc_packet_wrap_read_more @ 127 ;\r
+ silc_packet_wrap_write @ 128 ;\r
+ silc_notify_get_arg_num @ 129 ;\r
+ silc_notify_get_args @ 130 ;\r
+ silc_notify_get_type @ 131 ;\r
+ silc_notify_payload_encode @ 132 ;\r
+ silc_notify_payload_encode_args @ 133 ;\r
+ silc_notify_payload_free @ 134 ;\r
+ silc_notify_payload_parse @ 135 ;\r
+ silc_status_get_args @ 136 ;\r
+ silc_message_get_data @ 137 ;\r
+ silc_message_get_flags @ 138 ;\r
+ silc_message_get_mac @ 139 ;\r
+ silc_message_payload_decrypt @ 140 ;\r
+ silc_message_payload_encode @ 141 ;\r
+ silc_message_payload_encrypt @ 142 ;\r
+ silc_message_payload_free @ 143 ;\r
+ silc_message_payload_parse @ 144 ;\r
+ silc_message_signed_get_public_key @ 145 ;\r
+ silc_message_signed_verify @ 146 ;\r
+ silc_public_key_payload_decode @ 147 ;\r
+ silc_public_key_payload_encode @ 148 ;\r
+ silc_file_set_nonblock @ 149 ;\r
+ silc_get_real_name @ 150 ;\r
+ silc_get_username @ 151 ;\r
+ silc_gettimeofday @ 152 ;\r
+ silc_cond_alloc @ 153 ;\r
+ silc_cond_broadcast @ 154 ;\r
+ silc_cond_free @ 155 ;\r
+ silc_cond_signal @ 156 ;\r
+ silc_cond_timedwait @ 157 ;\r
+ silc_cond_wait @ 158 ;\r
+ silc_mutex_alloc @ 159 ;\r
+ silc_mutex_assert_locked @ 160 ;\r
+ silc_mutex_free @ 161 ;\r
+ silc_mutex_lock @ 162 ;\r
+ silc_mutex_unlock @ 163 ;\r
+ silc_rwlock_alloc @ 164 ;\r
+ silc_rwlock_free @ 165 ;\r
+ silc_rwlock_rdlock @ 166 ;\r
+ silc_rwlock_unlock @ 167 ;\r
+ silc_rwlock_wrlock @ 168 ;\r
+ silc_thread_create @ 169 ;\r
+ silc_thread_exit @ 170 ;\r
+ silc_thread_self @ 171 ;\r
+ silc_thread_wait @ 172 ;\r
+ silc_thread_yield @ 173 ;\r
+ silc_socket_stream_close @ 174 ;\r
+ silc_socket_stream_destroy @ 175 ;\r
+ silc_socket_stream_notifier @ 176 ;\r
+ silc_socket_stream_read @ 177 ;\r
+ silc_socket_stream_write @ 178 ;\r
+ silc_socket_udp_stream_read @ 179 ;\r
+ silc_socket_udp_stream_write @ 180 ;\r
+ silc_net_accept @ 181 ;\r
+ silc_net_addr2bin @ 182 ;\r
+ silc_net_close_connection @ 183 ;\r
+ silc_net_close_listener @ 184 ;\r
+ silc_net_set_socket_nonblock @ 185 ;\r
+ silc_net_tcp_connect @ 186 ;\r
+ silc_net_tcp_create_listener @ 187 ;\r
+ silc_net_udp_connect @ 188 ;\r
+ silc_net_udp_receive @ 189 ;\r
+ silc_net_udp_send @ 190 ;\r
+ silc_schedule_internal_init @ 191 ;\r
+ silc_schedule_internal_schedule_fd @ 192 ;\r
+ silc_schedule_internal_signal_register @ 193 ;\r
+ silc_schedule_internal_signal_unregister @ 194 ;\r
+ silc_schedule_internal_signals_block @ 195 ;\r
+ silc_schedule_internal_signals_call @ 196 ;\r
+ silc_schedule_internal_signals_unblock @ 197 ;\r
+ silc_schedule_internal_uninit @ 198 ;\r
+ silc_schedule_internal_wakeup @ 199 ;\r
+ silc_fd_stream_close @ 200 ;\r
+ silc_fd_stream_create @ 201 ;\r
+ silc_fd_stream_create2 @ 202 ;\r
+ silc_fd_stream_destroy @ 203 ;\r
+ silc_fd_stream_file @ 204 ;\r
+ silc_fd_stream_file2 @ 205 ;\r
+ silc_fd_stream_get_error @ 206 ;\r
+ silc_fd_stream_get_info @ 207 ;\r
+ silc_fd_stream_get_schedule @ 208 ;\r
+ silc_fd_stream_notifier @ 209 ;\r
+ silc_fd_stream_read @ 210 ;\r
+ silc_fd_stream_write @ 211 ;\r
+ silc_hash_table_add @ 212 ;\r
+ silc_hash_table_add_ext @ 213 ;\r
+ silc_hash_table_alloc @ 214 ;\r
+ silc_hash_table_count @ 215 ;\r
+ silc_hash_table_del @ 216 ;\r
+ silc_hash_table_del_by_context @ 217 ;\r
+ silc_hash_table_del_by_context_ext @ 218 ;\r
+ silc_hash_table_del_ext @ 219 ;\r
+ silc_hash_table_find @ 220 ;\r
+ silc_hash_table_find_by_context @ 221 ;\r
+ silc_hash_table_find_by_context_ext @ 222 ;\r
+ silc_hash_table_find_ext @ 223 ;\r
+ silc_hash_table_find_foreach @ 224 ;\r
+ silc_hash_table_find_foreach_ext @ 225 ;\r
+ silc_hash_table_foreach @ 226 ;\r
+ silc_hash_table_free @ 227 ;\r
+ silc_hash_table_get @ 228 ;\r
+ silc_hash_table_list @ 229 ;\r
+ silc_hash_table_list_reset @ 230 ;\r
+ silc_hash_table_rehash @ 231 ;\r
+ silc_hash_table_rehash_ext @ 232 ;\r
+ silc_hash_table_replace @ 233 ;\r
+ silc_hash_table_replace_ext @ 234 ;\r
+ silc_hash_table_size @ 235 ;\r
+ silc_schedule @ 236 ;\r
+ silc_schedule_get_context @ 237 ;\r
+ silc_schedule_get_fd_events @ 238 ;\r
+ silc_schedule_init @ 239 ;\r
+ silc_schedule_one @ 240 ;\r
+ silc_schedule_set_listen_fd @ 241 ;\r
+ silc_schedule_stop @ 242 ;\r
+ silc_schedule_task_add @ 243 ;\r
+ silc_schedule_task_del @ 244 ;\r
+ silc_schedule_task_del_by_all @ 245 ;\r
+ silc_schedule_task_del_by_callback @ 246 ;\r
+ silc_schedule_task_del_by_context @ 247 ;\r
+ silc_schedule_task_del_by_fd @ 248 ;\r
+ silc_schedule_uninit @ 249 ;\r
+ silc_schedule_unset_listen_fd @ 250 ;\r
+ silc_schedule_wakeup @ 251 ;\r
+ silc_calloc @ 252 ;\r
+ silc_free @ 253 ;\r
+ silc_malloc @ 254 ;\r
+ silc_memdup @ 255 ;\r
+ silc_realloc @ 256 ;\r
+ silc_scalloc @ 257 ;\r
+ silc_smalloc @ 258 ;\r
+ silc_smalloc_ua @ 259 ;\r
+ silc_smemdup @ 260 ;\r
+ silc_srealloc @ 261 ;\r
+ silc_srealloc_ua @ 262 ;\r
+ silc_sstrdup @ 263 ;\r
+ silc_config_close @ 264 ;\r
+ silc_config_get_filename @ 265 ;\r
+ silc_config_get_line @ 266 ;\r
+ silc_config_init @ 267 ;\r
+ silc_config_main @ 268 ;\r
+ silc_config_open @ 269 ;\r
+ silc_config_read_current_line @ 270 ;\r
+ silc_config_read_line @ 271 ;\r
+ silc_config_register @ 272 ;\r
+ silc_config_register_table @ 273 ;\r
+ silc_config_strerror @ 274 ;\r
+ silc_log_debug @ 275 ;\r
+ silc_log_debug_hexdump @ 276 ;\r
+ silc_log_fflush_callback @ 277 ;\r
+ silc_log_flush_all @ 278 ;\r
+ silc_log_flushdelay @ 279 ;\r
+ silc_log_get_file @ 280 ;\r
+ silc_log_output @ 281 ;\r
+ silc_log_output_debug @ 282 ;\r
+ silc_log_output_hexdump @ 283 ;\r
+ silc_log_quick @ 284 ;\r
+ silc_log_reset_all @ 285 ;\r
+ silc_log_reset_callbacks @ 286 ;\r
+ silc_log_reset_debug_callbacks @ 287 ;\r
+ silc_log_set_callback @ 288 ;\r
+ silc_log_set_debug_callbacks @ 289 ;\r
+ silc_log_set_debug_string @ 290 ;\r
+ silc_log_set_file @ 291 ;\r
+ silc_log_timestamp @ 292 ;\r
+ silc_net_accept_connection @ 293 ;\r
+ silc_net_check_host_by_sock @ 294 ;\r
+ silc_net_check_local_by_sock @ 295 ;\r
+ silc_net_get_error_string @ 296 ;\r
+ silc_net_get_local_port @ 297 ;\r
+ silc_net_get_remote_port @ 298 ;\r
+ silc_net_get_socket_opt @ 299 ;\r
+ silc_net_gethostbyaddr @ 300 ;\r
+ silc_net_gethostbyaddr_async @ 301 ;\r
+ silc_net_gethostbyname @ 302 ;\r
+ silc_net_gethostbyname_async @ 303 ;\r
+ silc_net_is_ip @ 304 ;\r
+ silc_net_is_ip4 @ 305 ;\r
+ silc_net_is_ip6 @ 306 ;\r
+ silc_net_listener_get_hostname @ 307 ;\r
+ silc_net_listener_get_ip @ 308 ;\r
+ silc_net_listener_get_port @ 309 ;\r
+ silc_net_localhost @ 310 ;\r
+ silc_net_localip @ 311 ;\r
+ silc_net_resolve_completion @ 312 ;\r
+ silc_net_set_socket_opt @ 313 ;\r
+ silc_stringprep @ 314 ;\r
+ silc_socket_host_lookup_finish @ 315 ;\r
+ silc_socket_stream_get_error @ 316 ;\r
+ silc_socket_stream_get_info @ 317 ;\r
+ silc_socket_stream_get_schedule @ 318 ;\r
+ silc_socket_stream_is_udp @ 319 ;\r
+ silc_socket_stream_set_info @ 320 ;\r
+ silc_socket_stream_set_qos @ 321 ;\r
+ silc_socket_tcp_stream_create @ 322 ;\r
+ silc_socket_udp_stream_create @ 323 ;\r
+ silc_compare_timeval @ 324 ;\r
+ silc_time @ 325 ;\r
+ silc_time_generalized @ 326 ;\r
+ silc_time_generalized_string @ 327 ;\r
+ silc_time_msec @ 328 ;\r
+ silc_time_string @ 329 ;\r
+ silc_time_universal @ 330 ;\r
+ silc_time_universal_string @ 331 ;\r
+ silc_time_usec @ 332 ;\r
+ silc_time_value @ 333 ;\r
+ silc_timezone @ 334 ;\r
+ silc_file_close @ 335 ;\r
+ silc_file_open @ 336 ;\r
+ silc_file_open_mode @ 337 ;\r
+ silc_file_read @ 338 ;\r
+ silc_file_readfile @ 339 ;\r
+ silc_file_size @ 340 ;\r
+ silc_file_write @ 341 ;\r
+ silc_file_writefile @ 342 ;\r
+ silc_file_writefile_mode @ 343 ;\r
+ silc_check_line @ 344 ;\r
+ silc_fingerprint @ 345 ;\r
+ silc_format @ 346 ;\r
+ silc_get_input @ 347 ;\r
+ silc_gets @ 348 ;\r
+ silc_hash_client_id_compare @ 349 ;\r
+ silc_hash_client_id_hash @ 350 ;\r
+ silc_hash_data @ 351 ;\r
+ silc_hash_data_compare @ 352 ;\r
+ silc_hash_id @ 353 ;\r
+ silc_hash_id_compare @ 354 ;\r
+ silc_hash_id_compare_full @ 355 ;\r
+ silc_hash_ptr @ 356 ;\r
+ silc_hash_public_key @ 357 ;\r
+ silc_hash_public_key_compare @ 358 ;\r
+ silc_hash_string @ 359 ;\r
+ silc_hash_string_compare @ 360 ;\r
+ silc_hash_uint @ 361 ;\r
+ silc_hash_utf8_compare @ 362 ;\r
+ silc_hash_utf8_string @ 363 ;\r
+ silc_parse_command_line @ 364 ;\r
+ silc_parse_userfqdn @ 365 ;\r
+ silc_string_is_ascii @ 366 ;\r
+ silc_to_lower @ 367 ;\r
+ silc_to_upper @ 368 ;\r
+ silc_utf8_decode @ 369 ;\r
+ silc_utf8_decoded_len @ 370 ;\r
+ silc_utf8_encode @ 371 ;\r
+ silc_utf8_encoded_len @ 372 ;\r
+ silc_utf8_strcasecmp @ 373 ;\r
+ silc_utf8_strncasecmp @ 374 ;\r
+ silc_utf8_valid @ 375 ;\r
+ silc_base64_decode @ 376 ;\r
+ silc_base64_encode @ 377 ;\r
+ silc_base64_encode_file @ 378 ;\r
+ silc_string_compare @ 379 ;\r
+ silc_string_match @ 380 ;\r
+ silc_string_regex_combine @ 381 ;\r
+ silc_string_regex_match @ 382 ;\r
+ silc_string_regexify @ 383 ;\r
+ silc_string_split @ 384 ;\r
+ silc_strncat @ 385 ;\r
+ silc_fsm_alloc @ 386 ;\r
+ silc_fsm_continue @ 387 ;\r
+ silc_fsm_continue_sync @ 388 ;\r
+ silc_fsm_event_alloc @ 389 ;\r
+ silc_fsm_event_free @ 390 ;\r
+ silc_fsm_event_init @ 391 ;\r
+ silc_fsm_event_signal @ 392 ;\r
+ silc_fsm_event_timedwait @ 393 ;\r
+ silc_fsm_event_wait @ 394 ;\r
+ silc_fsm_finish @ 395 ;\r
+ silc_fsm_free @ 396 ;\r
+ silc_fsm_get_context @ 397 ;\r
+ silc_fsm_get_machine @ 398 ;\r
+ silc_fsm_get_schedule @ 399 ;\r
+ silc_fsm_get_state_context @ 400 ;\r
+ silc_fsm_init @ 401 ;\r
+ silc_fsm_is_started @ 402 ;\r
+ silc_fsm_next @ 403 ;\r
+ silc_fsm_next_later @ 404 ;\r
+ silc_fsm_set_context @ 405 ;\r
+ silc_fsm_set_state_context @ 406 ;\r
+ silc_fsm_signal @ 407 ;\r
+ silc_fsm_start @ 408 ;\r
+ silc_fsm_start_sync @ 409 ;\r
+ silc_fsm_thread @ 410 ;\r
+ silc_fsm_thread_alloc @ 411 ;\r
+ silc_fsm_thread_init @ 412 ;\r
+ silc_fsm_thread_wait @ 413 ;\r
+ silc_buffer_format @ 414 ;\r
+ silc_buffer_format_vp @ 415 ;\r
+ silc_buffer_sformat @ 416 ;\r
+ silc_buffer_sformat_vp @ 417 ;\r
+ silc_buffer_sstrformat @ 418 ;\r
+ silc_buffer_strformat @ 419 ;\r
+ silc_buffer_sunformat @ 420 ;\r
+ silc_buffer_sunformat_vp @ 421 ;\r
+ silc_buffer_unformat @ 422 ;\r
+ silc_buffer_unformat_vp @ 423 ;\r
+ silc_stream_close @ 424 ;\r
+ silc_stream_destroy @ 425 ;\r
+ silc_stream_get_schedule @ 426 ;\r
+ silc_stream_read @ 427 ;\r
+ silc_stream_set_notifier @ 428 ;\r
+ silc_stream_write @ 429 ;\r
+ silc_async_abort @ 430 ;\r
+ silc_async_alloc @ 431 ;\r
+ silc_async_free @ 432 ;\r
+ silc_async_get_context @ 433 ;\r
+ silc_async_halt @ 434 ;\r
+ silc_async_init @ 435 ;\r
+ silc_async_resume @ 436 ;\r
+ silc_asprintf @ 437 ;\r
+ silc_snprintf @ 438 ;\r
+ silc_vasprintf @ 439 ;\r
+ silc_vsnprintf @ 440 ;\r
+ silc_mime_add_data @ 441 ;\r
+ silc_mime_add_field @ 442 ;\r
+ silc_mime_add_multipart @ 443 ;\r
+ silc_mime_alloc @ 444 ;\r
+ silc_mime_assemble @ 445 ;\r
+ silc_mime_assembler_alloc @ 446 ;\r
+ silc_mime_assembler_free @ 447 ;\r
+ silc_mime_decode @ 448 ;\r
+ silc_mime_encode @ 449 ;\r
+ silc_mime_encode_partial @ 450 ;\r
+ silc_mime_free @ 451 ;\r
+ silc_mime_get_data @ 452 ;\r
+ silc_mime_get_field @ 453 ;\r
+ silc_mime_get_multiparts @ 454 ;\r
+ silc_mime_is_multipart @ 455 ;\r
+ silc_mime_is_partial @ 456 ;\r
+ silc_mime_partial_free @ 457 ;\r
+ silc_mime_set_multipart @ 458 ;\r
+ silc_mime_steal_data @ 459 ;\r
+ silc_idcache_add @ 460 ;\r
+ silc_idcache_alloc @ 461 ;\r
+ silc_idcache_del @ 462 ;\r
+ silc_idcache_del_by_context @ 463 ;\r
+ silc_idcache_del_by_id @ 464 ;\r
+ silc_idcache_find_by_context @ 465 ;\r
+ silc_idcache_find_by_id @ 466 ;\r
+ silc_idcache_find_by_id_one @ 467 ;\r
+ silc_idcache_find_by_name @ 468 ;\r
+ silc_idcache_find_by_name_one @ 469 ;\r
+ silc_idcache_free @ 470 ;\r
+ silc_idcache_get_all @ 471 ;\r
+ silc_idcache_update @ 472 ;\r
+ silc_idcache_update_by_context @ 473 ;\r
+ silc_change_private_key_passphrase @ 474 ;\r
+ silc_channel_name_check @ 475 ;\r
+ silc_channel_name_verify @ 476 ;\r
+ silc_client_chmode @ 477 ;\r
+ silc_client_chumode @ 478 ;\r
+ silc_client_chumode_char @ 479 ;\r
+ silc_create_key_pair @ 480 ;\r
+ silc_get_command_name @ 481 ;\r
+ silc_get_mode_list @ 482 ;\r
+ silc_get_packet_name @ 483 ;\r
+ silc_get_status_message @ 484 ;\r
+ silc_id_render @ 485 ;\r
+ silc_identifier_check @ 486 ;\r
+ silc_identifier_verify @ 487 ;\r
+ silc_load_key_pair @ 488 ;\r
+ silc_parse_version_string @ 489 ;\r
+ silc_show_public_key @ 490 ;\r
+ silc_show_public_key_file @ 491 ;\r
+ silc_version_to_num @ 492 ;\r
+ silc_sha256_context_len @ 498 ;\r
+ silc_sha256_final @ 499 ;\r
+ silc_sha256_init @ 500 ;\r
+ silc_sha256_transform @ 501 ;\r
+ silc_sha256_update @ 502 ;\r
+ silc_none_context_len @ 503 ;\r
+ silc_none_decrypt @ 504 ;\r
+ silc_none_encrypt @ 505 ;\r
+ silc_none_set_iv @ 506 ;\r
+ silc_none_set_key @ 507 ;\r
+ silc_sha1_context_len @ 508 ;\r
+ silc_sha1_final @ 509 ;\r
+ silc_sha1_init @ 510 ;\r
+ silc_sha1_transform @ 511 ;\r
+ silc_sha1_update @ 512 ;\r
+ silc_pkcs_algorithm_register @ 513 ;\r
+ silc_pkcs_algorithm_unregister @ 514 ;\r
+ silc_pkcs_decrypt @ 515 ;\r
+ silc_pkcs_encrypt @ 516 ;\r
+ silc_pkcs_find_algorithm @ 517 ;\r
+ silc_pkcs_find_pkcs @ 518 ;\r
+ silc_pkcs_get_algorithm @ 519 ;\r
+ silc_pkcs_get_context @ 520 ;\r
+ silc_pkcs_get_name @ 521 ;\r
+ silc_pkcs_get_pkcs @ 522 ;\r
+ silc_pkcs_get_supported @ 523 ;\r
+ silc_pkcs_get_type @ 524 ;\r
+ silc_pkcs_load_private_key @ 525 ;\r
+ silc_pkcs_load_public_key @ 526 ;\r
+ silc_pkcs_private_key_alloc @ 527 ;\r
+ silc_pkcs_private_key_free @ 528 ;\r
+ silc_pkcs_private_key_get_len @ 529 ;\r
+ silc_pkcs_public_key_alloc @ 530 ;\r
+ silc_pkcs_public_key_compare @ 531 ;\r
+ silc_pkcs_public_key_copy @ 532 ;\r
+ silc_pkcs_public_key_encode @ 533 ;\r
+ silc_pkcs_public_key_free @ 534 ;\r
+ silc_pkcs_public_key_get_len @ 535 ;\r
+ silc_pkcs_register @ 536 ;\r
+ silc_pkcs_register_default @ 537 ;\r
+ silc_pkcs_save_private_key @ 538 ;\r
+ silc_pkcs_save_public_key @ 539 ;\r
+ silc_pkcs_sign @ 540 ;\r
+ silc_pkcs_unregister @ 541 ;\r
+ silc_pkcs_unregister_all @ 542 ;\r
+ silc_pkcs_verify @ 543 ;\r
+ silc_hash_alloc @ 544 ;\r
+ silc_hash_alloc_by_oid @ 545 ;\r
+ silc_hash_babbleprint @ 546 ;\r
+ silc_hash_block_len @ 547 ;\r
+ silc_hash_final @ 548 ;\r
+ silc_hash_fingerprint @ 549 ;\r
+ silc_hash_free @ 550 ;\r
+ silc_hash_get_name @ 551 ;\r
+ silc_hash_get_oid @ 552 ;\r
+ silc_hash_get_supported @ 553 ;\r
+ silc_hash_init @ 554 ;\r
+ silc_hash_is_supported @ 555 ;\r
+ silc_hash_len @ 556 ;\r
+ silc_hash_make @ 557 ;\r
+ silc_hash_register @ 558 ;\r
+ silc_hash_register_default @ 559 ;\r
+ silc_hash_transform @ 560 ;\r
+ silc_hash_unregister @ 561 ;\r
+ silc_hash_unregister_all @ 562 ;\r
+ silc_hash_update @ 563 ;\r
+ silc_aes_cbc_context_len @ 564 ;\r
+ silc_aes_cbc_decrypt @ 565 ;\r
+ silc_aes_cbc_encrypt @ 566 ;\r
+ silc_aes_cbc_set_iv @ 567 ;\r
+ silc_aes_cbc_set_key @ 568 ;\r
+ silc_aes_ctr_context_len @ 569 ;\r
+ silc_aes_ctr_decrypt @ 570 ;\r
+ silc_aes_ctr_encrypt @ 571 ;\r
+ silc_aes_ctr_set_iv @ 572 ;\r
+ silc_aes_ctr_set_key @ 573 ;\r
+ silc_pkcs1_decode @ 574 ;\r
+ silc_pkcs1_decrypt @ 575 ;\r
+ silc_pkcs1_encode @ 576 ;\r
+ silc_pkcs1_encrypt @ 577 ;\r
+ silc_pkcs1_export_private_key @ 578 ;\r
+ silc_pkcs1_export_public_key @ 579 ;\r
+ silc_pkcs1_generate_key @ 580 ;\r
+ silc_pkcs1_import_private_key @ 581 ;\r
+ silc_pkcs1_import_public_key @ 582 ;\r
+ silc_pkcs1_private_key_bitlen @ 583 ;\r
+ silc_pkcs1_private_key_free @ 584 ;\r
+ silc_pkcs1_public_key_bitlen @ 585 ;\r
+ silc_pkcs1_public_key_compare @ 586 ;\r
+ silc_pkcs1_public_key_copy @ 587 ;\r
+ silc_pkcs1_public_key_free @ 588 ;\r
+ silc_pkcs1_sign @ 589 ;\r
+ silc_pkcs1_sign_no_oid @ 590 ;\r
+ silc_pkcs1_verify @ 591 ;\r
+ silc_pkcs1_verify_no_oid @ 592 ;\r
+ silc_cipher_alloc @ 598 ;\r
+ silc_cipher_decrypt @ 599 ;\r
+ silc_cipher_encrypt @ 600 ;\r
+ silc_cipher_free @ 601 ;\r
+ silc_cipher_get_block_len @ 602 ;\r
+ silc_cipher_get_iv @ 603 ;\r
+ silc_cipher_get_iv_len @ 604 ;\r
+ silc_cipher_get_key_len @ 605 ;\r
+ silc_cipher_get_mode @ 606 ;\r
+ silc_cipher_get_name @ 607 ;\r
+ silc_cipher_get_supported @ 608 ;\r
+ silc_cipher_is_supported @ 609 ;\r
+ silc_cipher_register @ 610 ;\r
+ silc_cipher_register_default @ 611 ;\r
+ silc_cipher_set_iv @ 612 ;\r
+ silc_cipher_set_key @ 613 ;\r
+ silc_cipher_unregister @ 614 ;\r
+ silc_cipher_unregister_all @ 615 ;\r
+ silc_md5_context_len @ 616 ;\r
+ silc_md5_final @ 617 ;\r
+ silc_md5_init @ 618 ;\r
+ silc_md5_transform @ 619 ;\r
+ silc_md5_update @ 620 ;\r
+ silc_rsa_generate_keys @ 621 ;\r
+ silc_rsa_private_operation @ 622 ;\r
+ silc_rsa_public_operation @ 623 ;\r
+ silc_blowfish_cbc_context_len @ 624 ;\r
+ silc_blowfish_cbc_decrypt @ 625 ;\r
+ silc_blowfish_cbc_encrypt @ 626 ;\r
+ silc_blowfish_cbc_set_iv @ 627 ;\r
+ silc_blowfish_cbc_set_key @ 628 ;\r
+ silc_twofish_cbc_context_len @ 629 ;\r
+ silc_twofish_cbc_decrypt @ 630 ;\r
+ silc_twofish_cbc_encrypt @ 631 ;\r
+ silc_twofish_cbc_set_iv @ 632 ;\r
+ silc_twofish_cbc_set_key @ 633 ;\r
+ silc_hmac_alloc @ 634 ;\r
+ silc_hmac_final @ 635 ;\r
+ silc_hmac_free @ 636 ;\r
+ silc_hmac_get_hash @ 637 ;\r
+ silc_hmac_get_key @ 638 ;\r
+ silc_hmac_get_name @ 639 ;\r
+ silc_hmac_get_supported @ 640 ;\r
+ silc_hmac_init @ 641 ;\r
+ silc_hmac_init_with_key @ 642 ;\r
+ silc_hmac_is_supported @ 643 ;\r
+ silc_hmac_len @ 644 ;\r
+ silc_hmac_make @ 645 ;\r
+ silc_hmac_make_truncated @ 646 ;\r
+ silc_hmac_make_with_key @ 647 ;\r
+ silc_hmac_register @ 648 ;\r
+ silc_hmac_register_default @ 649 ;\r
+ silc_hmac_set_key @ 650 ;\r
+ silc_hmac_unregister @ 651 ;\r
+ silc_hmac_unregister_all @ 652 ;\r
+ silc_hmac_update @ 653 ;\r
+ silc_rng_add_noise @ 654 ;\r
+ silc_rng_alloc @ 655 ;\r
+ silc_rng_free @ 656 ;\r
+ silc_rng_get_byte @ 657 ;\r
+ silc_rng_get_byte_fast @ 658 ;\r
+ silc_rng_get_rn16 @ 659 ;\r
+ silc_rng_get_rn32 @ 660 ;\r
+ silc_rng_get_rn_data @ 661 ;\r
+ silc_rng_get_rn_string @ 662 ;\r
+ silc_rng_global_add_noise @ 663 ;\r
+ silc_rng_global_get_byte @ 664 ;\r
+ silc_rng_global_get_byte_fast @ 665 ;\r
+ silc_rng_global_get_rn16 @ 666 ;\r
+ silc_rng_global_get_rn32 @ 667 ;\r
+ silc_rng_global_get_rn_data @ 668 ;\r
+ silc_rng_global_get_rn_string @ 669 ;\r
+ silc_rng_global_init @ 670 ;\r
+ silc_rng_global_uninit @ 671 ;\r
+ silc_rng_init @ 672 ;\r
+ silc_pkcs_silc_decode_identifier @ 673 ;\r
+ silc_pkcs_silc_decrypt @ 674 ;\r
+ silc_pkcs_silc_encode_identifier @ 675 ;\r
+ silc_pkcs_silc_encrypt @ 676 ;\r
+ silc_pkcs_silc_export_private_key @ 677 ;\r
+ silc_pkcs_silc_export_private_key_file @ 678 ;\r
+ silc_pkcs_silc_export_public_key @ 679 ;\r
+ silc_pkcs_silc_export_public_key_file @ 680 ;\r
+ silc_pkcs_silc_generate_key @ 681 ;\r
+ silc_pkcs_silc_get_algorithm @ 682 ;\r
+ silc_pkcs_silc_import_private_key @ 683 ;\r
+ silc_pkcs_silc_import_private_key_file @ 684 ;\r
+ silc_pkcs_silc_import_public_key @ 685 ;\r
+ silc_pkcs_silc_import_public_key_file @ 686 ;\r
+ silc_pkcs_silc_private_key_bitlen @ 687 ;\r
+ silc_pkcs_silc_private_key_free @ 688 ;\r
+ silc_pkcs_silc_public_key_bitlen @ 689 ;\r
+ silc_pkcs_silc_public_key_compare @ 690 ;\r
+ silc_pkcs_silc_public_key_copy @ 691 ;\r
+ silc_pkcs_silc_public_key_free @ 692 ;\r
+ silc_pkcs_silc_public_key_version @ 693 ;\r
+ silc_pkcs_silc_sign @ 694 ;\r
+ silc_pkcs_silc_verify @ 695 ;\r
+ silc_skr_add_public_key @ 696 ;\r
+ silc_skr_add_public_key_simple @ 697 ;\r
+ silc_skr_alloc @ 698 ;\r
+ silc_skr_del_public_key @ 699 ;\r
+ silc_skr_find @ 700 ;\r
+ silc_skr_find_alloc @ 701 ;\r
+ silc_skr_find_free @ 702 ;\r
+ silc_skr_find_set_context @ 703 ;\r
+ silc_skr_find_set_country @ 704 ;\r
+ silc_skr_find_set_email @ 705 ;\r
+ silc_skr_find_set_host @ 706 ;\r
+ silc_skr_find_set_org @ 707 ;\r
+ silc_skr_find_set_pkcs_type @ 708 ;\r
+ silc_skr_find_set_public_key @ 709 ;\r
+ silc_skr_find_set_realname @ 710 ;\r
+ silc_skr_find_set_usage @ 711 ;\r
+ silc_skr_find_set_username @ 712 ;\r
+ silc_skr_free @ 713 ;\r
+ silc_skr_init @ 714 ;\r
+ silc_skr_ref_public_key @ 715 ;\r
+ silc_skr_uninit @ 716 ;\r
+ silc_skr_unref_public_key @ 717 ;\r
+ silc_mp_abs @ 718 ;\r
+ silc_mp_add @ 719 ;\r
+ silc_mp_add_ui @ 720 ;\r
+ silc_mp_and @ 721 ;\r
+ silc_mp_cmp @ 722 ;\r
+ silc_mp_cmp_si @ 723 ;\r
+ silc_mp_cmp_ui @ 724 ;\r
+ silc_mp_div @ 725 ;\r
+ silc_mp_div_2exp @ 726 ;\r
+ silc_mp_div_2exp_qr @ 727 ;\r
+ silc_mp_div_qr @ 728 ;\r
+ silc_mp_div_ui @ 729 ;\r
+ silc_mp_gcd @ 730 ;\r
+ silc_mp_gcdext @ 731 ;\r
+ silc_mp_get_str @ 732 ;\r
+ silc_mp_get_ui @ 733 ;\r
+ silc_mp_init @ 734 ;\r
+ silc_mp_mod @ 735 ;\r
+ silc_mp_mod_2exp @ 736 ;\r
+ silc_mp_mod_ui @ 737 ;\r
+ silc_mp_mul @ 738 ;\r
+ silc_mp_mul_2exp @ 739 ;\r
+ silc_mp_mul_ui @ 740 ;\r
+ silc_mp_neg @ 741 ;\r
+ silc_mp_or @ 742 ;\r
+ silc_mp_pow @ 743 ;\r
+ silc_mp_pow_mod @ 744 ;\r
+ silc_mp_pow_mod_ui @ 745 ;\r
+ silc_mp_pow_ui @ 746 ;\r
+ silc_mp_set @ 747 ;\r
+ silc_mp_set_si @ 748 ;\r
+ silc_mp_set_str @ 749 ;\r
+ silc_mp_set_ui @ 750 ;\r
+ silc_mp_sinit @ 751 ;\r
+ silc_mp_size @ 752 ;\r
+ silc_mp_sizeinbase @ 753 ;\r
+ silc_mp_sqrt @ 754 ;\r
+ silc_mp_sub @ 755 ;\r
+ silc_mp_sub_ui @ 756 ;\r
+ silc_mp_uninit @ 757 ;\r
+ silc_mp_xor @ 758 ;\r
+ silc_math_gen_prime @ 759 ;\r
+ silc_math_prime_test @ 760 ;\r
+ silc_mp_bin2mp @ 761 ;\r
+ silc_mp_mp2bin @ 762 ;\r
+ silc_mp_mp2bin_noalloc @ 763 ;\r
+ silc_mp_modinv @ 764 ;\r
+ silc_asn1_encode @ 772 ;\r
+ silc_asn1_alloc @ 773 ;\r
+ silc_asn1_free @ 775 ;\r
+ silc_asn1_init @ 776 ;\r
+ silc_asn1_uninit @ 778 ;\r
+ silc_asn1_decode @ 779 ;\r
+ silc_ber_decode @ 780 ;\r
+ silc_ber_encode @ 781 ;\r
+ silc_ber_encoded_len @ 782 ;\r
+ silc_connauth_alloc @ 783 ;\r
+ silc_connauth_free @ 784 ;\r
+ silc_connauth_get_ske @ 785 ;\r
+ silc_connauth_initiator @ 786 ;\r
+ silc_connauth_responder @ 787 ;\r
+ silc_connauth_timeout @ 788 ;\r
+ silc_ske_alloc @ 789 ;\r
+ silc_ske_free @ 790 ;\r
+ silc_ske_free_key_material @ 791 ;\r
+ silc_ske_free_rekey_material @ 792 ;\r
+ silc_ske_get_context @ 793 ;\r
+ silc_ske_get_key_material @ 794 ;\r
+ silc_ske_get_security_properties @ 795 ;\r
+ silc_ske_initiator @ 796 ;\r
+ silc_ske_map_status @ 797 ;\r
+ silc_ske_packet_send_retry @ 798 ;\r
+ silc_ske_parse_version @ 799 ;\r
+ silc_ske_process_key_material @ 800 ;\r
+ silc_ske_process_key_material_data @ 801 ;\r
+ silc_ske_rekey_initiator @ 802 ;\r
+ silc_ske_rekey_responder @ 803 ;\r
+ silc_ske_responder @ 804 ;\r
+ silc_ske_set_callbacks @ 805 ;\r
+ silc_ske_set_keys @ 806 ;\r
+ silc_ske_payload_ke_decode @ 807 ;\r
+ silc_ske_payload_ke_encode @ 808 ;\r
+ silc_ske_payload_ke_free @ 809 ;\r
+ silc_ske_payload_start_decode @ 810 ;\r
+ silc_ske_payload_start_encode @ 811 ;\r
+ silc_ske_payload_start_free @ 812 ;\r
+ silc_ske_get_supported_groups @ 813 ;\r
+ silc_ske_group_free @ 814 ;\r
+ silc_ske_group_get_by_name @ 815 ;\r
+ silc_ske_group_get_by_number @ 816 ;\r
+ silc_ske_group_get_name @ 817 ;\r
+ silc_ske_group_get_number @ 818 ;\r
+ silc_http_php @ 819 ;\r
+ silc_http_php_file @ 820 ;\r
+ silc_http_server_add_header @ 821 ;\r
+ silc_http_server_alloc @ 822 ;\r
+ silc_http_server_free @ 823 ;\r
+ silc_http_server_get_header @ 824 ;\r
+ silc_http_server_send @ 825 ;\r
+ silc_http_server_send_error @ 826 ;\r
+ silc_sftp_fs_memory_add_dir @ 827 ;\r
+ silc_sftp_fs_memory_add_file @ 828 ;\r
+ silc_sftp_fs_memory_alloc @ 829 ;\r
+ silc_sftp_fs_memory_del_dir @ 830 ;\r
+ silc_sftp_fs_memory_del_file @ 831 ;\r
+ silc_sftp_fs_memory_free @ 832 ;\r
+ silc_sftp_attr_decode @ 833 ;\r
+ silc_sftp_attr_encode @ 834 ;\r
+ silc_sftp_attr_free @ 835 ;\r
+ silc_sftp_map_errno @ 836 ;\r
+ silc_sftp_name_add @ 837 ;\r
+ silc_sftp_name_decode @ 838 ;\r
+ silc_sftp_name_encode @ 839 ;\r
+ silc_sftp_name_free @ 840 ;\r
+ silc_sftp_packet_decode @ 841 ;\r
+ silc_sftp_packet_encode @ 842 ;\r
+ silc_sftp_packet_encode_vp @ 843 ;\r
+ silc_sftp_client_shutdown @ 844 ;\r
+ silc_sftp_client_start @ 845 ;\r
+ silc_sftp_close @ 846 ;\r
+ silc_sftp_extended @ 847 ;\r
+ silc_sftp_fsetstat @ 848 ;\r
+ silc_sftp_fstat @ 849 ;\r
+ silc_sftp_lstat @ 850 ;\r
+ silc_sftp_mkdir @ 851 ;\r
+ silc_sftp_open @ 852 ;\r
+ silc_sftp_opendir @ 853 ;\r
+ silc_sftp_read @ 854 ;\r
+ silc_sftp_readdir @ 855 ;\r
+ silc_sftp_readlink @ 856 ;\r
+ silc_sftp_realpath @ 857 ;\r
+ silc_sftp_remove @ 858 ;\r
+ silc_sftp_rename @ 859 ;\r
+ silc_sftp_rmdir @ 860 ;\r
+ silc_sftp_setstat @ 861 ;\r
+ silc_sftp_stat @ 862 ;\r
+ silc_sftp_symlink @ 863 ;\r
+ silc_sftp_write @ 864 ;\r
+ silc_sftp_server_set_monitor @ 865 ;\r
+ silc_sftp_server_shutdown @ 866 ;\r
+ silc_sftp_server_start @ 867 ;\r
+ silc_vcard_alloc @ 868 ;\r
+ silc_vcard_decode @ 869 ;\r
+ silc_vcard_encode @ 870 ;\r
+ silc_vcard_fprintf @ 871 ;\r
+ silc_vcard_free @ 872 ;\r
+ silc_utf8_c2w @ 873 ;\r
+ silc_utf8_w2c @ 874 ;\r
+ silc_packet_engine_free_streams_list @ 875 ;\r
+ silc_schedule_set_notify @ 876 ;\r
+\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\lib\silccrypt\cast.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\lib\silccrypt\md5.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\lib\silccrypt\rc5.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\lib\silccrypt\rsa.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\lib\silccrypt\cast.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\lib\silccrypt\cast_internal.h\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\lib\silccrypt\ciphers.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=..\..\lib\silccrypt\rc5.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\lib\silccrypt\rc5_internal.h\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=..\..\lib\silccrypt\rijndael_internal.h\r
# End Source File\r
# Begin Source File\r