Change silc_buffer_*len macros to inline functions.
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcClientStatsStruct {
SilcUInt32 starttime; /* SILC server start time */
SilcUInt32 uptime; /* SILC server uptime*/
SilcUInt32 my_clients; /* Number of clients in the server */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcPrivateMessageKeysStruct {
SilcClientEntry client_entry; /* The remote client entry */
char *cipher; /* The cipher name */
unsigned char *key; /* The original key, If the appliation
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcClientOperationsStruct {
/* Message sent to the application by library. `conn' associates the
message to a specific connection. `conn', however, may be NULL.
The `type' indicates the type of the message sent by the library.
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcClientParamsStruct {
/* If this boolean is set to TRUE then the client library will use
threads. Any of the callback functions in the SilcClientOperations
and other callbacks may be called at any time in a thread. The
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcClientConnectionParamsStruct {
/* If this is provided the user's nickname in the network will be the
string given here. If it is given, it must be UTF-8 encoded. If this
string is not given, the user's username by default is used as nickname.
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
* of freeing the contents of the structure and the structure itself.
*
***/
-typedef struct {
+typedef struct SilcArgumentDecodedListStruct {
void *argument; /* Decoded argument, caller must know its type */
SilcUInt32 arg_type; /* Argument type number from the payload */
} *SilcArgumentDecodedList;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcIDIPStruct {
unsigned char data[16]; /* IP data (in MSB first order) */
SilcUInt8 data_len; /* Length of the data (4 or 16) */
} SilcIDIP;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcServerIDStruct {
SilcIDIP ip; /* n bit IP address */
SilcUInt16 port; /* 16 bit port */
SilcUInt16 rnd; /* 16 bit random number */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcClientIDStruct {
SilcIDIP ip; /* n bit IP address */
unsigned char rnd; /* 8 bit random number */
unsigned char hash[CLIENTID_HASH_LEN]; /* 88 bit MD5 hash */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcChannelIDStruct {
SilcIDIP ip; /* n bit IP address */
SilcUInt16 port; /* 16 bit port */
SilcUInt16 rnd; /* 16 bit random number */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcIDStruct {
union {
SilcServerID server_id;
SilcChannelID channel_id;
/* Export PKCS algorithm public key */
if (pkcs->export_public_key)
pk = pkcs->export_public_key(silc_pubkey->public_key, &pk_len);
- if (!pk)
+ if (!pk) {
+ SILC_LOG_ERROR(("Error exporting PKCS algorithm key"));
return NULL;
+ }
silc_buffer_set(&alg_key, pk, pk_len);
/* Encode identifier */
silc_pubkey->identifier.org,
silc_pubkey->identifier.country,
silc_pubkey->identifier.version);
- if (!identifier)
+ if (!identifier) {
+ SILC_LOG_ERROR(("Error encoding SILC public key identifier"));
goto err;
+ }
asn1 = silc_asn1_alloc();
if (!asn1)
goto err;
} else {
- SILC_LOG_DEBUG(("Unsupported PKCS algorithm"));
+ SILC_LOG_ERROR(("Unsupported PKCS algorithm: %s", pkcs->name));
goto err;
}
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcPublicKeyIdentifierObject {
char *username;
char *host;
char *realname;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSILCPublicKeyStruct {
SilcPublicKeyIdentifierStruct identifier;
const SilcPKCSAlgorithm *pkcs; /* PKCS algorithm */
void *public_key; /* PKCS algorithm specific public key */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSILCPrivateKeyStruct {
const SilcPKCSAlgorithm *pkcs; /* PKCS algorithm */
void *private_key; /* PKCS algorithm specific private key */
} *SilcSILCPrivateKey;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcPublicKeyStruct {
const SilcPKCSObject *pkcs; /* PKCS */
void *public_key; /* PKCS specific public key */
} *SilcPublicKey;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcPrivateKeyStruct {
const SilcPKCSObject *pkcs; /* PKCS */
void *private_key; /* PKCS specific private key */
} *SilcPrivateKey;
* server, and by server to return file attributes to the client.
*
***/
-typedef struct {
+typedef struct SilcSFTPAttributesObject {
SilcUInt32 flags; /* Flags to indicate present attributes */
SilcUInt64 size; /* Sife of the file in bytes */
SilcUInt32 uid; /* Unix user ID */
* example when reading the contents of a directory.
*
***/
-typedef struct {
+typedef struct SilcSFTPNameObject {
char **filename;
char **long_filename;
SilcSFTPAttributes *attrs;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSFTPMonitorDataObject {
SilcSFTPVersion version; /* _INIT */
char *name; /* _OPEN, _REMOVE, _RENAME, _MKDIR,
_RMDIR, _OPENDIR, _STAT, _LSTAT,
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSFTPFilesystemStruct {
SilcSFTPFilesystemOps fs;
void *fs_context;
} *SilcSFTPFilesystem;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSKESecurityPropertiesStruct {
SilcSKESecurityPropertyFlag flags; /* Flags */
SilcSKEDiffieHellmanGroup group; /* Selected Diffie Hellman group */
SilcCipher cipher; /* Selected cipher */
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSKEKeyMaterialStruct {
unsigned char *send_iv;
unsigned char *receive_iv;
SilcUInt32 iv_len;
* function.
*
***/
-typedef struct {
+typedef struct SilcSKERekeyMaterialStruct {
unsigned char *send_enc_key;
char *hash;
unsigned int enc_key_len : 23;
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcSKEParamsObject {
/* The SKE version string that is sent to the remote end. This field
must be set. Caller must free the pointer. */
char *version;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1998 - 2006 Pekka Riikonen
+ Copyright (C) 1998 - 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
*
* SOURCE
*/
-typedef struct {
+typedef struct SilcBufferObject {
unsigned char *head;
unsigned char *data;
unsigned char *tail;
/* Macros */
-/****d* silcutil/SilcBufferAPI/silc_buffer_truelen
+/****f* silcutil/SilcBufferAPI/silc_buffer_data
*
* NAME
*
- * SilcUInt32 silc_buffer_truelen(SilcBuffer sb)
+ * unsigned char *silc_buffer_data(SilcBuffer sb)
*
* DESCRIPTION
*
- * Returns the true length of the buffer.
+ * Returns pointer to the data area of the buffer.
*
* SOURCE
*/
-#define silc_buffer_truelen(x) (SilcUInt32)((x)->end - (x)->head)
+#define silc_buffer_data(x) (x)->data
/***/
-/****d* silcutil/SilcBufferAPI/silc_buffer_len
+/****f* silcutil/SilcBufferAPI/silc_buffer_datalen
*
* NAME
*
- * SilcUInt32 silc_buffer_len(SilcBuffer sb)
+ * #define silc_buffer_datalen ...
*
* DESCRIPTION
*
- * Returns the current length of the data area of the buffer.
+ * Macro that can be used in function argument list to give the data
+ * pointer and the data length, instead of calling both silc_buffer_data
+ * and silc_buffer_len separately.
+ *
+ * EXAMPLE
+ *
+ * // Following are the same thing
+ * silc_foo_function(foo, silc_buffer_datalen(buf));
+ * silc_foo_function(foo, silc_buffer_data(buf), silc_buffer_len(buf));
*
* SOURCE
*/
-#define silc_buffer_len(x) (SilcUInt32)((x)->tail - (x)->data)
+#define silc_buffer_datalen(x) (x) ? silc_buffer_data((x)) : NULL, \
+ (x) ? silc_buffer_len((x)) : 0
/***/
-/****d* silcutil/SilcBufferAPI/silc_buffer_headlen
+/* Inline functions */
+
+/****d* silcutil/SilcBufferAPI/silc_buffer_truelen
*
* NAME
*
- * SilcUInt32 silc_buffer_headlen(SilcBuffer sb)
+ * SilcUInt32 silc_buffer_truelen(SilcBuffer sb)
*
* DESCRIPTION
*
- * Returns the current length of the head data area of the buffer.
+ * Returns the true length of the buffer.
*
- * SOURCE
- */
-#define silc_buffer_headlen(x) (SilcUInt32)((x)->data - (x)->head)
-/***/
+ ***/
+static inline
+SilcUInt32 silc_buffer_truelen(SilcBuffer x)
+{
+ return (SilcUInt32)(x->end - x->head);
+}
-/****d* silcutil/SilcBufferAPI/silc_buffer_taillen
+/****d* silcutil/SilcBufferAPI/silc_buffer_len
*
* NAME
*
- * SilcUInt32 silc_buffer_taillen(SilcBuffer sb)
+ * SilcUInt32 silc_buffer_len(SilcBuffer sb)
*
* DESCRIPTION
*
- * Returns the current length of the tail data area of the buffer.
+ * Returns the current length of the data area of the buffer.
*
- * SOURCE
- */
-#define silc_buffer_taillen(x) (SilcUInt32)((x)->end - (x)->tail)
-/***/
+ ***/
+static inline
+SilcUInt32 silc_buffer_len(SilcBuffer x)
+{
+ return (SilcUInt32)(x->tail - x->data);
+}
-/****f* silcutil/SilcBufferAPI/silc_buffer_data
+/****d* silcutil/SilcBufferAPI/silc_buffer_headlen
*
* NAME
*
- * unsigned char *silc_buffer_data(SilcBuffer sb)
+ * SilcUInt32 silc_buffer_headlen(SilcBuffer sb)
*
* DESCRIPTION
*
- * Returns pointer to the data area of the buffer.
+ * Returns the current length of the head data area of the buffer.
*
- * SOURCE
- */
-#define silc_buffer_data(x) (x)->data
-/***/
+ ***/
+static inline
+SilcUInt32 silc_buffer_headlen(SilcBuffer x)
+{
+ return (SilcUInt32)(x->data - x->head);
+}
-/****f* silcutil/SilcBufferAPI/silc_buffer_datalen
+/****d* silcutil/SilcBufferAPI/silc_buffer_taillen
*
* NAME
*
- * #define silc_buffer_datalen ...
+ * SilcUInt32 silc_buffer_taillen(SilcBuffer sb)
*
* DESCRIPTION
*
- * Macro that can be used in function argument list to give the data
- * pointer and the data length, instead of calling both silc_buffer_data
- * and silc_buffer_len separately.
- *
- * EXAMPLE
- *
- * // Following are the same thing
- * silc_foo_function(foo, silc_buffer_datalen(buf));
- * silc_foo_function(foo, silc_buffer_data(buf), silc_buffer_len(buf));
+ * Returns the current length of the tail data area of the buffer.
*
- * SOURCE
- */
-#define silc_buffer_datalen(x) (x) ? silc_buffer_data((x)) : NULL, \
- (x) ? silc_buffer_len((x)) : 0
-/***/
-
-/* Inline functions */
+ ***/
+static inline
+SilcUInt32 silc_buffer_taillen(SilcBuffer x)
+{
+ return (SilcUInt32)(x->end - x->tail);
+}
/****f* silcutil/SilcBufferAPI/silc_buffer_alloc
*
* function silc_list_init.
*
***/
-typedef struct {
+typedef struct SilcListStruct {
void *head; /* Start of the list */
void *tail; /* End of the list */
void *current; /* Current pointer in list */
* SOURCE
*
***/
-typedef struct {
+typedef struct SilcTimeObject {
unsigned int year : 15; /* Year, 0 - 32768 */
unsigned int month : 4; /* Month, 1 - 12 */
unsigned int day : 5; /* Day, 1 - 31 */
*
* DESCRIPTION
*
- * Compares `t1' and `t2' time structures and returns less than zero,
+ * Compares `t1' and `t2' time structures and returns less than zero,
* zero or more than zero when `t1' is smaller, equal or bigger than
* `t2', respectively.
*