+Tue Jan 29 19:49:31 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Applied patches from cras:
+
+ Memory leak fixes around libaries, irssi window resize fix,
+ new silclist.h and silcdlist.h, all extern inline changed to
+ static inline.
+
+ * Removed dotconf from lib/dotconf, not needed anymore.
+
+ * Removed TRQ from lib/trq, not needed anymore.
+
Tue Jan 29 10:35:03 CET 2002 Pekka Riikonen <priikone@silcnet.org>
* Fixed a crash in server related to channel announcements.
-I$(silc_top_srcdir)/lib/silcclient \
-I$(silc_top_srcdir)/lib/contrib \
-I$(silc_top_srcdir)/includes \
- -I$(silc_top_srcdir)/doc \
- -I$(silc_top_srcdir)/lib/trq
+ -I$(silc_top_srcdir)/doc
#
#includes-install: Makefile
TODO/bugs In SILC Client Library
================================
+ o Rewrite the channel's user list thingy and cross list it to the
+ Client entry.
+
o The PRIVATE_MESSAGE_KEY packet is not handled (it is implemented
though). This should be added and perhaps new client operation
should be added to notify application that it was received and
each JOIN command will create and distribute the new channel key
to everybody on the channel.
- o New configuration file format must be added. The new one will be
- done using the dotconf config library (lib/dotconf). The following
+ o New configuration file format must be added. The following
tasks relates closely to this as well and must be done at the same time
when adding the new config file format:
unsigned int halfop:1;
unsigned int voice:1;
-GHashTable *module_data;
-
void *unique_id; /* unique ID to use for comparing if one nick is in another channels,
or NULL = nicks are unique, just keep comparing them. */
NICK_REC *next; /* support for multiple identically named nicks */
/* Add new nick to list */
void nicklist_insert(CHANNEL_REC *channel, NICK_REC *nick)
{
- MODULE_DATA_INIT(nick);
-
nick->type = module_get_uniq_id("NICK", 0);
nick->chat_type = channel->chat_type;
static int scrx, scry;
static int use_colors;
static int freeze_refresh;
+static int resized;
static int init_screen_int(void);
static void deinit_screen_int(void);
#ifdef SIGWINCH
-
static void sig_winch(int p)
+{
+ resized = TRUE;
+}
+#endif
+
+void screen_check_resizes(void)
{
#if defined (TIOCGWINSZ) && defined (HAVE_CURSES_RESIZETERM)
struct winsize ws;
#endif
mainwindows_resize(COLS, LINES);
+ resized = FALSE;
}
-#endif
static void read_signals(void)
{
#define is_big5(hi,lo) is_big5_hi(hi) && (is_big5_los(lo) || is_big5_lox(lo))
#endif WANT_BIG5
+void screen_check_resizes(void);
+
int init_screen(void); /* Initialize screen, detect screen length */
void deinit_screen(void); /* Deinitialize screen */
static void sig_exit(void)
{
- g_main_quit(main_loop);
+ quitting = TRUE;
}
/* redraw irssi's screen.. */
static void textui_deinit(void)
{
- quitting = TRUE;
signal(SIGINT, SIG_DFL);
screen_refresh_freeze();
textdomain(PACKAGE);
#endif
+ quitting = FALSE;
+
textui_init();
args_execute(argc, argv);
silc_init_finish();
textui_finish_init();
main_loop = g_main_new(TRUE);
- g_main_run(main_loop);
+
+ while (!quitting) {
+ g_main_iteration(TRUE);
+ screen_check_resizes();
+ }
+
g_main_destroy(main_loop);
textui_deinit();
memset(file_public_key, 0, sizeof(file_public_key));
memset(file_private_key, 0, sizeof(file_private_key));
+ identifier = silc_client_create_identifier();
+
pw = getpwuid(getuid());
if (!pw) {
fprintf(stderr, "silc: %s\n", strerror(errno));
+ if (identifier)
+ silc_free(identifier);
return FALSE;
}
- identifier = silc_client_create_identifier();
-
/* We'll take home path from /etc/passwd file to be sure. */
snprintf(filename, sizeof(filename) - 1, "%s/.silc/", pw->pw_dir);
snprintf(servfilename, sizeof(servfilename) - 1, "%s/.silc/serverkeys",
fd = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
silc_client_start_key_exchange(silc_client, conn, fd);
+ server->ftp_sessions = silc_dlist_init();
server->isnickflag = isnickflag_func;
server->ischannel = ischannel_func;
server->get_nick_flags = get_nick_flags;
{
if (!IS_SILC_SERVER(server))
return;
-
+
+ silc_dlist_uninit(server->ftp_sessions);
+
if (server->conn && server->conn->sock != NULL) {
silc_client_close_connection(silc_client, NULL, server->conn);
return NULL;
}
- server->ftp_sessions = silc_dlist_init();
-
return server;
}
int i, k;
bool no_res = TRUE;
+ SILC_LOG_DEBUG(("Start"));
+
for (i = 0; i < clients_count; i++) {
entry = clients[i];
if (!entry)
# More header checking
AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
-AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h)
+AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h)
AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
AC_CHECK_HEADERS(ncurses.h signal.h ctype.h regex.h)
#
# Other configure scripts
#
-#AC_CONFIG_SUBDIRS(lib/dotconf)
-AC_CONFIG_SUBDIRS(lib/trq)
AC_CONFIG_SUBDIRS(irssi)
AC_CONFIG_SUBDIRS(lib/silcmath/mpi)
#AC_CONFIG_SUBDIRS(lib/zlib)
# Irssi SILC Client distribution
client_SUBDIRS=lib irssi doc includes
-client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcclient silcsftp
+client_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil silcclient silcsftp
client_SUBDIRS_doc=$(COMMONDIRS)
client_DISTLABEL=SILC_DIST_CLIENT
client_EXTRA_DIST=#
# SILC Server distribution
server_SUBDIRS=lib silcd doc includes
-server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil trq silcsftp
+server_SUBDIRS_lib=contrib silccore silccrypt silcsim silcmath silcske silcutil silcsftp
server_SUBDIRS_doc=$(COMMONDIRS)
server_DISTLABEL=SILC_DIST_SERVER
server_EXTRA_DIST=#
# Native WIN32 SILC library distribution (will include only the libraries)
# XXX This is not really used at all!
win32dll_SUBDIRS=lib doc includes
-win32dll_SUBDIRS_lib=silccore silccrypt silcsim silcmath silcske silcutil trq silcclient
+win32dll_SUBDIRS_lib=silccore silccrypt silcsim silcmath silcske silcutil silcclient
win32dll_SUBDIRS_doc=$(COMMONDIRS)
win32dll_DISTLABEL=SILC_DIST_WIN32DLL
win32dll_EXTRA_DIST=README.CVS README.WIN32
=====
SILC has two different list API's. The List API and the Dynamic List API.
-Both are based on the TRQ library. For definitions of List API see
-lib/trq/silclist.h and for Dynamic List API see lib/trq/silcdlist.h.
-Following short example of the List API.
+For definitions of List API see lib/silcutil/silclist.h and for Dynamic
+List API see lib/silcutil/silcdlist.h. Following short example of the
+List API.
List API
#include <pthread.h>
#endif
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
#endif /* !SILC_WIN32 */
#ifndef HAVE_GETOPT_LONG
#define FALSE 0
#endif
+/* Define offsetof */
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
/* Define types. The types must be at least of the specified size */
#undef uint8
#undef uint16
#include "silchashtable.h"
#include "silclog.h"
#include "silcmemory.h"
+#include "silclist.h"
+#include "silcdlist.h"
#include "silcbuffer.h"
#include "silcbufutil.h"
#include "silcbuffmt.h"
#include "silcauth.h"
#include "silcprivate.h"
-/* TRQ (SilcList API and SilcDList API) */
-#include "silclist.h"
-#include "silcdlist.h"
-
#ifdef SILC_SIM
/* SILC Module library includes */
#include "silcsim.h"
silcske \
silcutil \
silcclient \
- silcsftp \
- trq
-# dotconf
+ silcsftp
# zlib
SUBDIRS = SILC_DISTRIBUTION_SUBDIRS
silcmath \
silcske \
silcutil \
- silcsftp \
- trq
-# dotconf
+ silcsftp
# SILC Client Library dirs
SILCCLIENTLIB_DIRS = \
SilcClient client = (SilcClient)ctx->client;
client->internal->ops->connect(client, ctx->sock->user_data, FALSE);
+ if (ctx->packet)
+ silc_packet_context_free(ctx->packet);
silc_free(ctx);
}
if (proto_ctx->packet)
silc_packet_context_free(proto_ctx->packet);
-
+ if (proto_ctx->dest_id)
+ silc_free(proto_ctx->dest_id);
proto_ctx->packet = silc_packet_context_dup(packet);
proto_ctx->dest_id_type = packet->src_id_type;
proto_ctx->dest_id = silc_id_str2id(packet->src_id, packet->src_id_len,
/* Clear ID caches */
if (conn->client_cache)
- silc_idcache_del_all(conn->client_cache);
+ silc_idcache_free(conn->client_cache);
if (conn->channel_cache)
- silc_idcache_del_all(conn->channel_cache);
+ silc_idcache_free(conn->channel_cache);
if (conn->server_cache)
- silc_idcache_del_all(conn->server_cache);
+ silc_idcache_free(conn->server_cache);
/* Free data (my ID is freed in above silc_client_del_client) */
+ if (conn->nickname)
+ silc_free(conn->nickname);
if (conn->remote_host)
silc_free(conn->remote_host);
if (conn->local_id_data)
if (!conn->local_entry)
conn->local_entry = silc_calloc(1, sizeof(*conn->local_entry));
- conn->local_entry->nickname = conn->nickname;
+ conn->local_entry->nickname = strdup(conn->nickname);
if (!conn->local_entry->username)
conn->local_entry->username = strdup(client->username);
if (!conn->local_entry->hostname)
SILC_CLIENT_CMDU(leave, LEAVE, "LEAVE");
SILC_CLIENT_CMDU(users, USERS, "USERS");
SILC_CLIENT_CMDU(getkey, GETKEY, "GETKEY");
-
- silc_list_uninit(client->internal->commands);
}
silc_free(client_entry->nickname);
silc_free(client_entry->username);
silc_free(client_entry->realname);
+ silc_free(client_entry->hostname);
silc_free(client_entry->server);
silc_free(client_entry->id);
silc_free(client_entry->fingerprint);
while ((entry = silc_dlist_get(silc_cipher_list)) != SILC_LIST_END) {
if (cipher == SILC_ALL_CIPHERS || entry == cipher) {
silc_dlist_del(silc_cipher_list, entry);
+ silc_free(entry->name);
+ silc_free(entry);
if (silc_dlist_count(silc_cipher_list) == 0) {
silc_dlist_uninit(silc_cipher_list);
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
uint32 data_len)
{
+ SilcHash new_hash = NULL;
unsigned char h[32];
+ char *ret;
- if (!hash)
- silc_hash_alloc("sha1", &hash);
+ if (!hash) {
+ silc_hash_alloc("sha1", &new_hash);
+ hash = new_hash;
+ }
silc_hash_make(hash, data, data_len, h);
- return silc_fingerprint(h, hash->hash->hash_len);
+ ret = silc_fingerprint(h, hash->hash->hash_len);
+
+ if (new_hash != NULL)
+ silc_hash_free(new_hash);
+ return ret;
}
static const char vo[]= "aeiouy";
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
uint32 data_len)
{
+ SilcHash new_hash = NULL;
char *babbleprint;
unsigned char hval[32];
unsigned int a, b, c, d, e, check;
int i, k, out_len;
- if (!hash)
- silc_hash_alloc("sha1", &hash);
+ if (!hash) {
+ silc_hash_alloc("sha1", &new_hash);
+ hash = new_hash;
+ }
/* Take fingerprint */
silc_hash_make(hash, data, data_len, hval);
}
babbleprint[k + 3] = co[16];
+ if (new_hash != NULL)
+ silc_hash_free(new_hash);
return babbleprint;
}
break;
case SILC_PKCS_FILE_PEM:
data = silc_decode_pem(data, len, &len);
+ memset(old, 0, data_len);
+ silc_free(old);
+ old = data;
+ data_len = len;
break;
}
pclose(fd);
/* Add the buffer into random pool */
- silc_rng_add_noise(rng, buf, strlen(buf));
+ silc_rng_add_noise(rng, buf, i);
memset(buf, 0, sizeof(buf));
#endif
}
{
SilcSFTPClient sftp = (SilcSFTPClient)context;
- silc_list_uninit(sftp->requests);
if (sftp->packet)
silc_buffer_free(sftp->packet);
silc_free(sftp);
silcsockconn.h \
silcprotocol.h \
silcthread.h \
+ silclist.h \
+ silcdlist.h \
silcutil.h
endif
/* Inline functions */
-extern inline
+static inline
SilcBuffer silc_buffer_alloc(uint32 len)
{
SilcBuffer sb;
/* Free's a SilcBuffer */
-extern inline
+static inline
void silc_buffer_free(SilcBuffer sb)
{
if (sb) {
can be used to set the data to static buffer without needing any
memory allocations. The `data' will not be copied to the buffer. */
-extern inline
+static inline
void silc_buffer_set(SilcBuffer sb, unsigned char *data, uint32 data_len)
{
sb->data = sb->head = data;
^
*/
-extern inline
+static inline
unsigned char *silc_buffer_pull(SilcBuffer sb, uint32 len)
{
unsigned char *old_data = sb->data;
^
*/
-extern inline
+static inline
unsigned char *silc_buffer_push(SilcBuffer sb, uint32 len)
{
unsigned char *old_data = sb->data;
^
*/
-extern inline
+static inline
unsigned char *silc_buffer_pull_tail(SilcBuffer sb, uint32 len)
{
unsigned char *old_tail = sb->tail;
^
*/
-extern inline
+static inline
unsigned char *silc_buffer_push_tail(SilcBuffer sb, uint32 len)
{
unsigned char *old_tail = sb->tail;
Puts data to the head section.
*/
-extern inline
+static inline
unsigned char *silc_buffer_put_head(SilcBuffer sb,
const unsigned char *data,
uint32 len)
Puts data to the data section.
*/
-extern inline
+static inline
unsigned char *silc_buffer_put(SilcBuffer sb,
const unsigned char *data,
uint32 len)
Puts data to the tail section.
*/
-extern inline
+static inline
unsigned char *silc_buffer_put_tail(SilcBuffer sb,
const unsigned char *data,
uint32 len)
/* Clears and initialiazes the buffer to the state as if it was just
allocated by silc_buffer_alloc. */
-extern inline
+static inline
void silc_buffer_clear(SilcBuffer sb)
{
memset(sb->head, 0, sb->truelen);
currently valid data area, nothing more. Use silc_buffer_clone to
copy entire buffer. */
-extern inline
+static inline
SilcBuffer silc_buffer_copy(SilcBuffer sb)
{
SilcBuffer sb_new;
everything from the source buffer. The result is exact clone of
the original buffer. */
-extern inline
+static inline
SilcBuffer silc_buffer_clone(SilcBuffer sb)
{
SilcBuffer sb_new;
new SilcBuffer pointer. The buffer is exact clone of the old one
except that there is now more space at the end of buffer. */
-extern inline
+static inline
SilcBuffer silc_buffer_realloc(SilcBuffer sb, uint32 newsize)
{
SilcBuffer sb_new;
--- /dev/null
+/*
+
+ silcdlist.h
+
+ Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+ Copyright (C) 2000 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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.
+
+*/
+
+#ifndef SILDCLIST_H
+#define SILDCLIST_H
+
+#include "silclist.h"
+
+/*
+ SILC Dynamic List API
+
+ SILC Dynamic List API can be used to add opaque contexts to list that will
+ automatically allocate list entries. Normal SILC List API cannot be used
+ for this purpose because in that case the context passed to the list must
+ be defined as list structure already. This is not the case in SilcDList.
+
+ This is slower than SilcList because this requires one extra memory
+ allocation when adding new entries to the list. The context is probably
+ allocated already and the new list entry requires one additional memory
+ allocation. The memory allocation and free'ing is done automatically in
+ the API and does not show to the caller.
+
+ I left sorting functions out because I don't know whether we need them.
+ If needed, just copy them from silclist.h
+
+*/
+
+/* SilcDList object. This is the actual SilcDList object that is used by
+ application. Application defines this object and adds context's to this
+ list with functions defined below. */
+typedef struct {
+ SilcList list;
+} *SilcDList;
+
+/* SilcDListEntry structure, one entry in the list. This MUST NOT be used
+ directly by the application. */
+typedef struct SilcDListEntryStruct {
+ void *context;
+ struct SilcDListEntryStruct *next;
+} *SilcDListEntry;
+
+/* Initializes SilcDList. */
+
+static inline
+SilcDList silc_dlist_init()
+{
+ SilcDList list;
+
+ list = (SilcDList)silc_calloc(1, sizeof(*list));
+ silc_list_init(list->list, struct SilcDListEntryStruct, next);
+
+ return list;
+}
+
+/* Uninits and free's all memory. Must be called to free memory. Does NOT
+ free the contexts saved by caller. */
+
+static inline
+void silc_dlist_uninit(SilcDList list)
+{
+ if (list) {
+ SilcDListEntry e;
+ silc_list_start(list->list);
+ while ((e = (SilcDListEntry)silc_list_get(list->list)) != SILC_LIST_END) {
+ silc_list_del(list->list, e);
+ silc_free(e);
+ }
+ silc_free(list);
+ }
+}
+
+/* Return the number of entries in the list */
+
+static inline
+int silc_dlist_count(SilcDList list)
+{
+ return silc_list_count(list->list);
+}
+
+/* Set the start of the list. This prepares the list for traversing entries
+ from the start of the list. */
+
+static inline
+void silc_dlist_start(SilcDList list)
+{
+ silc_list_start(list->list);
+}
+
+/* Adds new entry to the list. This is the default function to add new
+ entries to the list. */
+
+static inline
+void silc_dlist_add(SilcDList list, void *context)
+{
+ SilcDListEntry e = (SilcDListEntry)silc_calloc(1, sizeof(*e));
+ e->context = context;
+ silc_list_add(list->list, e);
+}
+
+/* Remove entry from the list. Returns < 0 on error, 0 otherwise. */
+
+static inline
+void silc_dlist_del(SilcDList list, void *context)
+{
+ SilcDListEntry e;
+
+ silc_list_start(list->list);
+ while ((e = (SilcDListEntry)silc_list_get(list->list)) != SILC_LIST_END) {
+ if (e->context == context) {
+ silc_list_del(list->list, e);
+ silc_free(e);
+ break;
+ }
+ }
+}
+
+/* Returns current entry from the list and moves the list pointer forward
+ so that calling this next time returns the next entry from the list. This
+ can be used to traverse the list. Return SILC_LIST_END when the entire
+ list has ben traversed. Later, silc_list_start must be called again when
+ re-starting list traversing. Example:
+
+ // Traverse the list from the beginning to the end
+ silc_dlist_start(list)
+ while ((entry = silc_dlist_get(list)) != SILC_LIST_END) {
+ ...
+ }
+
+*/
+static inline
+void *silc_dlist_get(SilcDList list)
+{
+ SilcDListEntry e = (SilcDListEntry)silc_list_get(list->list);
+ if (e != SILC_LIST_END)
+ return e->context;
+ return SILC_LIST_END;
+}
+
+#endif
--- /dev/null
+/*
+
+ silclist.h
+
+ Author: Timo Sirainen <tss@iki.fi>
+
+ Copyright (C) 2002 Timo Sirainen
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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.
+
+*/
+
+/****h* silcutil/SilcList
+ *
+ * DESCRIPTION
+ *
+ * Implementation of the SilcList interface. This interface provides
+ * simple linked list.
+ *
+ ***/
+
+#ifndef SILCLIST_H
+#define SILCLIST_H
+
+/****s* silcutil/SilcList/SilcList
+ *
+ * NAME
+ *
+ * typedef struct { ... } SilcList;
+ *
+ * DESCRIPTION
+ *
+ * This is the SilcList context, and is initialized by calling the
+ * function silc_list_init.
+ *
+ * EXAMPLE
+ *
+ * SilcList list;
+ * silc_list_init(list, struct SilcInternalEntryStruct, next);
+ *
+ ***/
+typedef struct {
+ void *head, *tail;
+ void *current;
+ int offset;
+} SilcList;
+
+/****d* silcutil/SilcList/SILC_LIST_END
+ *
+ * NAME
+ *
+ * #define SILC_LIST_END ...
+ *
+ * DESCRIPTION
+ *
+ * Functions return this when the list is invalid or when traversing
+ * the list there is no more entires in the list.
+ *
+ * SOURCE
+ */
+#define SILC_LIST_END NULL
+/***/
+
+/* Initializes SilcList object. Example:
+
+ SilcList list;
+
+ silc_list_init(list, struct SilcInternalEntryStruct, next);
+
+ Where `list' is the defined list, and second argument is the structure
+ of the entries in the list and last argument is the pointer in the entry
+ structure that is used as list member. SilcInternalEntry might be as
+ follows:
+
+ struct SilcInternalEntryStruct {
+ char *dummy;
+ struct SilcInternalEntryStruct *next; // The list member pointer
+ };
+
+ The `next' pointer in the structure (or some other pointer for that matter)
+ is given for the silc_list_init as the last argument. This pointer is used
+ by the list routines to link the entries together in the list. Your code
+ should not touch the member pointer manually.
+*/
+
+/****f* silcutil/SilcList/silc_list_init
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_init(list, type, field) ...
+ *
+ * DESCRIPTION
+ *
+ * This macro initializes the SilcList list. The `list' is the defined
+ * list, second argument is the structure of the entries in the list,
+ * and last argument is the pointer in the entry structure that is used
+ * as list member. When using SilcList, you should not touch the
+ * structure member pointer (the `next' for example) manually.
+ *
+ * EXAMPLE
+ *
+ * struct SilcInternalEntryStruct {
+ * char *dummy;
+ * struct SilcInternalEntryStruct *next; // The list member pointer
+ * };
+ *
+ * SilcList list;
+ * silc_list_init(list, struct SilcInternalEntryStruct, next);
+ *
+ ***/
+#define silc_list_init(list, type, field) \
+ __silc_list_init(&(list), offsetof(type, field))
+
+static inline void __silc_list_init(SilcList *list, int offset)
+{
+ list->head = list->tail = list->current = SILC_LIST_END;
+ list->offset = offset;
+}
+
+#define list_next(list, pos) ((void **) ((char *) (pos) + (list)->offset))
+
+/****f* silcutil/SilcList/silc_list_count
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_count(list) ...
+ *
+ * DESCRIPTION
+ *
+ * Returns the number of entries in the list indicated by `list'.
+ *
+ ***/
+#define silc_list_count(list) __silc_list_count(&(list))
+static inline int __silc_list_count(SilcList *list)
+{
+ int count = 0;
+ void *pos;
+
+ for (pos = list->head; pos != NULL; pos = *list_next(list, pos))
+ count++;
+
+ return count;
+}
+
+/****f* silcutil/SilcList/silc_list_start
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_start(list) ...
+ *
+ * DESCRIPTION
+ *
+ * Sets the start of the list. This prepares the list for traversing
+ * the entries from the start of the list.
+ *
+ ***/
+#define silc_list_start(list) (list).current = (list).head;
+
+/****f* silcutil/SilcList/silc_list_add
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_add(list, entry) ...
+ *
+ * DESCRIPTION
+ *
+ * Adds new entry indicated by `entry' to the end of the list indicated
+ * by `list'.
+ *
+ ***/
+#define silc_list_add(list, entry) __silc_list_add(&(list), entry)
+static inline void __silc_list_add(SilcList *list, void *data)
+{
+ if (list->head == NULL)
+ list->head = data;
+ else
+ *list_next(list, list->tail) = data;
+
+ list->tail = data;
+ *list_next(list, data) = NULL;
+}
+
+/****f* silcutil/SilcList/silc_list_del
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_del(list, entry) ...
+ *
+ * DESCRIPTION
+ *
+ * Remove entry indicated by `entry' from the list indicated by `list'.
+ *
+ ***/
+#define silc_list_del(list, data) __silc_list_del(&(list), data)
+static inline void __silc_list_del(SilcList *list, void *data)
+{
+ void **pos, *prev;
+
+ prev = NULL;
+ for (pos = &list->head; *pos != NULL; pos = list_next(list, *pos)) {
+ if (*pos == data) {
+ *pos = *list_next(list, data);
+ if (list->current == data)
+ list->current = *pos;
+ break;
+ }
+
+ prev = *pos;
+ }
+
+ if (data == list->tail)
+ list->tail = prev;
+}
+
+/****f* silcutil/SilcList/silc_list_get
+ *
+ * SYNOPSIS
+ *
+ * #define silc_list_get(list, entry) ...
+ *
+ * DESCRIPTION
+ *
+ * Returns the current entry from the list indicated by `list' and
+ * moves the list pointer forward so that calling this next time will
+ * return the next entry from the list. This can be used to traverse
+ * the list. Returns SILC_LIST_END when the entire list has been
+ * tarversed and no additional entries exist in the list. Later,
+ * silc_list_start must be called again when re-starting the list
+ * tarversing.
+ *
+ * EXAMPLE
+ *
+ * // Traverse the list from the beginning to the end
+ * silc_list_start(list)
+ * while ((entry = silc_list_get(list)) != SILC_LIST_END) {
+ * ...
+ * }
+ *
+ ***/
+#define silc_list_get(x) __silc_list_get(&(x))
+
+static inline
+void *__silc_list_get(SilcList *list)
+{
+ void *pos;
+
+ pos = list->current;
+ if (pos != NULL)
+ list->current = *list_next(list, pos);
+ return pos;
+}
+
+#endif
autoheader >/dev/null 2>/dev/null
automake
-echo "Preparing trq"
-cd lib/trq
-aclocal
-autoconf
-autoheader </dev/null 2>/dev/null
-automake >/dev/null 2>/dev/null
-cd ../..
-
echo "Preparing mpi"
cd lib/silcmath/mpi
aclocal
echo "All errors and warnings may be safely ignored."
$MAKE clean -k
$MAKE distclean -k
-rm -f ltmain.sh
-rm -f ltconfig
rm -f ltcf*
rm -f Makefile.am
rm -f Makefile.defines
rm -f lib/silcsim/Makefile.in
rm -f lib/silcsim/modules/Makefile.in
rm -f lib/silcske/Makefile.in
-rm -f lib/trq/tests/Makefile
-rm -f lib/trq/trq_test/Makefile
rm -rf lib/silcmath/gmp/.deps
rm -f silcd/Makefile.in silcd/log* silcd/*.log
rm -f silc/Makefile.in silc/log* silc/*.log
SUBDIRS = libsilc libsilcclient
-EXTRA_DIST = silcdefs.h trq_conf.h silc.dsw copy_dll
+EXTRA_DIST = silcdefs.h silc.dsw copy_dll
include $(top_srcdir)/Makefile.defines.in
silc_twofish_encrypt_cbc @ 718 ;
silc_twofish_set_key @ 719 ;
silc_twofish_set_key_with_string @ 720 ;
- trq_deque_bubblesort @ 724 ;
- trq_deque_clear___func @ 725 ;
- trq_deque_compatible___func @ 726 ;
- trq_deque_empty_p___func @ 727 ;
- trq_deque_find @ 728 ;
- trq_deque_get_head___func @ 729 ;
- trq_deque_get_nth @ 730 ;
- trq_deque_get_tail___func @ 731 ;
- trq_deque_in_order @ 732 ;
- trq_deque_init_with_offset___func @ 733 ;
- trq_deque_insert_head___func @ 734 ;
- trq_deque_insert_in_order @ 735 ;
- trq_deque_insert_nth @ 736 ;
- trq_deque_insert_tail___func @ 737 ;
- trq_deque_insertionsort @ 738 ;
- trq_deque_join_head @ 739 ;
- trq_deque_join_tail @ 740 ;
- trq_deque_length___func @ 741 ;
- trq_deque_mapcar @ 742 ;
- trq_deque_mapcar_reverse @ 743 ;
- trq_deque_member @ 744 ;
- trq_deque_mergesort @ 745 ;
- trq_deque_quicksort @ 746 ;
- trq_deque_remove @ 747 ;
- trq_deque_reverse___func @ 748 ;
- trq_deque_swap @ 749 ;
- trq_deque_to_list @ 750 ;
- trq_list_bubblesort @ 751 ;
- trq_list_bw @ 752 ;
- trq_list_clear___func @ 753 ;
- trq_list_compatible___func @ 754 ;
- trq_list_current___func @ 755 ;
- trq_list_end___func @ 756 ;
- trq_list_find @ 757 ;
- trq_list_fw @ 758 ;
- trq_list_get_bw___func @ 759 ;
- trq_list_get_fw___func @ 760 ;
- trq_list_get_head___func @ 761 ;
- trq_list_get_nth @ 762 ;
- trq_list_get_tail___func @ 763 ;
- trq_list_in_order @ 764 ;
- trq_list_insert_head___func @ 765 ;
- trq_list_insert_in_order @ 766 ;
- trq_list_insert_nth @ 767 ;
- trq_list_insert_tail___func @ 768 ;
- trq_list_insertionsort @ 769 ;
- trq_list_join_head @ 770 ;
- trq_list_join_tail @ 771 ;
- trq_list_length___func @ 772 ;
- trq_list_mapcar @ 773 ;
- trq_list_mapcar_reverse @ 774 ;
- trq_list_member @ 775 ;
- trq_list_mergesort @ 776 ;
- trq_list_pointer_invalidate___func @ 777 ;
- trq_list_pointer_valid___func @ 778 ;
- trq_list_put_after___func @ 779 ;
- trq_list_put_before___func @ 780 ;
- trq_list_quicksort @ 781 ;
- trq_list_remove___func @ 782 ;
- trq_list_reverse @ 783 ;
- trq_list_rewind___func @ 784 ;
- trq_list_rewind_find @ 785 ;
- trq_list_rewind_to @ 786 ;
- trq_list_swap @ 787 ;
- trq_list_to_deque @ 788 ;
silc_buffer_format_vp @ 789 ;
silc_buffer_unformat_vp @ 790 ;
silc_sftp_client_start @ 791 ;
+++ /dev/null
-/* -*- c -*-\r
- * \r
- * ----------------------------------------------------------------------\r
- * Deque for struct type with only one link pointer (x->next).\r
- * ----------------------------------------------------------------------\r
- * Created : Fri Dec 5 11:19:37 1997 tri\r
- * Last modified: Thu Apr 16 17:35:57 1998 tri\r
- * ----------------------------------------------------------------------\r
- * Copyright © 1995-1998\r
- * Timo J. Rinne <tri@iki.fi>\r
- * All rights reserved. See file COPYRIGHT for details.\r
- * \r
- * Address: Cirion oy, PO-BOX 250, 00121 Helsinki, Finland\r
- * ----------------------------------------------------------------------\r
- * Any express or implied warranties are disclaimed. In no event\r
- * shall the author be liable for any damages caused (directly or\r
- * otherwise) by the use of this software.\r
- *\r
- * Please, send your patches to <tri@iki.fi>.\r
- * ----------------------------------------------------------------------\r
- *\r
- * $Id$\r
- *\r
- * $Log$
- * Revision 1.1 2001/07/23 11:07:56 priikone
- * updates.
- *\r
- * Revision 1.1.1.1 2000/10/31 19:59:30 priikone\r
- * Imported TRQ and SilList and SilcDList API's.\r
- *\r
- * Revision 1.1 1998/04/16 14:39:42 tri\r
- * Initial revision\r
- *\r
- *\r
- */\r
-#ifndef __TRQ_CONF__H__\r
-#define __TRQ_CONF__H__ 1\r
-\r
-/*\r
- * stddef.h is included here if such file exists.\r
- * offsetof should be defined there.\r
- */\r
-#include <stddef.h>\r
-\r
-/*\r
- * If compiler supports inline functions, __TRQ__INLINE__FUNCTION__\r
- * is defined to the correct keyword. Usually this is defined\r
- * as inline, __inline__ or __inline. If inline functions are\r
- * not supported, __TRQ__INLINE__FUNCTION__ is undefined.\r
- */\r
-#define __TRQ__INLINE__FUNCTION__ __inline\r
-\r
-typedef unsigned long trq_p_i_t; /* Integral type size of an pointer */\r
-\r
-#ifdef offsetof\r
-#define _Q_STRUCT_OFFSET(t, m) ((trq_p_i_t)(offsetof(t, m)))\r
-#else\r
-#define _Q_STRUCT_OFFSET(t, m) (((trq_p_i_t)(&(((t *)0)->m))))\r
-#endif\r
-\r
-#endif /* !__TRQ_CONF__H__ */\r
-/* eof (trq_conf.h) */\r