+Sun Feb 24 12:53:25 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Changed all integer type names:
+ [u]int[8/16/32/64] -> Silc[UInt/Int][8/16/32/64]. This is
+ to avoid collisions with other libraries using same type names
+ as we did.
+
Sat Feb 23 20:31:43 EET 2002 Pekka Riikonen <priikone@silcnet.org>
* Added `prefer_ipv6' argument to the functions
static void
silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
const char *name, SilcSocketType conn_type,
- unsigned char *pk, uint32 pk_len,
+ unsigned char *pk, SilcUInt32 pk_len,
SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context);
SilcServerEntry server_entry;
SilcIdType idtype;
void *entry;
- uint32 mode;
+ SilcUInt32 mode;
char userhost[512];
char *name, *tmp;
GSList *list1, *list_tmp;
idtype = va_arg(va, int);
entry = va_arg(va, void *);
- mode = va_arg(va, uint32);
+ mode = va_arg(va, SilcUInt32);
(void)va_arg(va, char *);
(void)va_arg(va, char *);
channel = va_arg(va, SilcChannelEntry);
SILC_LOG_DEBUG(("Notify: CUMODE_CHANGE"));
client_entry = va_arg(va, SilcClientEntry);
- mode = va_arg(va, uint32);
+ mode = va_arg(va, SilcUInt32);
client_entry2 = va_arg(va, SilcClientEntry);
channel = va_arg(va, SilcChannelEntry);
*/
int i;
SilcClientEntry *clients;
- uint32 clients_count;
+ SilcUInt32 clients_count;
SILC_LOG_DEBUG(("Notify: SIGNOFF"));
(void)va_arg(va, void *);
clients = va_arg(va, SilcClientEntry *);
- clients_count = va_arg(va, uint32);
+ clients_count = va_arg(va, SilcUInt32);
for (i = 0; i < clients_count; i++) {
memset(userhost, 0, sizeof(userhost));
static void silc_client_join_get_users(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcChannelEntry channel = (SilcChannelEntry)context;
{
char buf[1024], *nickname, *username, *realname, *nick;
unsigned char *fingerprint;
- uint32 idle, mode;
+ SilcUInt32 idle, mode;
SilcBuffer channels;
SilcClientEntry client_entry;
} else if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
/* Try to find the entry for the unknown client ID, since we
might have, and print the nickname of it for user. */
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd_payload),
2, &tmp_len);
username = va_arg(vp, char *);
realname = va_arg(vp, char *);
channels = va_arg(vp, SilcBuffer);
- mode = va_arg(vp, uint32);
- idle = va_arg(vp, uint32);
+ mode = va_arg(vp, SilcUInt32);
+ idle = va_arg(vp, SilcUInt32);
fingerprint = va_arg(vp, unsigned char *);
silc_parse_userfqdn(nickname, &nick, NULL);
silc_dlist_start(list);
while ((entry = silc_dlist_get(list)) != SILC_LIST_END) {
char *m = silc_client_chumode_char(silc_channel_get_mode(entry));
- uint32 name_len;
+ SilcUInt32 name_len;
char *name = silc_channel_get_name(entry, &name_len);
if (m)
} else if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
/* Try to find the entry for the unknown client ID, since we
might have, and print the nickname of it for user. */
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd_payload),
2, &tmp_len);
case SILC_COMMAND_JOIN:
{
char *channel, *mode, *topic;
- uint32 modei;
+ SilcUInt32 modei;
SilcChannelEntry channel_entry;
SilcBuffer client_id_list;
- uint32 list_count;
+ SilcUInt32 list_count;
if (!success)
return;
channel = va_arg(vp, char *);
channel_entry = va_arg(vp, SilcChannelEntry);
- modei = va_arg(vp, uint32);
- (void)va_arg(vp, uint32);
+ modei = va_arg(vp, SilcUInt32);
+ (void)va_arg(vp, SilcUInt32);
(void)va_arg(vp, unsigned char *);
(void)va_arg(vp, unsigned char *);
(void)va_arg(vp, unsigned char *);
topic = va_arg(vp, char *);
(void)va_arg(vp, unsigned char *);
- list_count = va_arg(vp, uint32);
+ list_count = va_arg(vp, SilcUInt32);
client_id_list = va_arg(vp, SilcBuffer);
chanrec = silc_channel_find(server, channel);
case SILC_COMMAND_UMODE:
{
- uint32 mode;
+ SilcUInt32 mode;
if (!success)
return;
- mode = va_arg(vp, uint32);
+ mode = va_arg(vp, SilcUInt32);
if (mode & SILC_UMODE_SERVER_OPERATOR &&
!(server->umode & SILC_UMODE_SERVER_OPERATOR))
void *entry;
SilcPublicKey public_key;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
GetkeyContext getkey;
char *name;
if (!success)
return;
- id_type = va_arg(vp, uint32);
+ id_type = va_arg(vp, SilcUInt32);
entry = va_arg(vp, void *);
public_key = va_arg(vp, SilcPublicKey);
char *entity;
char *entity_name;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
SilcSKEPKType pk_type;
SilcVerifyPublicKey completion;
void *context;
static void
silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
const char *name, SilcSocketType conn_type,
- unsigned char *pk, uint32 pk_len,
+ unsigned char *pk, SilcUInt32 pk_len,
SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context)
{
/* The key already exists, verify it. */
SilcPublicKey public_key;
unsigned char *encpk;
- uint32 encpk_len;
+ SilcUInt32 encpk_len;
/* Load the key file, try for both IP filename and hostname filename */
if (!silc_pkcs_load_public_key(ipf, &public_key,
void
silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context)
{
silc_verify_public_key_internal(client, conn, NULL, conn_type, pk,
is found and FALSE if not. `conn' may be NULL. */
void silc_get_auth_method(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcGetAuthMeth completion, void *context)
{
InternalGetAuthMethod internal;
}
if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) {
- uint32 err = (uint32)failure;
+ SilcUInt32 err = (SilcUInt32)failure;
if (err == SILC_AUTH_FAILED)
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
int silc_key_agreement(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, const char *hostname,
- uint16 port, SilcKeyAgreementCallback *completion,
+ SilcUInt16 port, SilcKeyAgreementCallback *completion,
void **context)
{
char portstr[12];
}
void silc_ftp(SilcClient client, SilcClientConnection conn,
- SilcClientEntry client_entry, uint32 session_id,
- const char *hostname, uint16 port)
+ SilcClientEntry client_entry, SilcUInt32 session_id,
+ const char *hostname, SilcUInt16 port)
{
SILC_SERVER_REC *server;
char portstr[12];
SilcAskPassphrase completion, void *context);
void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context);
void silc_get_auth_method(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcGetAuthMeth completion, void *context);
void silc_failure(SilcClient client, SilcClientConnection conn,
SilcProtocol protocol, void *failure);
int silc_key_agreement(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, const char *hostname,
- uint16 port, SilcKeyAgreementCallback *completion,
+ SilcUInt16 port, SilcKeyAgreementCallback *completion,
void **context);
void silc_ftp(SilcClient client, SilcClientConnection conn,
- SilcClientEntry client_entry, uint32 session_id,
- const char *hostname, uint16 port);
+ SilcClientEntry client_entry, SilcUInt32 session_id,
+ const char *hostname, SilcUInt16 port);
#endif
SilcPrivateKey prv_key;
SilcRng rng;
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
char line[256];
char *pkfile = NULL, *prvfile = NULL;
SilcPublicKeyIdentifier ident;
char *fingerprint, *babbleprint;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
SilcPKCS pkcs;
int key_len = 0;
{
SILC_CHANNEL_REC *chanrec;
char *tmpcmd = "ME", *tmp;
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
int i;
if (!IS_SILC_SERVER(server) || !server->connected)
{
SILC_CHANNEL_REC *chanrec;
char *tmpcmd = "ME", *tmp;
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
int i;
if (!IS_SILC_SERVER(server) || !server->connected)
{
SILC_CHANNEL_REC *chanrec;
char *tmpcmd = "ME", *tmp;
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
int i;
if (!IS_SILC_SERVER(server) || !server->connected)
static void silc_client_command_key_get_clients(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
KeyGetClients internal = (KeyGetClients)context;
{
SilcClientConnection conn;
SilcClientEntry *entrys, client_entry = NULL;
- uint32 entry_count;
+ SilcUInt32 entry_count;
SilcChannelEntry channel_entry = NULL;
char *nickname = NULL, *tmp;
int command = 0, port = 0, type = 0;
char *hostname = NULL;
KeyInternal internal = NULL;
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
char *bindhost = NULL;
if (!server || !IS_SILC_SERVER(server) || !server->connected)
} else if (type == 2) {
/* Unset channel key(s) */
SilcChannelPrivateKey *keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int number;
if (argc == 4)
if (type == 1) {
SilcPrivateMessageKeys keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int k, i, len;
char buf[1024];
} else if (type == 2) {
SilcChannelPrivateKey *keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int k, i, len;
char buf[1024];
#ifdef SILC_SIM
/* SIM (SILC Module) table */
SilcSimContext **sims = NULL;
-uint32 sims_count = 0;
+SilcUInt32 sims_count = 0;
#endif
static int my_silc_scheduler(void)
#ifdef SILC_SIM
/* SIM (SILC Module) table */
extern SilcSimContext **sims;
-extern uint32 sims_count;
+extern SilcUInt32 sims_count;
#endif
#define IS_SILC_ITEM(rec) (IS_SILC_CHANNEL(rec) || IS_SILC_QUERY(rec))
static void silc_send_msg_clients(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
PRIVMSG_REC *rec = context;
{
PRIVMSG_REC *rec;
SilcClientEntry *clients;
- uint32 clients_count;
+ SilcUInt32 clients_count;
char *nickname = NULL;
if (!silc_parse_userfqdn(nick, &nickname, NULL)) {
void silc_command_exec(SILC_SERVER_REC *server,
const char *command, const char *args)
{
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
char *data, *tmpcmd;
SilcClientCommand cmd;
SilcClientCommandContext ctx;
SilcClientConnection conn,
SilcClientMonitorStatus status,
SilcClientFileError error,
- uint64 offset,
- uint64 filesize,
+ SilcUInt64 offset,
+ SilcUInt64 filesize,
SilcClientEntry client_entry,
- uint32 session_id,
+ SilcUInt32 session_id,
const char *filepath,
void *context)
{
static void silc_client_command_file_get_clients(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
FileGetClients internal = (FileGetClients)context;
SilcClientConnection conn;
SilcClientEntry *entrys, client_entry;
SilcClientFileError ret;
- uint32 entry_count;
+ SilcUInt32 entry_count;
char *nickname = NULL, *tmp;
unsigned char **argv;
- uint32 argc;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 argc;
+ SilcUInt32 *argv_lens, *argv_types;
int type = 0;
FtpSession ftp;
char *local_ip = NULL;
- uint32 local_port = 0;
- uint32 session_id;
+ SilcUInt32 local_port = 0;
+ SilcUInt32 session_id;
if (!server || !IS_SILC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
MSGLEVEL_CRAP, SILCTXT_FILE_SHOW_LINE,
ftp->client_entry->nickname,
ftp->send ? "send" : "receive",
- (uint32)(ftp->offset + 1023) / 1024,
- (uint32)(ftp->filesize + 1023) / 1024,
+ (SilcUInt32)(ftp->offset + 1023) / 1024,
+ (SilcUInt32)(ftp->filesize + 1023) / 1024,
ftp->percent, ftp->kps,
ftp->filepath ? ftp->filepath : "[N/A]");
}
typedef struct {
SilcClientEntry client_entry;
SilcClientConnection conn;
- uint32 session_id;
+ SilcUInt32 session_id;
char *filepath;
bool send;
long starttime; /* Start time of transfer */
double kps; /* Kilos per second */
- uint64 offset; /* Current offset */
- uint64 filesize; /* Total file size */
- uint32 percent; /* Percent of current transmission */
+ SilcUInt64 offset; /* Current offset */
+ SilcUInt64 filesize; /* Total file size */
+ SilcUInt32 percent; /* Percent of current transmission */
} *FtpSession;
#define STRUCT_SERVER_CONNECT_REC SILC_SERVER_CONNECT_REC
gpointer chanqueries;
SilcClientConnection conn;
- uint32 umode;
+ SilcUInt32 umode;
} SILC_SERVER_REC;
SILC_SERVER_REC *silc_server_connect(SILC_SERVER_CONNECT_REC *conn);
static bool
silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type)
+ SilcUInt32 pk_len, SilcSKEPKType pk_type)
{
int i;
char file[256], filename[256], *fingerprint;
/* The key already exists, verify it. */
SilcPublicKey public_key;
unsigned char *encpk;
- uint32 encpk_len;
+ SilcUInt32 encpk_len;
/* Load the key file */
if (!silc_pkcs_load_public_key(filename, &public_key,
SilcClientEntry client_entry, client_entry2;
SilcChannelEntry channel_entry;
char *tmp = NULL;
- uint32 tmp_int;
+ SilcUInt32 tmp_int;
va_start(vp, type);
case SILC_NOTIFY_TYPE_CMODE_CHANGE:
client_entry = va_arg(vp, SilcClientEntry);
- tmp_int = va_arg(vp, uint32);
+ tmp_int = va_arg(vp, SilcUInt32);
(void)va_arg(vp, char *);
(void)va_arg(vp, char *);
channel_entry = va_arg(vp, SilcChannelEntry);
case SILC_NOTIFY_TYPE_CUMODE_CHANGE:
client_entry = va_arg(vp, SilcClientEntry);
- tmp_int = va_arg(vp, uint32);
+ tmp_int = va_arg(vp, SilcUInt32);
tmp = silc_client_chumode(tmp_int);
client_entry2 = va_arg(vp, SilcClientEntry);
channel_entry = va_arg(vp, SilcChannelEntry);
case SILC_NOTIFY_TYPE_SERVER_SIGNOFF:
{
SilcClientEntry *clients;
- uint32 clients_count;
+ SilcUInt32 clients_count;
int i;
(void)va_arg(vp, void *);
clients = va_arg(vp, SilcClientEntry *);
- clients_count = va_arg(vp, uint32);
+ clients_count = va_arg(vp, SilcUInt32);
for (i = 0; i < clients_count; i++) {
if (clients[i]->server)
void silc_client_show_users(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcChannelEntry channel = (SilcChannelEntry)context;
{
char buf[1024], *nickname, *username, *realname;
int len;
- uint32 idle, mode;
+ SilcUInt32 idle, mode;
SilcBuffer channels;
if (status == SILC_STATUS_ERR_NO_SUCH_NICK ||
username = va_arg(vp, char *);
realname = va_arg(vp, char *);
channels = va_arg(vp, SilcBuffer);
- mode = va_arg(vp, uint32);
- idle = va_arg(vp, uint32);
+ mode = va_arg(vp, SilcUInt32);
+ idle = va_arg(vp, SilcUInt32);
memset(buf, 0, sizeof(buf));
silc_dlist_start(list);
while ((entry = silc_dlist_get(list)) != SILC_LIST_END) {
char *m = silc_client_chumode_char(silc_channel_get_mode(entry));
- uint32 name_len;
+ SilcUInt32 name_len;
char *name = silc_channel_get_name(entry, &name_len);
if (m)
case SILC_COMMAND_JOIN:
{
- uint32 mode;
+ SilcUInt32 mode;
char *topic;
SilcBuffer client_id_list;
- uint32 list_count;
+ SilcUInt32 list_count;
SilcChannelEntry channel;
if (!success)
app->screen->bottom_line->channel = va_arg(vp, char *);
channel = va_arg(vp, SilcChannelEntry);
- mode = va_arg(vp, uint32);
- (void)va_arg(vp, uint32);
+ mode = va_arg(vp, SilcUInt32);
+ (void)va_arg(vp, SilcUInt32);
(void)va_arg(vp, unsigned char *);
(void)va_arg(vp, unsigned char *);
(void)va_arg(vp, unsigned char *);
topic = va_arg(vp, char *);
(void)va_arg(vp, unsigned char *);
- list_count = va_arg(vp, uint32);
+ list_count = va_arg(vp, SilcUInt32);
client_id_list = va_arg(vp, SilcBuffer);
if (topic)
case SILC_COMMAND_UMODE:
{
- uint32 mode;
+ SilcUInt32 mode;
if (!success)
return;
- mode = va_arg(vp, uint32);
+ mode = va_arg(vp, SilcUInt32);
if (!mode && app->screen->bottom_line->umode) {
silc_free(app->screen->bottom_line->umode);
void *entry;
SilcPublicKey public_key;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
- id_type = va_arg(vp, uint32);
+ id_type = va_arg(vp, SilcUInt32);
entry = va_arg(vp, void *);
public_key = va_arg(vp, SilcPublicKey);
void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context)
{
if (silc_verify_public_key_internal(client, conn, conn_type, pk,
is found and FALSE if not. `conn' may be NULL. */
int silc_get_auth_method(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcProtocolAuthMeth *auth_meth,
unsigned char **auth_data,
- uint32 *auth_data_len)
+ SilcUInt32 *auth_data_len)
{
SilcClientInternal app = (SilcClientInternal)client->application;
}
if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) {
- uint32 err = (uint32)failure;
+ SilcUInt32 err = (SilcUInt32)failure;
if (err == SILC_AUTH_FAILED)
silc_say(client, conn, "Authentication failed");
SilcAskPassphrase completion, void *context);
void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context);
int silc_get_auth_method(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcProtocolAuthMeth *auth_meth,
unsigned char **auth_data,
- uint32 *auth_data_len);
+ SilcUInt32 *auth_data_len);
void silc_failure(SilcClient client, SilcClientConnection conn,
SilcProtocol protocol, void *failure);
int silc_key_agreement(SilcClient client, SilcClientConnection conn,
typedef struct SilcClientConfigSectionAlgStruct {
char *alg_name;
char *sim_name;
- uint32 block_len;
- uint32 key_len;
+ SilcUInt32 block_len;
+ SilcUInt32 key_len;
struct SilcClientConfigSectionAlgStruct *next;
struct SilcClientConfigSectionAlgStruct *prev;
#define SILC_CLIENT_CONFIG_MODNAME "builtin"
char *host;
int auth_meth;
char *auth_data;
- uint16 port;
+ SilcUInt16 port;
struct SilcClientConfigSectionConnectionStruct *next;
struct SilcClientConfigSectionConnectionStruct *prev;
#define SILC_CLIENT_CONFIG_AUTH_METH_PASSWD "passwd"
SilcClientConfigParse *return_config);
int silc_client_config_parse_lines(SilcClientConfig config,
SilcClientConfigParse parse_config);
-int silc_client_config_check_sections(uint32 checkmask);
+int silc_client_config_check_sections(SilcUInt32 checkmask);
void silc_client_config_setlogfiles(SilcClientConfig config);
bool silc_client_config_register_ciphers(SilcClientConfig config);
bool silc_client_config_register_pkcs(SilcClientConfig config);
SilcPrivateKey prv_key;
SilcRng rng;
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
char line[256];
char *pkfile = NULL, *prvfile = NULL;
SilcPublicKeyIdentifier ident;
char *fingerprint;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
SilcPKCS pkcs;
int key_len = 0;
SilcClientConnection conn = cmd->conn;
SilcClient client = cmd->client;
SilcClientEntry client_entry = NULL;
- uint32 num = 0;
+ SilcUInt32 num = 0;
char *nickname = NULL, *server = NULL;
if (!cmd->conn) {
SilcClient client = cmd->client;
SilcClientEntry client_entry = NULL;
SilcChannelEntry channel_entry = NULL;
- uint32 num = 0;
+ SilcUInt32 num = 0;
char *nickname = NULL, *server = NULL;
int command = 0, port = 0, type = 0;
char *hostname = NULL;
} else if (type == 2) {
/* Unset channel key(s) */
SilcChannelPrivateKey *keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int number;
if (cmd->argc == 4)
if (type == 1) {
SilcPrivateMessageKeys keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int k, i, len;
char buf[1024];
silc_client_free_private_message_keys(keys, keys_count);
} else if (type == 2) {
SilcChannelPrivateKey *keys;
- uint32 keys_count;
+ SilcUInt32 keys_count;
int k, i, len;
char buf[1024];
/* Output windows */
WINDOW **output_win;
WINDOW **output_stat_line;
- uint32 output_win_count;
+ SilcUInt32 output_win_count;
/* Input window at the bottom of the screen */
WINDOW *input_win;
unsigned char *input_buffer;
- uint32 input_pos;
- uint32 input_end;
- uint32 cursor_pos;
+ SilcUInt32 input_pos;
+ SilcUInt32 input_end;
+ SilcUInt32 cursor_pos;
int virtual_window;
/* Bottom line on screen */
static void silc_client_process_message(SilcClientInternal app)
{
unsigned char *data;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Start"));
if (data[0] == '/' && data[1] != ' ') {
/* Command */
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv, *tmpcmd;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
SilcClientCommand *cmd;
SilcClientCommandContext ctx;
cs = app->config->commands;
while(cs) {
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv, *tmpcmd;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
SilcClientCommand *cmd;
SilcClientCommandContext ctx;
#ifdef SILC_SIM
/* SIM (SILC Module) table */
SilcSimContext **sim;
- uint32 sim_count;
+ SilcUInt32 sim_count;
#endif
/* The allocated client */
silc_server_command_send_status_data(SilcServerCommandContext cmd,
SilcCommand command,
SilcCommandStatus status,
- uint32 arg_type,
+ SilcUInt32 arg_type,
const unsigned char *arg,
- uint32 arg_len);
+ SilcUInt32 arg_len);
static bool
silc_server_command_pending_error_check(SilcServerCommandContext cmd,
SilcServerCommandReplyContext cmdr,
of arguments. */
#define SILC_SERVER_COMMAND_CHECK(command, context, min, max) \
do { \
- uint32 _argc; \
+ SilcUInt32 _argc; \
\
SILC_LOG_DEBUG(("Start")); \
\
bool silc_server_command_pending(SilcServer server,
SilcCommand reply_cmd,
- uint16 ident,
+ SilcUInt16 ident,
SilcCommandCb callback,
void *context)
{
void silc_server_command_pending_del(SilcServer server,
SilcCommand reply_cmd,
- uint16 ident)
+ SilcUInt16 ident)
{
SilcServerCommandPending *r;
silc_server_command_pending_check(SilcServer server,
SilcServerCommandReplyContext ctx,
SilcCommand command,
- uint16 ident,
- uint32 *callbacks_count)
+ SilcUInt16 ident,
+ SilcUInt32 *callbacks_count)
{
SilcServerCommandPending *r;
SilcServerCommandPendingCallbacks callbacks = NULL;
silc_server_command_send_status_data(SilcServerCommandContext cmd,
SilcCommand command,
SilcCommandStatus status,
- uint32 arg_type,
+ SilcUInt32 arg_type,
const unsigned char *arg,
- uint32 arg_len)
+ SilcUInt32 arg_len)
{
SilcBuffer buffer;
static int
silc_server_command_whois_parse(SilcServerCommandContext cmd,
SilcClientID ***client_id,
- uint32 *client_id_count,
+ SilcUInt32 *client_id_count,
char **nickname,
char **server_name,
int *count,
SilcCommand command)
{
unsigned char *tmp;
- uint32 len;
- uint32 argc = silc_argument_get_arg_num(cmd->args);
+ SilcUInt32 len;
+ SilcUInt32 argc = silc_argument_get_arg_num(cmd->args);
int i, k;
/* If client ID is in the command it must be used instead of nickname */
/* Resolve context used by both WHOIS and IDENTIFY commands */
typedef struct {
SilcServerEntry router;
- uint16 ident;
+ SilcUInt16 ident;
unsigned char **res_argv;
- uint32 *res_argv_lens;
- uint32 *res_argv_types;
- uint32 res_argc;
+ SilcUInt32 *res_argv_lens;
+ SilcUInt32 *res_argv_types;
+ SilcUInt32 res_argc;
} *SilcServerResolveContext;
static bool
silc_server_command_whois_check(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count)
+ SilcUInt32 clients_count)
{
SilcServer server = cmd->server;
SilcClientEntry entry;
SilcServerResolveContext resolve = NULL, r = NULL;
- uint32 resolve_count = 0;
+ SilcUInt32 resolve_count = 0;
int i, k;
bool no_res = TRUE;
static void
silc_server_command_whois_send_reply(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
int count,
const char *nickname,
SilcClientID **client_ids)
SilcBuffer packet, idp, channels;
SilcClientEntry entry;
SilcCommandStatus status;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char nh[256], uh[256];
unsigned char idle[4], mode[4];
unsigned char *fingerprint;
{
SilcServer server = cmd->server;
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
int count = 0;
SilcClientEntry *clients = NULL, entry;
SilcClientID **client_id = NULL;
- uint32 client_id_count = 0, clients_count = 0;
+ SilcUInt32 client_id_count = 0, clients_count = 0;
int i, ret = 0;
bool check_global = FALSE;
int *count)
{
unsigned char *tmp;
- uint32 len;
+ SilcUInt32 len;
tmp = silc_argument_get_arg_type(cmd->args, 1, &len);
if (!tmp) {
static char
silc_server_command_whowas_check(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count)
+ SilcUInt32 clients_count)
{
SilcServer server = cmd->server;
int i;
if (!entry->nickname || !entry->username) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
if (!entry->router)
continue;
static void
silc_server_command_whowas_send_reply(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count)
+ SilcUInt32 clients_count)
{
SilcServer server = cmd->server;
char *tmp;
SilcBuffer packet, idp;
SilcClientEntry entry = NULL;
SilcCommandStatus status;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char nh[256], uh[256];
int valid_count;
char *nick = NULL, *server_name = NULL;
int count = 0;
SilcClientEntry *clients = NULL;
- uint32 clients_count = 0;
+ SilcUInt32 clients_count = 0;
int ret = 0;
bool check_global = FALSE;
server->server_type == SILC_SERVER && !cmd->pending &&
!server->standalone) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
{
SilcServer server = cmd->server;
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
static int
silc_server_command_identify_parse(SilcServerCommandContext cmd,
SilcClientEntry **clients,
- uint32 *clients_count,
+ SilcUInt32 *clients_count,
SilcServerEntry **servers,
- uint32 *servers_count,
+ SilcUInt32 *servers_count,
SilcChannelEntry **channels,
- uint32 *channels_count,
- uint32 *count)
+ SilcUInt32 *channels_count,
+ SilcUInt32 *count)
{
SilcServer server = cmd->server;
unsigned char *tmp;
- uint32 len;
- uint32 argc = silc_argument_get_arg_num(cmd->args);
+ SilcUInt32 len;
+ SilcUInt32 argc = silc_argument_get_arg_num(cmd->args);
SilcIDPayload idp;
bool check_global = FALSE;
void *entry;
static bool
silc_server_command_identify_check_client(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count)
+ SilcUInt32 clients_count)
{
SilcServer server = cmd->server;
SilcClientEntry entry;
SilcServerResolveContext resolve = NULL, r = NULL;
- uint32 resolve_count = 0;
+ SilcUInt32 resolve_count = 0;
int i, k;
bool no_res = TRUE;
static void
silc_server_command_identify_send_reply(SilcServerCommandContext cmd,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
SilcServerEntry *servers,
- uint32 servers_count,
+ SilcUInt32 servers_count,
SilcChannelEntry *channels,
- uint32 channels_count,
+ SilcUInt32 channels_count,
int count)
{
SilcServer server = cmd->server;
int i, k, len, valid_count;
SilcBuffer packet, idp;
SilcCommandStatus status;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char nh[256], uh[256];
SilcSocketConnection hsock;
SILC_STATUS_ERR_NO_SUCH_NICK,
3, tmp, strlen(tmp));
} else {
- tmp = silc_argument_get_arg_type(cmd->args, 5, (uint32 *)&len);
+ tmp = silc_argument_get_arg_type(cmd->args, 5, (SilcUInt32 *)&len);
silc_server_command_send_status_data(cmd, SILC_COMMAND_IDENTIFY,
SILC_STATUS_ERR_NO_SUCH_CLIENT_ID,
2, tmp, len);
static int
silc_server_command_identify_process(SilcServerCommandContext cmd)
{
- uint32 count = 0;
+ SilcUInt32 count = 0;
int ret = 0;
SilcClientEntry *clients = NULL;
SilcServerEntry *servers = NULL;
SilcChannelEntry *channels = NULL;
- uint32 clients_count = 0, servers_count = 0, channels_count = 0;
+ SilcUInt32 clients_count = 0, servers_count = 0, channels_count = 0;
/* Parse the IDENTIFY request */
ret = silc_server_command_identify_parse(cmd,
SilcServer server = cmd->server;
SilcBuffer packet, nidp, oidp = NULL;
SilcClientID *new_id;
- uint32 nick_len;
+ SilcUInt32 nick_len;
char *nick;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
int nickfail = 0;
if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
static void
silc_server_command_list_send_reply(SilcServerCommandContext cmd,
SilcChannelEntry *lch,
- uint32 lch_count,
+ SilcUInt32 lch_count,
SilcChannelEntry *gch,
- uint32 gch_count)
+ SilcUInt32 gch_count)
{
int i, k;
SilcBuffer packet, idp;
SilcChannelEntry entry;
SilcCommandStatus status;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char *topic;
unsigned char usercount[4];
- uint32 users;
+ SilcUInt32 users;
int valid_lcount = 0, valid_rcount = 0;
for (i = 0; i < lch_count; i++) {
SilcServer server = cmd->server;
SilcChannelID *channel_id = NULL;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcChannelEntry *lchannels = NULL, *gchannels = NULL;
- uint32 lch_count = 0, gch_count = 0;
+ SilcUInt32 lch_count = 0, gch_count = 0;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_LIST, cmd, 0, 1);
if (!cmd->pending && server->server_type == SILC_SERVER &&
!server->standalone) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
SilcChannelClientEntry chl;
SilcBuffer packet, idp;
unsigned char *tmp;
- uint32 argc, tmp_len;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 argc, tmp_len;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_TOPIC, cmd, 1, 2);
SilcIDListData idata;
SilcBuffer idp, idp2, packet;
unsigned char *tmp, *add, *del;
- uint32 len;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 len;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_INVITE, cmd, 1, 4);
SilcSocketConnection sock = cmd->sock;
QuitInternal q;
unsigned char *tmp = NULL;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_QUIT, cmd, 0, 1);
SilcClientEntry remote_client;
SilcClientID *client_id;
unsigned char *tmp, *comment;
- uint32 tmp_len, tmp_len2;
+ SilcUInt32 tmp_len, tmp_len2;
bool local;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_KILL, cmd, 1, 2);
SilcServer server = cmd->server;
SilcBuffer packet, idp;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
char *dest_server, *server_info = NULL, *server_name;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SilcServerEntry entry = NULL;
SilcServerID *server_id = NULL;
server->server_type != SILC_SERVER && entry && !entry->server_info) {
/* Send to the server */
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
if (!entry && !cmd->pending && !server->standalone) {
/* Send to the primary router */
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
SilcServerID *id;
- uint32 len;
+ SilcUInt32 len;
unsigned char *tmp;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_INFO, cmd, 1, 2);
SilcClientID *client_id,
bool created,
bool create_key,
- uint32 umode,
+ SilcUInt32 umode,
const unsigned char *auth,
- uint32 auth_len)
+ SilcUInt32 auth_len)
{
SilcSocketConnection sock = cmd->sock;
unsigned char *tmp;
- uint32 tmp_len, user_count;
+ SilcUInt32 tmp_len, user_count;
unsigned char *passphrase = NULL, mode[4], tmp2[4], tmp3[4];
SilcClientEntry client;
SilcChannelClientEntry chl;
SilcBuffer reply, chidp, clidp, keyp = NULL, user_list, mode_list;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char check[512], check2[512];
bool founder = FALSE;
bool resolve;
void *auth_data = (channel->founder_method == SILC_AUTH_PASSWORD ?
(void *)channel->founder_passwd :
(void *)channel->founder_key);
- uint32 auth_data_len = (channel->founder_method == SILC_AUTH_PASSWORD ?
+ SilcUInt32 auth_data_len = (channel->founder_method == SILC_AUTH_PASSWORD ?
channel->founder_passwd_len : 0);
/* Check whether the client is to become founder */
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
unsigned char *auth;
- uint32 tmp_len, auth_len;
+ SilcUInt32 tmp_len, auth_len;
char *tmp, *channel_name = NULL, *cipher, *hmac;
SilcChannelEntry channel;
- uint32 umode = 0;
+ SilcUInt32 umode = 0;
bool created = FALSE, create_key = TRUE;
SilcClientID *client_id;
or joins the client to it). */
if (server->server_type != SILC_ROUTER) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
/* If this is pending command callback then we've resolved
it and it didn't work, return since we've notified the
SilcServer server = cmd->server;
SilcBuffer packet, idp;
char *motd, *dest_server;
- uint32 motd_len;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 motd_len;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_MOTD, cmd, 1, 1);
entry && !entry->motd) {
/* Send to the server */
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
if (!entry && !cmd->pending && !server->standalone) {
/* Send to the primary router */
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
SilcBuffer packet;
unsigned char *tmp_mask;
- uint32 mask;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 mask;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
goto out;
int silc_server_check_cmode_rights(SilcChannelEntry channel,
SilcChannelClientEntry client,
- uint32 mode)
+ SilcUInt32 mode)
{
int is_op = client->mode & SILC_CHANNEL_UMODE_CHANOP;
int is_fo = client->mode & SILC_CHANNEL_UMODE_CHANFO;
SilcBuffer packet, cidp;
unsigned char *tmp, *tmp_id, *tmp_mask;
char *cipher = NULL, *hmac = NULL, *passphrase = NULL;
- uint32 mode_mask, tmp_len, tmp_len2;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 mode_mask, tmp_len, tmp_len2;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_CMODE, cmd, 2, 7);
if (mode_mask & SILC_CHANNEL_MODE_ULIMIT) {
/* User limit is set on channel */
- uint32 user_limit;
+ SilcUInt32 user_limit;
/* Get user limit */
tmp = silc_argument_get_arg_type(cmd->args, 3, NULL);
SilcChannelClientEntry chl;
SilcBuffer packet, idp;
unsigned char *tmp_id, *tmp_ch_id, *tmp_mask;
- uint32 target_mask, sender_mask = 0, tmp_len, tmp_ch_len;
+ SilcUInt32 target_mask, sender_mask = 0, tmp_len, tmp_ch_len;
int notify = FALSE;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_CUMODE, cmd, 3, 4);
if (!(chl->mode & SILC_CHANNEL_UMODE_CHANFO)) {
/* The client tries to claim the founder rights. */
unsigned char *tmp_auth;
- uint32 tmp_auth_len, auth_len;
+ SilcUInt32 tmp_auth_len, auth_len;
void *auth;
if (target_client != client) {
SilcChannelEntry channel;
SilcChannelClientEntry chl;
SilcBuffer idp;
- uint32 tmp_len, target_idp_len;
+ SilcUInt32 tmp_len, target_idp_len;
unsigned char *tmp, *comment, *target_idp;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_LEAVE, cmd, 1, 3);
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
unsigned char *username, *auth;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcServerConfigAdmin *admin;
SilcIDListData idata = (SilcIDListData)client;
bool result = FALSE;
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
unsigned char *username, *auth;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcServerConfigAdmin *admin;
SilcIDListData idata = (SilcIDListData)client;
bool result = FALSE;
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
unsigned char *tmp, *host;
- uint32 tmp_len;
- uint32 port = SILC_PORT;
+ SilcUInt32 tmp_len;
+ SilcUInt32 port = SILC_PORT;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_CONNECT, cmd, 1, 2);
SilcChannelClientEntry chl;
SilcChannelID *channel_id = NULL;
unsigned char *id, *add, *del;
- uint32 id_len, tmp_len;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 id_len, tmp_len;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
goto out;
SilcServerEntry server_entry;
SilcSocketConnection sock;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *name;
- uint32 port = SILC_PORT;
+ SilcUInt32 port = SILC_PORT;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_CLOSE, cmd, 1, 2);
SilcClientEntry id_entry = (SilcClientEntry)cmd->sock->user_data;
SilcChannelID *id = NULL;
SilcChannelEntry channel;
- uint32 len;
+ SilcUInt32 len;
unsigned char *tmp;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_LEAVE, cmd, 1, 2);
SilcChannelID *id = NULL;
SilcBuffer packet, idp;
unsigned char *channel_id;
- uint32 channel_id_len;
+ SilcUInt32 channel_id_len;
SilcBuffer client_id_list;
SilcBuffer client_mode_list;
unsigned char lc[4];
- uint32 list_count = 0;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt32 list_count = 0;
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
char *channel_name;
SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_USERS, cmd, 1, 2);
SilcClientID *client_id = NULL;
SilcServerID *server_id = NULL;
SilcIDPayload idp = NULL;
- uint16 ident = silc_command_get_ident(cmd->payload);
+ SilcUInt16 ident = silc_command_get_ident(cmd->payload);
unsigned char *tmp, *pkdata;
- uint32 tmp_len, pklen;
+ SilcUInt32 tmp_len, pklen;
SilcBuffer pk = NULL;
SilcIdType id_type;
SilcPublicKey public_key;
(client && !client->connection && !cmd->pending) ||
(client && !client->data.public_key && !cmd->pending)) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
SilcSocketConnection dest_sock;
dest_sock = silc_server_get_client_route(server, NULL, 0,
(server_entry && !server_entry->data.public_key && !cmd->pending &&
!server->standalone))) {
SilcBuffer tmpbuf;
- uint16 old_ident;
+ SilcUInt16 old_ident;
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
SilcCommand reply_cmd;
SilcCommandCb callback;
void *context;
- uint16 ident;
+ SilcUInt16 ident;
struct SilcServerCommandPendingStruct *next;
} SilcServerCommandPending;
silc_server_command_dup(SilcServerCommandContext ctx);
bool silc_server_command_pending(SilcServer server,
SilcCommand reply_cmd,
- uint16 ident,
+ SilcUInt16 ident,
SilcCommandCb callback,
void *context);
void silc_server_command_pending_del(SilcServer server,
SilcCommand reply_cmd,
- uint16 ident);
+ SilcUInt16 ident);
SilcServerCommandPendingCallbacks
silc_server_command_pending_check(SilcServer server,
SilcServerCommandReplyContext ctx,
SilcCommand command,
- uint16 ident,
- uint32 *callbacks_count);
+ SilcUInt16 ident,
+ SilcUInt32 *callbacks_count);
SILC_SERVER_CMD_FUNC(whois);
SILC_SERVER_CMD_FUNC(whowas);
SILC_SERVER_CMD_FUNC(identify);
SilcServerCommandReplyContext ctx;
SilcCommandPayload payload;
SilcCommand command;
- uint16 ident;
+ SilcUInt16 ident;
SILC_LOG_DEBUG(("Start"));
SilcClientEntry client;
char global = FALSE;
char *nick;
- uint32 mode = 0, len, id_len, flen;
+ SilcUInt32 mode = 0, len, id_len, flen;
int expire = 0;
id_data = silc_argument_get_arg_type(cmd->args, 2, &id_len);
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
silc_server_command_reply_whowas_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
- uint32 len, id_len;
+ SilcUInt32 len, id_len;
unsigned char *id_data;
char *nickname, *username, *realname, *servername = NULL;
SilcClientID *client_id;
silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd)
{
SilcServer server = cmd->server;
- uint32 len, id_len;
+ SilcUInt32 len, id_len;
unsigned char *id_data;
char *name, *info;
SilcClientID *client_id = NULL;
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID &&
cmd->sock->type == SILC_SOCKET_TYPE_ROUTER) {
SilcClientEntry client;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 2, &tmp_len);
if (tmp) {
SilcClientID *client_id = silc_id_payload_parse_id(tmp, tmp_len);
SilcCommandStatus status;
SilcServerEntry entry;
SilcServerID *server_id;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp, *name;
COMMAND_CHECK_STATUS;
SilcCommandStatus status;
SilcServerEntry entry = NULL;
SilcServerID *server_id;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp;
COMMAND_CHECK_STATUS;
SilcClientID *client_id = NULL;
SilcChannelEntry entry;
SilcHmac hmac = NULL;
- uint32 id_len, len, list_count;
+ SilcUInt32 id_len, len, list_count;
unsigned char *id_string;
char *channel_name, *tmp;
- uint32 mode, created;
+ SilcUInt32 mode, created;
SilcBuffer keyp = NULL, client_id_list = NULL, client_mode_list = NULL;
COMMAND_CHECK_STATUS;
SilcBuffer client_id_list;
SilcBuffer client_mode_list;
unsigned char *tmp;
- uint32 tmp_len;
- uint32 list_count;
+ SilcUInt32 tmp_len;
+ SilcUInt32 list_count;
COMMAND_CHECK_STATUS;
SilcServerID *server_id = NULL;
SilcSKEPKType type;
unsigned char *tmp, *pk;
- uint32 len;
- uint16 pk_len;
+ SilcUInt32 len;
+ SilcUInt16 pk_len;
SilcIDPayload idp = NULL;
SilcIdType id_type;
SilcPublicKey public_key = NULL;
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
SilcIDCacheEntry cache;
- uint32 len;
+ SilcUInt32 len;
unsigned char *tmp, *name, *topic;
- uint32 usercount = 0;
+ SilcUInt32 usercount = 0;
bool global_list = FALSE;
COMMAND_CHECK_STATUS_LIST;
/* If defined this executes the pending command. */
SilcServerCommandPendingCallbacks callbacks;
- uint32 callbacks_count;
- uint16 ident;
+ SilcUInt32 callbacks_count;
+ SilcUInt16 ident;
} *SilcServerCommandReplyContext;
/* Macros */
int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
char *server,
SilcClientEntry **clients,
- uint32 *clients_count)
+ SilcUInt32 *clients_count)
{
SilcIDCacheList list = NULL;
SilcIDCacheEntry id_cache = NULL;
int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
SilcHash md5hash,
SilcClientEntry **clients,
- uint32 *clients_count)
+ SilcUInt32 *clients_count)
{
SilcIDCacheList list = NULL;
SilcIDCacheEntry id_cache = NULL;
SilcChannelEntry *
silc_idlist_get_channels(SilcIDList id_list, SilcChannelID *channel_id,
- uint32 *channels_count)
+ SilcUInt32 *channels_count)
{
SilcIDCacheList list = NULL;
SilcIDCacheEntry id_cache = NULL;
typedef struct {
SilcIDCache cache;
SilcSchedule schedule;
- uint32 timeout;
+ SilcUInt32 timeout;
} *SilcIDListPurge;
/* Channel key re-key context. */
typedef struct {
void *context;
SilcChannelEntry channel;
- uint32 key_len;
+ SilcUInt32 key_len;
SilcTask task;
} *SilcServerChannelRekey;
/* Current sending encryption key, provided for re-key. The `pfs'
is TRUE if the Perfect Forward Secrecy is performed in re-key. */
unsigned char *send_enc_key;
- uint32 enc_key_len;
+ SilcUInt32 enc_key_len;
int ske_group;
bool pfs;
- uint32 timeout;
+ SilcUInt32 timeout;
void *context;
} *SilcServerRekey;
/* ID List Entry status type and all the types. */
-typedef uint8 SilcIDListStatus;
+typedef SilcUInt8 SilcIDListStatus;
#define SILC_IDLIST_STATUS_NONE 0x00 /* No status */
#define SILC_IDLIST_STATUS_REGISTERED 0x01 /* Entry is registered */
#define SILC_IDLIST_STATUS_RESOLVED 0x02 /* Entry info is resolved */
SilcHmac hmac_receive;
/* Packet sequence numbers */
- uint32 psn_send;
- uint32 psn_receive;
+ SilcUInt32 psn_send;
+ SilcUInt32 psn_receive;
/* Hash selected in the SKE protocol, NULL if not needed at all */
SilcHash hash;
Logical name of the server. There is no limit of the length of the
server name. This is usually the same name as defined in DNS.
- uint8 server_type
+ SilcUInt8 server_type
Type of the server. SILC_SERVER or SILC_ROUTER are the possible
choices for this.
SilcIDListDataStruct data;
char *server_name;
- uint8 server_type;
+ SilcUInt8 server_type;
SilcServerID *id;
char *server_info;
char *motd;
Pointer to the client list. This is the client currently on channel.
- uint32 mode
+ SilcUInt32 mode
Client's current mode on the channel.
*/
typedef struct SilcChannelClientEntryStruct {
SilcClientEntry client;
- uint32 mode;
+ SilcUInt32 mode;
SilcChannelEntry channel;
} *SilcChannelClientEntry;
nickname. Nickname is not relevant information that would need to be
saved as plain.
- uint32 mode
+ SilcUInt32 mode
Client's mode. Client maybe for example server operator or
router operator (SILC operator).
not allow any command to be exeucted more than once in about
2 seconds. This is result of normal time().
- uint8 fast_command
+ SilcUInt8 fast_command
Counter to check command bursts. By default, up to 5 commands
are allowed before limiting the execution. See command flags
but as just said, this is usually pointer to the socket connection
list.
- uint16 resolve_cmd_ident
+ SilcUInt16 resolve_cmd_ident
Command identifier for the entry when the entry's data.status
is SILC_IDLIST_STATUS_RESOLVING. If this entry is asked to be
char *username;
char *userinfo;
SilcClientID *id;
- uint32 mode;
+ SilcUInt32 mode;
long last_command;
- uint8 fast_command;
+ SilcUInt8 fast_command;
/* Pointer to the router */
SilcServerEntry router;
/* data.status is RESOLVING and this includes the resolving command
reply identifier. */
- uint16 resolve_cmd_ident;
+ SilcUInt16 resolve_cmd_ident;
};
/*
Logical name of the channel.
- uint32 mode
+ SilcUInt32 mode
Current mode of the channel. See lib/silccore/silcchannel.h for
all modes.
SilcPublicKey founder_key
SilcAuthMethod founder_method
unsigned char *founder_passwd
- uint32 founder_passwd_len
+ SilcUInt32 founder_passwd_len
If the SILC_CMODE_FOUNDER_AUTH has been set then these will include
the founder's public key, authentication method and the password
The key of the channel (the cipher actually).
unsigned char *key
- uint32 key_len
+ SilcUInt32 key_len
Raw key data of the channel key.
*/
struct SilcChannelEntryStruct {
char *channel_name;
- uint32 mode;
+ SilcUInt32 mode;
SilcChannelID *id;
bool global_users;
char *topic;
SilcPublicKey founder_key;
SilcAuthMethod founder_method;
unsigned char *founder_passwd;
- uint32 founder_passwd_len;
+ SilcUInt32 founder_passwd_len;
- uint32 user_limit;
+ SilcUInt32 user_limit;
unsigned char *passphrase;
char *invite_list;
char *ban_list;
/* All users on this channel */
SilcHashTable user_list;
- uint32 user_count;
+ SilcUInt32 user_count;
/* Pointer to the router */
SilcServerEntry router;
/* Channel keys */
SilcCipher channel_key;
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
SilcHmac hmac;
int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
char *server,
SilcClientEntry **clients,
- uint32 *clients_count);
+ SilcUInt32 *clients_count);
int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
SilcHash md5hash,
SilcClientEntry **clients,
- uint32 *clients_count);
+ SilcUInt32 *clients_count);
SilcClientEntry
silc_idlist_find_client_by_id(SilcIDList id_list, SilcClientID *id,
bool registered, SilcIDCacheEntry *ret_entry);
SilcChannelID *new_id);
SilcChannelEntry *
silc_idlist_get_channels(SilcIDList id_list, SilcChannelID *channel_id,
- uint32 *channels_count);
+ SilcUInt32 *channels_count);
#endif
SilcChannelClientEntry chl;
SilcIDCacheEntry cache;
SilcHashTableList htl;
- uint32 mode;
+ SilcUInt32 mode;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
bool local;
SILC_LOG_DEBUG(("Start"));
* Distribute the notify to local clients on channels
*/
unsigned char *id;
- uint32 id_len;
+ SilcUInt32 id_len;
SILC_LOG_DEBUG(("KILLED notify"));
{
SilcPacketContext *new;
SilcBuffer buffer;
- uint16 len;
+ SilcUInt16 len;
SILC_LOG_DEBUG(("Processing Notify List"));
SilcBuffer reply;
SilcIDListData idata;
char *username = NULL, *realname = NULL, *id_string;
- uint16 username_len;
- uint32 id_len;
+ SilcUInt16 username_len;
+ SilcUInt32 id_len;
int ret;
char *hostname, *nickname;
int nickfail = 0;
SilcServerID *server_id;
SilcIDListData idata;
unsigned char *server_name, *id_string;
- uint16 id_len, name_len;
+ SilcUInt16 id_len, name_len;
int ret;
bool local = TRUE;
{
SilcPacketContext *new_id;
SilcBuffer idp;
- uint16 id_len;
+ SilcUInt16 id_len;
SILC_LOG_DEBUG(("Processing New ID List"));
SilcChannelPayload payload;
SilcChannelID *channel_id;
char *channel_name;
- uint32 name_len;
+ SilcUInt32 name_len;
unsigned char *id;
- uint32 id_len;
- uint32 mode;
+ SilcUInt32 id_len;
+ SilcUInt32 mode;
SilcServerEntry server_entry;
SilcChannelEntry channel;
{
SilcPacketContext *new;
SilcBuffer buffer;
- uint16 len1, len2;
+ SilcUInt16 len1, len2;
SILC_LOG_DEBUG(("Processing New Channel List"));
SilcPacketContext *packet)
{
SilcServerConfigClient *client = NULL;
- uint16 conn_type;
+ SilcUInt16 conn_type;
int ret;
SilcAuthMethod auth_meth = SILC_AUTH_NONE;
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
void *dst_id = NULL;
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
SilcPacketContext packetdata;
SilcIDListData idata = (SilcIDListData)sock->user_data;
SilcCipher cipher = NULL;
SilcHmac hmac = NULL;
- uint32 sequence = 0;
+ SilcUInt32 sequence = 0;
unsigned char *dst_id_data = NULL;
- uint32 dst_id_len = 0;
+ SilcUInt32 dst_id_len = 0;
int block_len = 0;
/* If disconnecting, ignore the data */
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
SilcPacketContext packetdata;
SilcIDListData idata;
SilcCipher cipher = NULL;
SilcHmac hmac = NULL;
- uint32 sequence = 0;
+ SilcUInt32 sequence = 0;
unsigned char *dst_id_data = NULL;
- uint32 dst_id_len = 0;
+ SilcUInt32 dst_id_len = 0;
unsigned char *src_id_data = NULL;
- uint32 src_id_len = 0;
+ SilcUInt32 src_id_len = 0;
int block_len = 0;
SILC_LOG_DEBUG(("Sending packet, type %d", type));
void silc_server_packet_send_clients(SilcServer server,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
SilcPacketType type,
SilcPacketFlags flags,
bool route,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
SilcSocketConnection sock = NULL;
SilcClientEntry client = NULL;
SilcServerEntry *routed = NULL;
- uint32 routed_count = 0;
+ SilcUInt32 routed_count = 0;
bool gone = FALSE;
int i, k;
SilcPacketContext *packet,
SilcCipher cipher,
SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool channel_message,
bool force_send)
{
SilcPacketType type,
bool route,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
SilcSocketConnection sock = NULL;
SilcChannelClientEntry chl;
SilcHashTableList htl;
SilcIDListData idata;
- uint32 routed_count = 0;
+ SilcUInt32 routed_count = 0;
bool gone = FALSE;
int k;
!(channel->mode & SILC_CHANNEL_MODE_PRIVKEY) &&
channel->channel_key) {
SilcBuffer chp;
- uint32 iv_len, i;
- uint16 dlen, flags;
+ SilcUInt32 iv_len, i;
+ SilcUInt16 dlen, flags;
iv_len = silc_cipher_get_block_len(channel->channel_key);
if (channel->iv[0] == '\0')
SilcIdType sender_type,
void *sender_entry,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
bool found = FALSE;
SilcClientEntry client = NULL;
SilcServerEntry *routed = NULL;
SilcChannelClientEntry chl;
- uint32 routed_count = 0;
+ SilcUInt32 routed_count = 0;
SilcIDListData idata;
SilcHashTableList htl;
bool gone = FALSE;
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send)
{
SilcChannelClientEntry chl;
SilcSocketConnection dst_sock,
SilcCipher cipher,
SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketContext *packet)
{
SilcBuffer buffer = packet->buffer;
SilcSocketConnection sock)
{
char *motd, *motd_file = NULL;
- uint32 motd_len;
+ SilcUInt32 motd_len;
if (server->config)
motd_file = server->config->server_info->motd_file;
SilcSocketConnection sock,
bool broadcast,
SilcNotifyType type,
- uint32 argc, ...)
+ SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer packet;
SilcSocketConnection sock,
bool broadcast,
SilcNotifyType type,
- uint32 argc,
+ SilcUInt32 argc,
SilcBuffer args)
{
SilcBuffer packet;
SilcSocketConnection sock,
bool broadcast,
SilcChannelEntry channel,
- uint32 mode_mask,
+ SilcUInt32 mode_mask,
void *id, SilcIdType id_type,
char *cipher, char *hmac,
char *passphrase)
SilcSocketConnection sock,
bool broadcast,
SilcChannelEntry channel,
- uint32 mode_mask,
+ SilcUInt32 mode_mask,
void *id, SilcIdType id_type,
SilcClientID *target)
{
SilcSocketConnection sock,
bool broadcast,
SilcClientID *client_id,
- uint32 mode_mask)
+ SilcUInt32 mode_mask)
{
SilcBuffer idp;
unsigned char mode[4];
void *dest_id,
SilcIdType dest_id_type,
SilcNotifyType type,
- uint32 argc, ...)
+ SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer packet;
SilcChannelEntry channel,
bool route_notify,
SilcNotifyType type,
- uint32 argc, ...)
+ SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer packet;
SilcClientEntry sender,
SilcClientEntry client,
SilcNotifyType type,
- uint32 argc, ...)
+ SilcUInt32 argc, ...)
{
int k;
SilcSocketConnection sock = NULL;
SilcPacketContext packetdata;
SilcClientEntry c;
SilcClientEntry *sent_clients = NULL;
- uint32 sent_clients_count = 0;
+ SilcUInt32 sent_clients_count = 0;
SilcServerEntry *routed = NULL;
- uint32 routed_count = 0;
+ SilcUInt32 routed_count = 0;
SilcHashTableList htl, htl2;
SilcChannelEntry channel;
SilcChannelClientEntry chl, chl2;
SilcIDListData idata;
SilcBuffer packet;
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
bool force_send = FALSE;
va_list ap;
SilcSocketConnection sock,
bool broadcast,
void *id, SilcIdType id_type,
- uint32 id_len)
+ SilcUInt32 id_len)
{
SilcBuffer idp;
bool broadcast,
char *channel_name,
void *channel_id,
- uint32 channel_id_len,
- uint32 mode)
+ SilcUInt32 channel_id_len,
+ SilcUInt32 mode)
{
SilcBuffer packet;
unsigned char *cid;
- uint32 name_len = strlen(channel_name);
+ SilcUInt32 name_len = strlen(channel_name);
SILC_LOG_DEBUG(("Start"));
{
SilcBuffer packet;
unsigned char *chid;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SILC_LOG_DEBUG(("Sending key to channel %s", channel->channel_name));
void silc_server_send_command(SilcServer server,
SilcSocketConnection sock,
SilcCommand command,
- uint16 ident,
- uint32 argc, ...)
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
SilcBuffer packet;
va_list ap;
SilcSocketConnection sock,
SilcCommand command,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...)
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
SilcBuffer packet;
va_list ap;
SilcIdType dst_id_type,
SilcCommand command,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...)
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
SilcBuffer packet;
va_list ap;
SilcSocketConnection dst_sock,
SilcCipher cipher,
SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketContext *packet,
bool force_send)
{
void silc_server_send_connection_auth_request(SilcServer server,
SilcSocketConnection sock,
- uint16 conn_type,
+ SilcUInt16 conn_type,
SilcAuthMethod auth_meth)
{
SilcBuffer packet;
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_send_dest(SilcServer server,
SilcSocketConnection sock,
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_send_srcdest(SilcServer server,
SilcSocketConnection sock,
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_broadcast(SilcServer server,
SilcSocketConnection sock,
SilcPacketContext *packet);
void silc_server_packet_send_clients(SilcServer server,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
SilcPacketType type,
SilcPacketFlags flags,
bool route,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_send_to_channel(SilcServer server,
SilcSocketConnection sender,
SilcPacketType type,
bool route,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_relay_to_channel(SilcServer server,
SilcSocketConnection sender_sock,
SilcIdType sender_type,
void *sender_entry,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_packet_send_local_channel(SilcServer server,
SilcChannelEntry channel,
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send);
void silc_server_send_private_message(SilcServer server,
SilcSocketConnection dst_sock,
SilcCipher cipher,
SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketContext *packet);
void silc_server_send_motd(SilcServer server,
SilcSocketConnection sock);
SilcSocketConnection sock,
bool broadcast,
SilcNotifyType type,
- uint32 argc, ...);
+ SilcUInt32 argc, ...);
void silc_server_send_notify_args(SilcServer server,
SilcSocketConnection sock,
bool broadcast,
SilcNotifyType type,
- uint32 argc,
+ SilcUInt32 argc,
SilcBuffer args);
void silc_server_send_notify_channel_change(SilcServer server,
SilcSocketConnection sock,
SilcSocketConnection sock,
bool broadcast,
SilcChannelEntry channel,
- uint32 mode_mask,
+ SilcUInt32 mode_mask,
void *id, SilcIdType id_type,
char *cipher, char *hmac,
char *passphrase);
SilcSocketConnection sock,
bool broadcast,
SilcChannelEntry channel,
- uint32 mode_mask,
+ SilcUInt32 mode_mask,
void *id, SilcIdType id_type,
SilcClientID *target);
void silc_server_send_notify_signoff(SilcServer server,
SilcSocketConnection sock,
bool broadcast,
SilcClientID *client_id,
- uint32 mode_mask);
+ SilcUInt32 mode_mask);
void silc_server_send_notify_ban(SilcServer server,
SilcSocketConnection sock,
bool broadcast,
void *dest_id,
SilcIdType dest_id_type,
SilcNotifyType type,
- uint32 argc, ...);
+ SilcUInt32 argc, ...);
void silc_server_send_notify_to_channel(SilcServer server,
SilcSocketConnection sender,
SilcChannelEntry channel,
bool route_notify,
SilcNotifyType type,
- uint32 argc, ...);
+ SilcUInt32 argc, ...);
void silc_server_send_notify_on_channels(SilcServer server,
SilcClientEntry sender,
SilcClientEntry client,
SilcNotifyType type,
- uint32 argc, ...);
+ SilcUInt32 argc, ...);
void silc_server_send_new_id(SilcServer server,
SilcSocketConnection sock,
bool broadcast,
void *id, SilcIdType id_type,
- uint32 id_len);
+ SilcUInt32 id_len);
void silc_server_send_new_channel(SilcServer server,
SilcSocketConnection sock,
bool broadcast,
char *channel_name,
void *channel_id,
- uint32 channel_id_len,
- uint32 mode);
+ SilcUInt32 channel_id_len,
+ SilcUInt32 mode);
void silc_server_send_channel_key(SilcServer server,
SilcSocketConnection sender,
SilcChannelEntry channel,
void silc_server_send_command(SilcServer server,
SilcSocketConnection sock,
SilcCommand command,
- uint16 ident,
- uint32 argc, ...);
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...);
void silc_server_send_command_reply(SilcServer server,
SilcSocketConnection sock,
SilcCommand command,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...);
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...);
void silc_server_send_dest_command_reply(SilcServer server,
SilcSocketConnection sock,
void *dst_id,
SilcIdType dst_id_type,
SilcCommand command,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...);
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...);
void silc_server_send_heartbeat(SilcServer server,
SilcSocketConnection sock);
void silc_server_relay_packet(SilcServer server,
SilcSocketConnection dst_sock,
SilcCipher cipher,
SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketContext *packet,
bool force_send);
void silc_server_send_connection_auth_request(SilcServer server,
SilcSocketConnection sock,
- uint16 conn_type,
+ SilcUInt16 conn_type,
SilcAuthMethod auth_meth);
void silc_server_packet_queue_purge(SilcServer server,
SilcSocketConnection sock);
static bool
silc_verify_public_key_internal(SilcServer server, SilcSocketConnection sock,
SilcSocketType conn_type,
- unsigned char *pk, uint32 pk_len,
+ unsigned char *pk, SilcUInt32 pk_len,
SilcSKEPKType pk_type)
{
char file[256], filename[256], *fingerprint;
/* The key already exists, verify it. */
SilcPublicKey public_key;
unsigned char *encpk;
- uint32 encpk_len;
+ SilcUInt32 encpk_len;
SILC_LOG_DEBUG(("We have the public key saved locally"));
static void
silc_server_protocol_ke_verify_key(SilcSKE ske,
unsigned char *pk_data,
- uint32 pk_len,
+ SilcUInt32 pk_len,
SilcSKEPKType pk_type,
void *context,
SilcSKEVerifyCbCompletion completion,
/* Check remote host version string */
SilcSKEStatus silc_ske_check_version(SilcSKE ske, unsigned char *version,
- uint32 len, void *context)
+ SilcUInt32 len, void *context)
{
SilcSKEStatus status = SILC_SKE_STATUS_OK;
char *cp;
silc_server_public_key_authentication(SilcServer server,
SilcPublicKey pub_key,
unsigned char *sign,
- uint32 sign_len,
+ SilcUInt32 sign_len,
SilcSKE ske)
{
SilcPKCS pkcs;
static int
silc_server_get_public_key_auth(SilcServer server,
unsigned char **auth_data,
- uint32 *auth_data_len,
+ SilcUInt32 *auth_data_len,
SilcSKE ske)
{
int len;
char *local_passphrase,
void *local_publickey,
unsigned char *remote_auth,
- uint32 remote_auth_len)
+ SilcUInt32 remote_auth_len)
{
SilcServer server = (SilcServer)ctx->server;
SilcSKE ske = ctx->ske;
* We are receiving party
*/
int ret;
- uint16 payload_len;
- uint16 conn_type;
+ SilcUInt16 payload_len;
+ SilcUInt16 conn_type;
unsigned char *auth_data = NULL;
SILC_LOG_INFO(("Performing authentication protocol for %s (%s)",
SilcBuffer packet;
int payload_len = 0;
unsigned char *auth_data = NULL;
- uint32 auth_data_len = 0;
+ SilcUInt32 auth_data_len = 0;
switch(ctx->auth_meth) {
case SILC_AUTH_NONE:
{
SilcIDListData idata = (SilcIDListData)ctx->sock->user_data;
SilcSKEKeyMaterial *keymat;
- uint32 key_len = silc_cipher_get_key_len(idata->send_key);
- uint32 hash_len = idata->hash->hash->hash_len;
+ SilcUInt32 key_len = silc_cipher_get_key_len(idata->send_key);
+ SilcUInt32 hash_len = idata->hash->hash->hash_len;
SILC_LOG_DEBUG(("Generating new %s session keys (no PFS)",
send ? "sending" : "receiving"));
{
SilcIDListData idata = (SilcIDListData)ctx->sock->user_data;
SilcSKEKeyMaterial *keymat;
- uint32 key_len = silc_cipher_get_key_len(idata->send_key);
- uint32 hash_len = idata->hash->hash->hash_len;
+ SilcUInt32 key_len = silc_cipher_get_key_len(idata->send_key);
+ SilcUInt32 hash_len = idata->hash->hash->hash_len;
unsigned char *tmpbuf;
- uint32 klen;
+ SilcUInt32 klen;
SILC_LOG_DEBUG(("Generating new %s session keys (with PFS)",
send ? "sending" : "receiving"));
/* Authentication method and data if we alreay know it. This is filled
before starting the protocol if we know the authentication data.
Otherwise these are and remain NULL. Used when we are initiating. */
- uint32 auth_meth;
+ SilcUInt32 auth_meth;
void *auth_data;
- uint32 auth_data_len;
+ SilcUInt32 auth_data_len;
/* Destinations ID from KE protocol context */
void *dest_id;
SilcTask timeout_task;
SilcPacketContext *packet;
- uint16 conn_type;
+ SilcUInt16 conn_type;
} SilcServerConnAuthInternalContext;
/* Internal context for the rekey protocol */
/* Adds new route to the route cache. The argument `index' is the
index value generated by silc_server_route_hash. */
-void silc_server_route_add(uint32 index, unsigned int dest,
+void silc_server_route_add(SilcUInt32 index, unsigned int dest,
SilcServerEntry router)
{
silc_route_cache[index].dest = dest;
/* Checksk whether destination has a specific router. Returns the
router data if found, NULL otherwise. */
-SilcServerEntry silc_server_route_check(uint32 dest,
- uint16 port)
+SilcServerEntry silc_server_route_check(SilcUInt32 dest,
+ SilcUInt16 port)
{
- uint32 index;
+ SilcUInt32 index;
index = silc_server_route_hash(dest, port);
SilcIdType id_type)
{
if (server->server_type == SILC_ROUTER) {
- uint32 dest = 0;
- uint16 port = 0;
+ SilcUInt32 dest = 0;
+ SilcUInt16 port = 0;
SilcServerEntry router = NULL;
#if 0
Following short description of the fields.
- uint32 dest
+ SilcUInt32 dest
Destination IPv4 address. Can be used to quickly check whether
the found route entry is what the caller wanted.
*/
typedef struct {
- uint32 dest;
+ SilcUInt32 dest;
SilcServerEntry router;
} SilcServerRouteTable;
`port' argument may be zero (0) if it doesn't exist. This has been
taken from Linux kernel's route cache code. */
extern inline
-uint32 silc_server_route_hash(unsigned int addr,
- uint16 port)
+SilcUInt32 silc_server_route_hash(unsigned int addr,
+ SilcUInt16 port)
{
- uint32 hash;
+ SilcUInt32 hash;
hash = ((addr & 0xf0f0f0f0) >> 4) | ((addr & 0x0f0f0f0f) << 4);
hash ^= port;
}
/* Prototypes */
-void silc_server_route_add(uint32 index, unsigned int dest,
+void silc_server_route_add(SilcUInt32 index, unsigned int dest,
SilcServerEntry router);
-SilcServerEntry silc_server_route_check(uint32 dest,
- uint16 port);
+SilcServerEntry silc_server_route_check(SilcUInt32 dest,
+ SilcUInt16 port);
SilcSocketConnection silc_server_route_get(SilcServer server, void *id,
SilcIdType id_type);
SilcBuffer packet;
SilcServerHBContext hb_context;
unsigned char *id_string;
- uint32 id_len;
+ SilcUInt32 id_len;
SilcIDListData idata;
SilcServerConfigConnParams *param;
SilcServerHBContext hb_context;
SilcUnknownEntry entry = (SilcUnknownEntry)sock->user_data;
void *id_entry;
- uint32 hearbeat_timeout = server->config->param.keepalive_secs;
- uint32 num_sockets;
+ SilcUInt32 hearbeat_timeout = server->config->param.keepalive_secs;
+ SilcUInt32 num_sockets;
SILC_LOG_DEBUG(("Start"));
{
SilcClientEntry client;
SilcServerConfigClient *conn = ctx->cconfig;
- uint32 max_per_host = server->config->param.connections_max_per_host;
+ SilcUInt32 max_per_host = server->config->param.connections_max_per_host;
/* Check for maximum connections limit */
if (conn->param) {
bool backup_local = FALSE;
bool backup_router = FALSE;
char *backup_replace_ip = NULL;
- uint16 backup_replace_port = 0;
+ SilcUInt16 backup_replace_port = 0;
SilcServerConfigServer *sconn = ctx->sconfig;
SilcServerConfigRouter *rconn = ctx->rconfig;
- uint32 max_per_host = server->config->param.connections_max_per_host;
+ SilcUInt32 max_per_host = server->config->param.connections_max_per_host;
if (ctx->conn_type == SILC_SOCKET_TYPE_ROUTER && rconn) {
if (rconn->param) {
SilcIDListData idata;
SilcCipher cipher = NULL;
SilcHmac hmac = NULL;
- uint32 sequence = 0;
+ SilcUInt32 sequence = 0;
int ret;
if (!sock)
/* Creates connection to a remote router. */
void silc_server_create_connection(SilcServer server,
- const char *remote_host, uint32 port)
+ const char *remote_host, SilcUInt32 port)
{
SilcServerConnection sconn;
bool silc_server_create_channel_key(SilcServer server,
SilcChannelEntry channel,
- uint32 key_len)
+ SilcUInt32 key_len)
{
int i;
unsigned char channel_key[32], hash[32];
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Generating channel key"));
SilcChannelKeyPayload payload = NULL;
SilcChannelID *id = NULL;
unsigned char *tmp, hash[32];
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
char *cipher;
SILC_LOG_DEBUG(("Start"));
}
static SilcBuffer
-silc_server_announce_encode_notify(SilcNotifyType notify, uint32 argc, ...)
+silc_server_announce_encode_notify(SilcNotifyType notify, SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer p;
SilcBuffer *channels,
SilcBuffer *channel_users,
SilcBuffer **channel_users_modes,
- uint32 *channel_users_modes_c,
+ SilcUInt32 *channel_users_modes_c,
SilcBuffer **channel_topics,
SilcChannelID ***channel_ids,
unsigned long creation_time)
SilcIDCacheEntry id_cache;
SilcChannelEntry channel;
unsigned char *cid;
- uint32 id_len;
- uint16 name_len;
+ SilcUInt32 id_len;
+ SilcUInt16 name_len;
int len;
int i = *channel_users_modes_c;
bool announce;
SilcBuffer channels = NULL, channel_users = NULL;
SilcBuffer *channel_users_modes = NULL;
SilcBuffer *channel_topics = NULL;
- uint32 channel_users_modes_c = 0;
+ SilcUInt32 channel_users_modes_c = 0;
SilcChannelID **channel_ids = NULL;
SILC_LOG_DEBUG(("Announcing channels and channel users"));
SilcChannelEntry channel,
SilcBuffer *user_list,
SilcBuffer *mode_list,
- uint32 *user_count)
+ SilcUInt32 *user_count)
{
SilcChannelClientEntry chl;
SilcHashTableList htl;
SilcBuffer client_id_list;
SilcBuffer client_mode_list;
SilcBuffer idp;
- uint32 list_count = 0, len = 0;
+ SilcUInt32 list_count = 0, len = 0;
silc_hash_table_list(channel->user_list, &htl);
while (silc_hash_table_get(&htl, NULL, (void *)&chl))
SilcClientID *noadd,
SilcBuffer user_list,
SilcBuffer mode_list,
- uint32 user_count)
+ SilcUInt32 user_count)
{
int i;
- uint16 idp_len;
- uint32 mode;
+ SilcUInt16 idp_len;
+ SilcUInt32 mode;
SilcClientID *client_id;
SilcClientEntry client;
SilcIDCacheEntry cache;
SilcSocketConnection silc_server_get_client_route(SilcServer server,
unsigned char *id_data,
- uint32 id_len,
+ SilcUInt32 id_len,
SilcClientID *client_id,
SilcIDListData *idata)
{
SilcChannelClientEntry chl;
SilcHashTableList htl;
unsigned char *cid;
- uint32 id_len;
- uint16 name_len;
+ SilcUInt32 id_len;
+ SilcUInt16 name_len;
int len;
silc_hash_table_list(client->channels, &htl);
void *param;
/* Current connection retry info */
- uint32 retry_count;
- uint32 retry_timeout;
+ SilcUInt32 retry_count;
+ SilcUInt32 retry_timeout;
/* Back pointer to server */
SilcServer server;
SilcSocketConnection sock,
SilcPacketContext *packet);
void silc_server_create_connection(SilcServer server,
- const char *remote_host, uint32 port);
+ const char *remote_host, SilcUInt32 port);
void silc_server_close_connection(SilcServer server,
SilcSocketConnection sock);
void silc_server_free_client_data(SilcServer server,
int broadcast);
bool silc_server_create_channel_key(SilcServer server,
SilcChannelEntry channel,
- uint32 key_len);
+ SilcUInt32 key_len);
SilcChannelEntry silc_server_save_channel_key(SilcServer server,
SilcBuffer key_payload,
SilcChannelEntry channel);
SilcBuffer *channels,
SilcBuffer *channel_users,
SilcBuffer **channel_users_modes,
- uint32 *channel_users_modes_c,
+ SilcUInt32 *channel_users_modes_c,
SilcBuffer **channel_topics,
SilcChannelID ***channel_ids,
unsigned long creation_time);
SilcChannelEntry channel,
SilcBuffer *user_list,
SilcBuffer *mode_list,
- uint32 *user_count);
+ SilcUInt32 *user_count);
void silc_server_save_users_on_channel(SilcServer server,
SilcSocketConnection sock,
SilcChannelEntry channel,
SilcClientID *noadd,
SilcBuffer user_list,
SilcBuffer mode_list,
- uint32 user_count);
+ SilcUInt32 user_count);
SilcSocketConnection silc_server_get_client_route(SilcServer server,
unsigned char *id_data,
- uint32 id_len,
+ SilcUInt32 id_len,
SilcClientID *client_id,
SilcIDListData *idata);
SilcBuffer silc_server_get_client_channel_list(SilcServer server,
typedef struct {
SilcServerEntry server;
SilcIDIP ip;
- uint16 port;
+ SilcUInt16 port;
bool local;
} SilcServerBackupEntry;
by backup router. */
typedef struct {
SilcIDIP ip;
- uint16 port;
+ SilcUInt16 port;
SilcServerEntry server; /* Backup router that replaced the primary */
} SilcServerBackupReplaced;
/* Backup context */
struct SilcServerBackupStruct {
SilcServerBackupEntry *servers;
- uint32 servers_count;
+ SilcUInt32 servers_count;
SilcServerBackupReplaced **replaced;
- uint32 replaced_count;
+ SilcUInt32 replaced_count;
};
typedef struct {
- uint8 session;
+ SilcUInt8 session;
bool connected;
SilcServerEntry server_entry;
} SilcServerBackupProtocolSession;
SilcServer server;
SilcSocketConnection sock;
bool responder;
- uint8 type;
- uint8 session;
+ SilcUInt8 type;
+ SilcUInt8 session;
SilcServerBackupProtocolSession *sessions;
- uint32 sessions_count;
+ SilcUInt32 sessions_count;
long start;
} *SilcServerBackupProtocolContext;
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send,
bool local)
{
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send,
bool local)
{
SilcSocketConnection sock,
SilcPacketContext *packet)
{
- uint8 type, session;
+ SilcUInt8 type, session;
SilcServerBackupProtocolContext ctx;
int i, ret;
connection is created. */
void silc_server_backup_reconnect(SilcServer server,
- const char *ip, uint16 port,
+ const char *ip, SilcUInt16 port,
SilcServerConnectRouterCallback callback,
void *context)
{
SILC_PACKET_RESUME_ROUTER:
- <uint8 type> <uint8 Session ID>
+ <SilcUInt8 type> <SilcUInt8 Session ID>
<type> = the protocol opcode
<Session ID> = Identifier for this packet and any subsequent reply
SilcPacketType type,
SilcPacketFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send,
bool local);
void *dst_id,
SilcIdType dst_id_type,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
bool force_send,
bool local);
`ip' and `port'. The `connected' callback will be called when the
connection is created. */
void silc_server_backup_reconnect(SilcServer server,
- const char *ip, uint16 port,
+ const char *ip, SilcUInt16 port,
SilcServerConnectRouterCallback callback,
void *context);
various things. */
typedef struct {
/* Local stats (server and router) */
- uint32 my_clients; /* Locally connected clients */
- uint32 my_servers; /* Locally connected servers */
- uint32 my_routers; /* Locally connected routers */
- uint32 my_channels; /* Locally created channels */
- uint32 my_chanclients; /* Local clients on local channels */
- uint32 my_aways; /* Local clients away (XXX) */
- uint32 my_server_ops; /* Local server operators */
- uint32 my_router_ops; /* Local router operators */
+ SilcUInt32 my_clients; /* Locally connected clients */
+ SilcUInt32 my_servers; /* Locally connected servers */
+ SilcUInt32 my_routers; /* Locally connected routers */
+ SilcUInt32 my_channels; /* Locally created channels */
+ SilcUInt32 my_chanclients; /* Local clients on local channels */
+ SilcUInt32 my_aways; /* Local clients away (XXX) */
+ SilcUInt32 my_server_ops; /* Local server operators */
+ SilcUInt32 my_router_ops; /* Local router operators */
/* Global stats (mainly for router) */
- uint32 cell_clients; /* All clients in cell */
- uint32 cell_servers; /* All servers in cell */
- uint32 cell_channels; /* All channels in cell */
- uint32 cell_chanclients; /* All clients on cell's channels */
- uint32 clients; /* All clients */
- uint32 servers; /* All servers */
- uint32 routers; /* All routers */
- uint32 channels; /* All channels */
- uint32 chanclients; /* All clients on channels */
- uint32 server_ops; /* All server operators */
- uint32 router_ops; /* All router operators */
+ SilcUInt32 cell_clients; /* All clients in cell */
+ SilcUInt32 cell_servers; /* All servers in cell */
+ SilcUInt32 cell_channels; /* All channels in cell */
+ SilcUInt32 cell_chanclients; /* All clients on cell's channels */
+ SilcUInt32 clients; /* All clients */
+ SilcUInt32 servers; /* All servers */
+ SilcUInt32 routers; /* All routers */
+ SilcUInt32 channels; /* All channels */
+ SilcUInt32 chanclients; /* All clients on channels */
+ SilcUInt32 server_ops; /* All server operators */
+ SilcUInt32 router_ops; /* All router operators */
/* General */
- uint32 conn_attempts; /* Connection attempts */
- uint32 conn_failures; /* Connection failure */
- uint32 auth_attempts; /* Authentication attempts */
- uint32 auth_failures; /* Authentication failures */
- uint32 packets_sent; /* Sent packets */
- uint32 packets_received; /* Received packets */
+ SilcUInt32 conn_attempts; /* Connection attempts */
+ SilcUInt32 conn_failures; /* Connection failure */
+ SilcUInt32 auth_attempts; /* Authentication attempts */
+ SilcUInt32 auth_failures; /* Authentication failures */
+ SilcUInt32 packets_sent; /* Sent packets */
+ SilcUInt32 packets_received; /* Received packets */
} SilcServerStatistics;
/*
int sock;
SilcServerID *id;
unsigned char *id_string;
- uint32 id_string_len;
+ SilcUInt32 id_string_len;
SilcIdType id_type;
bool standalone; /* TRUE if server is standalone, and
primary router, and NULL otherwise. */
/* Current command identifier, 0 not used */
- uint16 cmd_ident;
+ SilcUInt16 cmd_ident;
/* SILC server scheduler */
SilcSchedule schedule;
typedef struct {
SilcServer server;
SilcSocketConnection sock;
- uint32 failure;
+ SilcUInt32 failure;
} *SilcServerFailureContext;
/* Macros */
SilcClientEntry client = NULL;
SilcBuffer idp;
SilcClientEntry *clients = NULL;
- uint32 clients_c = 0;
+ SilcUInt32 clients_c = 0;
unsigned char **argv = NULL;
- uint32 *argv_lens = NULL, *argv_types = NULL, argc = 0;
+ SilcUInt32 *argv_lens = NULL, *argv_types = NULL, argc = 0;
SilcHashTableList htl;
SilcChannelEntry channel;
SilcHashTable channels;
/* Checks string for bad characters and returns TRUE if they are found. */
-bool silc_server_name_bad_chars(const char *name, uint32 name_len)
+bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len)
{
int i;
/* Modifies the `name' if it includes bad characters and returns new
allocated name that does not include bad characters. */
-char *silc_server_name_modify_bad(const char *name, uint32 name_len)
+char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len)
{
int i;
char *newname = strdup(name);
/* Find number of sockets by IP address indicated by `ip'. Returns 0 if
socket connections with the IP address does not exist. */
-uint32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip)
+SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip)
{
int i, count;
SilcChannelEntry channel);
/* Checks string for bad characters and returns TRUE if they are found. */
-bool silc_server_name_bad_chars(const char *name, uint32 name_len);
+bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len);
/* Modifies the `nick' if it includes bad characters and returns new
allocated nickname that does not include bad characters. */
-char *silc_server_name_modify_bad(const char *name, uint32 name_len);
+char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len);
/* Find number of sockets by IP address indicated by `ip'. Returns 0 if
socket connections with the IP address does not exist. */
-uint32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip);
+SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip);
#endif /* SERVER_UTIL_H */
/* Find connection parameters by the parameter block name. */
static SilcServerConfigConnParams *
-my_find_param(SilcServerConfig config, const char *name, uint32 line)
+my_find_param(SilcServerConfig config, const char *name, SilcUInt32 line)
{
SilcServerConfigConnParams *param;
}
/* parse an authdata according to its auth method */
-static bool my_parse_authdata(SilcAuthMethod auth_meth, char *p, uint32 line,
- void **auth_data, uint32 *auth_data_len)
+static bool my_parse_authdata(SilcAuthMethod auth_meth, char *p, SilcUInt32 line,
+ void **auth_data, SilcUInt32 *auth_data_len)
{
if (auth_meth == SILC_AUTH_PASSWORD) {
/* p is a plain text password */
if (auth_data)
*auth_data = (void *) strdup(p);
if (auth_data_len)
- *auth_data_len = (uint32) strlen(p);
+ *auth_data_len = (SilcUInt32) strlen(p);
} else if (auth_meth == SILC_AUTH_PUBLIC_KEY) {
/* p is a public key */
SilcPublicKey public_key;
config->require_reverse_lookup = *(bool *)val;
}
else if (!strcmp(name, "connections_max")) {
- config->param.connections_max = (uint32) *(int *)val;
+ config->param.connections_max = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "connections_max_per_host")) {
- config->param.connections_max_per_host = (uint32) *(int *)val;
+ config->param.connections_max_per_host = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "keepalive_secs")) {
- config->param.keepalive_secs = (uint32) *(int *)val;
+ config->param.keepalive_secs = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "reconnect_count")) {
- config->param.reconnect_count = (uint32) *(int *)val;
+ config->param.reconnect_count = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "reconnect_interval")) {
- config->param.reconnect_interval = (uint32) *(int *)val;
+ config->param.reconnect_interval = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "reconnect_interval_max")) {
- config->param.reconnect_interval_max = (uint32) *(int *)val;
+ config->param.reconnect_interval_max = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "reconnect_keep_trying")) {
config->param.reconnect_keep_trying = *(bool *)val;
}
else if (!strcmp(name, "key_exchange_rekey")) {
- config->param.key_exchange_rekey = (uint32) *(int *)val;
+ config->param.key_exchange_rekey = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "key_exchange_pfs")) {
config->param.key_exchange_pfs = *(bool *)val;
}
else if (!strcmp(name, "channel_rekey_secs")) {
- config->channel_rekey_secs = (uint32) *(int *)val;
+ config->channel_rekey_secs = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "key_exchange_timeout")) {
- config->key_exchange_timeout = (uint32) *(int *)val;
+ config->key_exchange_timeout = (SilcUInt32) *(int *)val;
}
else if (!strcmp(name, "conn_auth_timeout")) {
- config->conn_auth_timeout = (uint32) *(int *)val;
+ config->conn_auth_timeout = (SilcUInt32) *(int *)val;
}
else
return SILC_CONFIG_EINTERNAL;
tmp->module = (*(char *)val ? strdup((char *) val) : NULL);
}
else if (!strcmp(name, "keylength")) {
- tmp->key_length = *(uint32 *)val;
+ tmp->key_length = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "blocklength")) {
- tmp->block_length = *(uint32 *)val;
+ tmp->block_length = *(SilcUInt32 *)val;
}
else
return SILC_CONFIG_EINTERNAL;
fprintf(stderr, "Invalid port number!\n");
return SILC_CONFIG_ESILENT;
}
- server_info->port = (uint16) port;
+ server_info->port = (SilcUInt16) port;
}
else if (!strcmp(name, "servertype")) {
CONFIG_IS_DOUBLE(server_info->server_type);
config->tmp = silc_calloc(1, sizeof(*tmp));
tmp = (SilcServerConfigLogging *) config->tmp;
}
- tmp->maxsize = *(uint32 *) val;
+ tmp->maxsize = *(SilcUInt32 *) val;
}
else
return SILC_CONFIG_EINTERNAL;
tmp->name = (*(char *)val ? strdup((char *) val) : NULL);
}
else if (!strcmp(name, "connections_max")) {
- tmp->connections_max = *(uint32 *)val;
+ tmp->connections_max = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "connections_max_per_host")) {
- tmp->connections_max_per_host = *(uint32 *)val;
+ tmp->connections_max_per_host = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "keepalive_secs")) {
- tmp->keepalive_secs = *(uint32 *)val;
+ tmp->keepalive_secs = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "reconnect_count")) {
- tmp->reconnect_count = *(uint32 *)val;
+ tmp->reconnect_count = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "reconnect_interval")) {
- tmp->reconnect_interval = *(uint32 *)val;
+ tmp->reconnect_interval = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "reconnect_interval_max")) {
- tmp->reconnect_interval_max = *(uint32 *)val;
+ tmp->reconnect_interval_max = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "reconnect_keep_trying")) {
tmp->reconnect_keep_trying = *(bool *)val;
}
else if (!strcmp(name, "key_exchange_rekey")) {
- tmp->key_exchange_rekey = *(uint32 *)val;
+ tmp->key_exchange_rekey = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "key_exchange_pfs")) {
tmp->key_exchange_pfs = *(bool *)val;
fprintf(stderr, "Invalid port number!\n");
return SILC_CONFIG_ESILENT;
}
- tmp->port = (uint16) port;
+ tmp->port = (SilcUInt16) port;
}
else if (!strcmp(name, "passphrase")) {
if (!my_parse_authdata(SILC_AUTH_PASSWORD, (char *) val, line,
fprintf(stderr, "Invalid port number!\n");
return SILC_CONFIG_ESILENT;
}
- tmp->backup_replace_port = (uint16) port;
+ tmp->backup_replace_port = (SilcUInt16) port;
}
else if (!strcmp(name, "backuplocal")) {
tmp->backup_local = *(bool *)val;
/* handle this special error return which asks to quietly return */
if (ret != SILC_CONFIG_ESILENT) {
char *linebuf, *filename = silc_config_get_filename(file);
- uint32 line = silc_config_get_line(file);
+ SilcUInt32 line = silc_config_get_line(file);
fprintf(stderr, "\nError while parsing config file: %s.\n",
silc_config_strerror(ret));
linebuf = silc_config_read_line(file, line);
typedef struct SilcServerConfigCipherStruct {
char *name;
char *module;
- uint32 key_length;
- uint32 block_length;
+ SilcUInt32 key_length;
+ SilcUInt32 block_length;
struct SilcServerConfigCipherStruct *next;
} SilcServerConfigCipher;
typedef struct SilcServerConfigHashStruct {
char *name;
char *module;
- uint32 block_length;
- uint32 digest_length;
+ SilcUInt32 block_length;
+ SilcUInt32 digest_length;
struct SilcServerConfigHashStruct *next;
} SilcServerConfigHash;
typedef struct SilcServerConfigHmacStruct {
char *name;
char *hash;
- uint32 mac_length;
+ SilcUInt32 mac_length;
struct SilcServerConfigHmacStruct *next;
} SilcServerConfigHmac;
typedef struct SilcServerConfigServerInfoStruct {
char *server_name;
char *server_ip;
- uint16 port;
+ SilcUInt16 port;
char *server_type; /* E.g. "Test Server" */
char *location; /* geographic location */
char *admin; /* admin full name */
typedef struct SilcServerConfigLoggingStruct {
char *file;
- uint32 maxsize;
+ SilcUInt32 maxsize;
} SilcServerConfigLogging;
/* Connection parameters */
typedef struct SilcServerConfigConnParams {
char *name;
- uint32 connections_max;
- uint32 connections_max_per_host;
- uint32 keepalive_secs;
- uint32 reconnect_count;
- uint32 reconnect_interval;
- uint32 reconnect_interval_max;
+ SilcUInt32 connections_max;
+ SilcUInt32 connections_max_per_host;
+ SilcUInt32 keepalive_secs;
+ SilcUInt32 reconnect_count;
+ SilcUInt32 reconnect_interval;
+ SilcUInt32 reconnect_interval_max;
bool reconnect_keep_trying;
- uint32 key_exchange_rekey;
+ SilcUInt32 key_exchange_rekey;
bool key_exchange_pfs;
struct SilcServerConfigConnParams *next;
} SilcServerConfigConnParams;
typedef struct SilcServerConfigClientStruct {
char *host;
unsigned char *passphrase;
- uint32 passphrase_len;
+ SilcUInt32 passphrase_len;
void *publickey;
SilcServerConfigConnParams *param;
struct SilcServerConfigClientStruct *next;
char *user;
char *nick;
unsigned char *passphrase;
- uint32 passphrase_len;
+ SilcUInt32 passphrase_len;
void *publickey;
struct SilcServerConfigAdminStruct *next;
} SilcServerConfigAdmin;
typedef struct SilcServerConfigServerStruct {
char *host;
unsigned char *passphrase;
- uint32 passphrase_len;
+ SilcUInt32 passphrase_len;
void *publickey;
char *version;
SilcServerConfigConnParams *param;
typedef struct SilcServerConfigRouterStruct {
char *host;
unsigned char *passphrase;
- uint32 passphrase_len;
+ SilcUInt32 passphrase_len;
void *publickey;
- uint16 port;
+ SilcUInt16 port;
char *version;
SilcServerConfigConnParams *param;
bool initiator;
bool backup_router;
char *backup_replace_ip;
- uint16 backup_replace_port;
+ SilcUInt16 backup_replace_port;
bool backup_local;
struct SilcServerConfigRouterStruct *next;
} SilcServerConfigRouter;
char *module_path;
bool prefer_passphrase_auth;
bool require_reverse_lookup;
- uint32 channel_rekey_secs;
- uint32 key_exchange_timeout;
- uint32 conn_auth_timeout;
+ SilcUInt32 channel_rekey_secs;
+ SilcUInt32 key_exchange_timeout;
+ SilcUInt32 conn_auth_timeout;
SilcServerConfigConnParams param;
/* Other configuration sections */
/* Creates a Server ID. Newly created Server ID is returned to the
new_id argument. */
-void silc_id_create_server_id(const char *ip, uint16 port, SilcRng rng,
+void silc_id_create_server_id(const char *ip, SilcUInt16 port, SilcRng rng,
SilcServerID **new_id)
{
SILC_LOG_DEBUG(("Creating new Server ID"));
#define SERVERID_H
/* Prototypes */
-void silc_id_create_server_id(const char *ip, uint16 port, SilcRng rng,
+void silc_id_create_server_id(const char *ip, SilcUInt16 port, SilcRng rng,
SilcServerID **new_id);
bool silc_id_create_client_id(SilcServer server,
SilcServerID *server_id, SilcRng rng,
if (silcd->config->server_info->pid_file) {
int oldpid;
char *buf;
- uint32 buf_len;
+ SilcUInt32 buf_len;
SILC_LOG_DEBUG(("Checking for another silcd running"));
buf = silc_file_readfile(silcd->config->server_info->pid_file, &buf_len);
SilcPrivateKey prv_key;
SilcRng rng;
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
char pkfile[256], prvfile[256];
if (!pkcs_name || !path)
if (domain->hash_size > 2 && domain->hash_tab != NULL)
{
/* Use the hashing table. */
- nls_uint32 len = strlen (msgid);
- nls_uint32 hash_val = hash_string (msgid);
- nls_uint32 idx = hash_val % domain->hash_size;
- nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
+ nls_SilcUInt32 len = strlen (msgid);
+ nls_SilcUInt32 hash_val = hash_string (msgid);
+ nls_SilcUInt32 idx = hash_val % domain->hash_size;
+ nls_SilcUInt32 incr = 1 + (hash_val % (domain->hash_size - 2));
while (1)
{
- nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
+ nls_SilcUInt32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
if (nstr == 0)
/* Hash table entry is empty. */
#endif
#if UINT_MAX == UINT_MAX_32_BITS
-typedef unsigned nls_uint32;
+typedef unsigned nls_SilcUInt32;
#else
# if USHRT_MAX == UINT_MAX_32_BITS
-typedef unsigned short nls_uint32;
+typedef unsigned short nls_SilcUInt32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
-typedef unsigned long nls_uint32;
+typedef unsigned long nls_SilcUInt32;
# else
/* The following line is intended to throw an error. Using #error is
not portable enough. */
struct mo_file_header
{
/* The magic number. */
- nls_uint32 magic;
+ nls_SilcUInt32 magic;
/* The revision number of the file format. */
- nls_uint32 revision;
+ nls_SilcUInt32 revision;
/* The number of strings pairs. */
- nls_uint32 nstrings;
+ nls_SilcUInt32 nstrings;
/* Offset of table with start offsets of original strings. */
- nls_uint32 orig_tab_offset;
+ nls_SilcUInt32 orig_tab_offset;
/* Offset of table with start offsets of translation strings. */
- nls_uint32 trans_tab_offset;
+ nls_SilcUInt32 trans_tab_offset;
/* Size of hashing table. */
- nls_uint32 hash_tab_size;
+ nls_SilcUInt32 hash_tab_size;
/* Offset of first hashing entry. */
- nls_uint32 hash_tab_offset;
+ nls_SilcUInt32 hash_tab_offset;
};
struct string_desc
{
/* Length of addressed string. */
- nls_uint32 length;
+ nls_SilcUInt32 length;
/* Offset of string in file. */
- nls_uint32 offset;
+ nls_SilcUInt32 offset;
};
/* @@ begin of epilog @@ */
#include "loadinfo.h"
-#include "gettext.h" /* Get nls_uint32. */
+#include "gettext.h" /* Get nls_SilcUInt32. */
/* @@ end of prolog @@ */
# include <byteswap.h>
# define SWAP(i) bswap_32 (i)
#else
-static inline nls_uint32
+static inline nls_SilcUInt32
SWAP (i)
- nls_uint32 i;
+ nls_SilcUInt32 i;
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
}
int use_mmap;
size_t mmap_size;
int must_swap;
- nls_uint32 nstrings;
+ nls_SilcUInt32 nstrings;
struct string_desc *orig_tab;
struct string_desc *trans_tab;
- nls_uint32 hash_size;
- nls_uint32 *hash_tab;
+ nls_SilcUInt32 hash_size;
+ nls_SilcUInt32 *hash_tab;
int codeset_cntr;
#ifdef _LIBC
__gconv_t conv;
domain->trans_tab = (struct string_desc *)
((char *) data + W (domain->must_swap, data->trans_tab_offset));
domain->hash_size = W (domain->must_swap, data->hash_tab_size);
- domain->hash_tab = (nls_uint32 *)
+ domain->hash_tab = (nls_SilcUInt32 *)
((char *) data + W (domain->must_swap, data->hash_tab_offset));
break;
default:
SilcClientCommand cmd;
SilcClientCommandContext ctx;
char *tmpcmd;
- uint32 argc = 0;
+ SilcUInt32 argc = 0;
unsigned char **argv;
- uint32 *argv_lens, *argv_types;
+ SilcUInt32 *argv_lens, *argv_types;
// Parse arguments
tmpcmd = parse_command(msg.c_str());
SilcPrivateKey prv_key;
SilcRng rng;
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
char pkfile[256], prvfile[256];
if (!pkcs_name || !path)
static
void silc_auth_meth(SilcClient client,
SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcGetAuthMeth completion, void *context)
{
completion(TRUE, SILC_AUTH_NONE, NULL, 0, context);
static
void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context)
{
completion(TRUE, context);
#ifndef BITMOVE_H
#define BITMOVE_H
-#define GET_WORD(cp) ((uint32)(uint8)(cp)[0]) << 24 \
- | ((uint32)(uint8)(cp)[1] << 16) \
- | ((uint32)(uint8)(cp)[2] << 8) \
- | ((uint32)(uint8)(cp)[3])
+#define GET_WORD(cp) ((SilcUInt32)(SilcUInt8)(cp)[0]) << 24 \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 16) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[2] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[3])
/* Returns eight 8-bit bytes, most significant bytes first. */
#define SILC_GET64_MSB(l, cp) \
- (l) = ((((uint64)GET_WORD((cp))) << 32) | \
- ((uint64)GET_WORD((cp) + 4)))
+ (l) = ((((SilcUInt64)GET_WORD((cp))) << 32) | \
+ ((SilcUInt64)GET_WORD((cp) + 4)))
#define SILC_PUT64_MSB(l, cp) \
do { \
- SILC_PUT32_MSB((uint32)((uint64)(l) >> 32), (cp)); \
- SILC_PUT32_MSB((uint32)(l), (cp) + 4); \
+ SILC_PUT32_MSB((SilcUInt32)((SilcUInt64)(l) >> 32), (cp)); \
+ SILC_PUT32_MSB((SilcUInt32)(l), (cp) + 4); \
} while(0)
/* Returns four 8-bit bytes, most significant bytes first. */
#define SILC_GET32_MSB(l, cp) \
- (l) = ((uint32)(uint8)(cp)[0]) << 24 \
- | ((uint32)(uint8)(cp)[1] << 16) \
- | ((uint32)(uint8)(cp)[2] << 8) \
- | ((uint32)(uint8)(cp)[3])
+ (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) << 24 \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 16) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[2] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[3])
#define SILC_PUT32_MSB(l, cp) \
(cp)[0] = l >> 24; \
(cp)[1] = l >> 16; \
/* Returns four 8-bit bytes, less significant bytes first. */
#define SILC_GET32_LSB(l, cp) \
- (l) = ((uint32)(uint8)(cp)[0]) \
- | ((uint32)(uint8)(cp)[1] << 8) \
- | ((uint32)(uint8)(cp)[2] << 16) \
- | ((uint32)(uint8)(cp)[3] << 24)
+ (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24)
/* same as upper but XOR the result always */
#define SILC_GET32_X_LSB(l, cp) \
- (l) ^= ((uint32)(uint8)(cp)[0]) \
- | ((uint32)(uint8)(cp)[1] << 8) \
- | ((uint32)(uint8)(cp)[2] << 16) \
- | ((uint32)(uint8)(cp)[3] << 24)
+ (l) ^= ((SilcUInt32)(SilcUInt8)(cp)[0]) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[2] << 16) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[3] << 24)
#define SILC_PUT32_LSB(l, cp) \
(cp)[0] = l; \
(cp)[1] = l >> 8; \
/* Returns two 8-bit bytes, most significant bytes first. */
#define SILC_GET16_MSB(l, cp) \
- (l) = ((uint32)(uint8)(cp)[0] << 8) \
- | ((uint32)(uint8)(cp)[1])
+ (l) = ((SilcUInt32)(SilcUInt8)(cp)[0] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1])
#define SILC_PUT16_MSB(l, cp) \
(cp)[0] = l >> 8; \
(cp)[1] = l;
/* Returns two 8-bit bytes, less significant bytes first. */
#define SILC_GET16_LSB(l, cp) \
- (l) = ((uint32)(uint8)(cp)[0]) \
- | ((uint32)(uint8)(cp)[1] << 8)
+ (l) = ((SilcUInt32)(SilcUInt8)(cp)[0]) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 8)
#define SILC_PUT16_LSB(l, cp) \
(cp)[0] = l; \
(cp)[1] = l >> 8;
#endif
/* Define types. The types must be at least of the specified size */
-#undef uint8
-#undef uint16
-#undef uint32
-#undef uin64
-#undef int8
-#undef int16
-#undef int32
-#undef int64
-
-typedef unsigned char uint8;
-typedef signed char int8;
+
+typedef unsigned char SilcUInt8;
+typedef signed char SilcInt8;
#if SILC_SIZEOF_SHORT > 2
#error "size of the short must be 2 bytes"
#endif
-typedef unsigned short uint16;
-typedef signed short int16;
+typedef unsigned short SilcUInt16;
+typedef signed short SilcInt16;
#if SILC_SIZEOF_LONG == 4
-typedef unsigned long uint32;
-typedef signed long int32;
+typedef unsigned long SilcUInt32;
+typedef signed long SilcInt32;
#else
#if SILC_SIZEOF_INT == 4
-typedef unsigned long uint32;
-typedef signed long int32;
+typedef unsigned int SilcUInt32;
+typedef signed int SilcInt32;
#else
#if SILC_SIZEOF_LONG_LONG >= 4
#ifndef WIN32
-typedef unsigned long long uint32;
-typedef signed long long int32;
+typedef unsigned long long SilcUInt32;
+typedef signed long long SilcInt32;
#endif
#endif
#endif
#endif
#if SILC_SIZEOF_LONG >= 8
-typedef unsigned long uint64;
-typedef signed long int64;
+typedef unsigned long SilcUInt64;
+typedef signed long SilcInt64;
#else
#if SILC_SIZEOF_LONG_LONG >= 8
#ifndef WIN32
-typedef unsigned long long uint64;
-typedef signed long long int64;
+typedef unsigned long long SilcUInt64;
+typedef signed long long SilcInt64;
#else
-typedef uint32 uint64; /* XXX Use Windows's own 64 bit types */
-typedef int32 int64;
+typedef SilcUInt32 SilcUInt64; /* XXX Use Windows's own 64 bit types */
+typedef SilcInt32 SilcInt64;
#endif
#else
-typedef uint32 uint64;
-typedef int32 int64;
+typedef SilcUInt32 SilcUInt64;
+typedef SilcInt32 SilcInt64;
#endif
#endif
#if SILC_SIZEOF_VOID_P < 4
-typedef uint32 * void *;
+typedef SilcUInt32 * void *;
#endif
#ifndef __cplusplus
void silc_client_resolve_auth_method(bool success,
SilcProtocolAuthMeth auth_meth,
const unsigned char *auth_data,
- uint32 auth_data_len, void *context);
+ SilcUInt32 auth_data_len, void *context);
/* Allocates new client object. This has to be done before client may
work. After calling this one must call silc_client_init to initialize
void silc_client_resolve_auth_method(bool success,
SilcProtocolAuthMeth auth_meth,
const unsigned char *auth_data,
- uint32 auth_data_len, void *context)
+ SilcUInt32 auth_data_len, void *context)
{
SilcClientConnAuthInternalContext *proto_ctx =
(SilcClientConnAuthInternalContext *)context;
SilcCipher cipher,
SilcHmac hmac,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send)
{
SilcPacketContext packetdata;
int block_len;
- uint32 sequence = 0;
+ SilcUInt32 sequence = 0;
if (!sock)
return;
SilcSocketConnection sock,
SilcPacketContext *packet)
{
- uint32 failure = 0;
+ SilcUInt32 failure = 0;
if (sock->protocol) {
if (packet->buffer->len >= 4)
SilcPacketContext *packet)
{
SilcClientConnection conn = (SilcClientConnection)sock->user_data;
- uint16 conn_type, auth_meth;
+ SilcUInt16 conn_type, auth_meth;
int ret;
/* If we haven't send our request then ignore this one. */
/* Current sending encryption key, provided for re-key. The `pfs'
is TRUE if the Perfect Forward Secrecy is performed in re-key. */
unsigned char *send_enc_key;
- uint32 enc_key_len;
+ SilcUInt32 enc_key_len;
int ske_group;
bool pfs;
- uint32 timeout;
+ SilcUInt32 timeout;
void *context;
} *SilcClientRekey;
/* Decoded local ID so that the above defined ID would not have
to be decoded for every packet. */
unsigned char *local_id_data;
- uint32 local_id_data_len;
+ SilcUInt32 local_id_data_len;
/* Own client entry. */
SilcClientEntry local_entry;
/* Decoded remote ID so that the above defined ID would not have
to be decoded for every packet. */
unsigned char *remote_id_data;
- uint32 remote_id_data_len;
+ SilcUInt32 remote_id_data_len;
/*
* Common data
SilcHmac hmac_send;
SilcHmac hmac_receive;
SilcHash hash;
- uint32 psn_send;
- uint32 psn_receive;
+ SilcUInt32 psn_send;
+ SilcUInt32 psn_receive;
/* Client ID and Channel ID cache. Messages transmitted in SILC network
are done using different unique ID's. These are the cache for
SilcDList pending_commands;
/* Current command identifier, 0 not used */
- uint16 cmd_ident;
+ SilcUInt16 cmd_ident;
/* Requested pings. */
SilcClientPing *ping;
- uint32 ping_count;
+ SilcUInt32 ping_count;
/* Set away message */
SilcClientAway *away;
/* File transmission sessions */
SilcDList ftp_sessions;
- uint32 next_session_id;
+ SilcUInt32 next_session_id;
SilcClientFtpSession active_session;
/* Pointer back to the SilcClient. This object is passed to the application
SilcChannelPrivateKey key,
SilcMessageFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send)
{
int i;
SilcCipher cipher;
SilcHmac hmac;
unsigned char *id_string;
- uint32 iv_len;
+ SilcUInt32 iv_len;
int block_len;
SILC_LOG_DEBUG(("Sending packet to channel"));
static void silc_client_channel_message_cb(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcChannelClientResolve res = (SilcChannelClientResolve)context;
SilcChannelEntry channel)
{
unsigned char *id_string, *key, *cipher, *hmac, hash[32];
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcChannelID *id;
SilcChannelKeyPayload payload;
char *cipher,
char *hmac,
unsigned char *key,
- uint32 key_len)
+ SilcUInt32 key_len)
{
SilcChannelPrivateKey entry;
unsigned char hash[32];
silc_client_list_channel_private_keys(SilcClient client,
SilcClientConnection conn,
SilcChannelEntry channel,
- uint32 *key_count)
+ SilcUInt32 *key_count)
{
SilcChannelPrivateKey *keys = NULL, entry;
- uint32 count = 0;
+ SilcUInt32 count = 0;
if (!channel->private_keys)
return NULL;
/* Frees the SilcChannelPrivateKey array. */
void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
- uint32 key_count)
+ SilcUInt32 key_count)
{
silc_free(keys);
}
/* File transmission session */
struct SilcClientFtpSessionStruct {
- uint32 session_id;
+ SilcUInt32 session_id;
SilcClient client;
SilcClientConnection conn;
SilcClientEntry client_entry;
SilcBuffer packet;
char *hostname;
- uint16 port;
+ SilcUInt16 port;
int listener;
SilcClientFileMonitor monitor;
SilcSFTPHandle dir_handle;
SilcSFTPHandle read_handle;
- uint64 filesize;
- uint64 read_offset;
+ SilcUInt64 filesize;
+ SilcUInt64 read_offset;
int fd;
};
static void silc_client_ftp_data(SilcSFTP sftp,
SilcSFTPStatus status,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
void *context)
{
SilcClientFtpSession session = (SilcClientFtpSession)context;
SilcClientFileMonitor monitor,
void *monitor_context,
const char *local_ip,
- uint32 local_port,
+ SilcUInt32 local_port,
SilcClientEntry client_entry,
const char *filepath,
- uint32 *session_id)
+ SilcUInt32 *session_id)
{
SilcClientFtpSession session;
SilcBuffer keyagr, ftp;
SilcClientConnection conn,
SilcClientFileMonitor monitor,
void *monitor_context,
- uint32 session_id)
+ SilcUInt32 session_id)
{
SilcClientFtpSession session;
SilcBuffer keyagr, ftp;
SilcClientFileError silc_client_file_close(SilcClient client,
SilcClientConnection conn,
- uint32 session_id)
+ SilcUInt32 session_id)
{
SilcClientFtpSession session;
static void silc_client_ftp_resolve_cb(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcPacketContext *packet = (SilcPacketContext *)context;
SilcKeyAgreementPayload payload = NULL;
SilcClientEntry client_entry;
char *hostname;
- uint16 port;
+ SilcUInt16 port;
SILC_LOG_DEBUG(("Start"));
SilcPacketContext *packet)
{
SilcClientConnection conn = (SilcClientConnection)sock->user_data;
- uint8 type;
+ SilcUInt8 type;
int ret;
SILC_LOG_DEBUG(("Start"));
/* Table of connections in client. All the connection data is saved here. */
SilcClientConnection *conns;
- uint32 conns_count;
+ SilcUInt32 conns_count;
/* Table of listenning sockets in client. Client can have listeners
(like key agreement protocol server) and those sockets are saved here.
This table is checked always if the connection object cannot be found
from the `conns' table. */
SilcSocketConnection *sockets;
- uint32 sockets_count;
+ SilcUInt32 sockets_count;
/* Registered commands */
SilcList commands;
SilcCipher cipher,
SilcHmac hmac,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send);
void silc_client_disconnected_by_server(SilcClient client,
SilcSocketConnection sock,
const char *hostname,
const char *bindhost,
int port,
- uint32 timeout_secs,
+ SilcUInt32 timeout_secs,
SilcKeyAgreementCallback completion,
void *context)
{
silc_client_key_agreement_resolve_cb(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcPacketContext *packet = (SilcPacketContext *)context;
SilcChannelUser chu;
SilcServerEntry server;
unsigned char *tmp;
- uint32 tmp_len, mode;
+ SilcUInt32 tmp_len, mode;
SILC_LOG_DEBUG(("Start"));
* from channels as they quit as well.
*/
SilcClientEntry *clients = NULL;
- uint32 clients_count = 0;
+ SilcUInt32 clients_count = 0;
int i;
SILC_LOG_DEBUG(("Notify: SIGNOFF"));
static void
silc_get_auth_method(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port, SilcGetAuthMeth completion,
+ char *hostname, SilcUInt16 port, SilcGetAuthMeth completion,
void *context)
{
static void
silc_verify_public_key(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context)
{
static int
silc_key_agreement(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, const char *hostname,
- uint16 port, SilcKeyAgreementCallback *completion,
+ SilcUInt16 port, SilcKeyAgreementCallback *completion,
void **context)
{
static void
silc_ftp(SilcClient client, SilcClientConnection conn,
- SilcClientEntry client_entry, uint32 session_id,
- const char *hostname, uint16 port)
+ SilcClientEntry client_entry, SilcUInt32 session_id,
+ const char *hostname, SilcUInt16 port)
{
}
SilcClientEntry client_entry,
SilcMessageFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send)
{
SilcSocketConnection sock = conn->sock;
static void silc_client_private_message_cb(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcPacketContext *packet = (SilcPacketContext *)context;
static void silc_client_private_message_key_cb(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context)
{
SilcPacketContext *packet = (SilcPacketContext *)context;
unsigned char *key;
- uint16 key_len;
+ SilcUInt16 key_len;
unsigned char *cipher;
int ret;
SilcClientEntry client_entry,
char *cipher,
unsigned char *key,
- uint32 key_len,
+ SilcUInt32 key_len,
bool generate_key,
bool responder)
{
unsigned char private_key[32];
- uint32 len;
+ SilcUInt32 len;
int i;
SilcSKEKeyMaterial *keymat;
SilcPrivateMessageKeys
silc_client_list_private_message_keys(SilcClient client,
SilcClientConnection conn,
- uint32 *key_count)
+ SilcUInt32 *key_count)
{
SilcPrivateMessageKeys keys;
- uint32 count = 0;
+ SilcUInt32 count = 0;
SilcIDCacheEntry id_cache;
SilcIDCacheList list;
SilcClientEntry entry;
silc_client_list_private_message_keys. */
void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
- uint32 key_count)
+ SilcUInt32 key_count)
{
silc_free(keys);
}
encoded into correct form and in correct order. */
void silc_client_command_send(SilcClient client, SilcClientConnection conn,
- SilcCommand command, uint16 ident,
- uint32 argc, ...)
+ SilcCommand command, SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
SilcBuffer packet;
va_list ap;
void silc_client_command_pending(SilcClientConnection conn,
SilcCommand reply_cmd,
- uint16 ident,
+ SilcUInt16 ident,
SilcCommandCb callback,
void *context)
{
void silc_client_command_pending_del(SilcClientConnection conn,
SilcCommand reply_cmd,
- uint16 ident)
+ SilcUInt16 ident)
{
SilcClientCommandPending *r;
int silc_client_command_pending_check(SilcClientConnection conn,
SilcClientCommandReplyContext ctx,
SilcCommand command,
- uint16 ident)
+ SilcUInt16 ident)
{
SilcClientCommandPending *r;
SilcClientEntry client_entry = NULL;
SilcChannelEntry channel;
SilcBuffer buffer, clidp, chidp;
- uint32 type = 0;
+ SilcUInt32 type = 0;
char *nickname = NULL, *name;
char *invite = NULL;
SilcClientConnection conn = cmd->conn;
SilcBuffer buffer, idp;
unsigned char *cp, modebuf[4];
- uint32 mode, add, len;
+ SilcUInt32 mode, add, len;
int i;
if (!cmd->conn) {
SilcChannelEntry channel;
SilcBuffer buffer, chidp, auth = NULL;
unsigned char *name, *cp, modebuf[4], tmp[4], *arg = NULL;
- uint32 mode, add, type, len, arg_len = 0;
+ SilcUInt32 mode, add, type, len, arg_len = 0;
int i;
if (!cmd->conn) {
SilcClientEntry client_entry;
SilcBuffer buffer, clidp, chidp, auth = NULL;
unsigned char *name, *cp, modebuf[4];
- uint32 mode = 0, add, len;
+ SilcUInt32 mode = 0, add, len;
char *nickname = NULL;
int i;
}
static void silc_client_command_oper_send(unsigned char *data,
- uint32 data_len, void *context)
+ SilcUInt32 data_len, void *context)
{
SilcClientCommandContext cmd = (SilcClientCommandContext)context;
SilcClientConnection conn = cmd->conn;
}
static void silc_client_command_silcoper_send(unsigned char *data,
- uint32 data_len, void *context)
+ SilcUInt32 data_len, void *context)
{
SilcClientCommandContext cmd = (SilcClientCommandContext)context;
SilcClientConnection conn = cmd->conn;
SilcClientConnection conn = cmd->conn;
SilcBuffer buffer;
unsigned char port[4];
- uint32 tmp;
+ SilcUInt32 tmp;
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
SilcClientConnection conn = cmd->conn;
SilcBuffer buffer;
unsigned char port[4];
- uint32 tmp;
+ SilcUInt32 tmp;
if (!cmd->conn) {
SILC_NOT_CONNECTED(cmd->client, cmd->conn);
const char *name,
SilcCommandCb command_function,
SilcCommandCb command_reply_function,
- uint8 max_args,
- uint16 ident)
+ SilcUInt8 max_args,
+ SilcUInt16 ident)
{
SilcClientCommand cmd;
SilcCommand command,
SilcCommandCb command_function,
SilcCommandCb command_reply_function,
- uint16 ident)
+ SilcUInt16 ident)
{
SilcClientCommand cmd;
SilcCommandCb command; /* Command function */
SilcCommandCb reply; /* Command reply callback */
char *name; /* Name of the command (optional) */
- uint8 max_args; /* Maximum arguments (optional) */
- uint16 ident; /* Identifier for command (optional) */
+ SilcUInt8 max_args; /* Maximum arguments (optional) */
+ SilcUInt16 ident; /* Identifier for command (optional) */
struct SilcClientCommandStruct *next;
};
SilcClient client;
SilcClientConnection conn;
SilcClientCommand command;
- uint32 argc;
+ SilcUInt32 argc;
unsigned char **argv;
- uint32 *argv_lens;
- uint32 *argv_types;
+ SilcUInt32 *argv_lens;
+ SilcUInt32 *argv_types;
int pending; /* Command is being re-processed when TRUE */
int users; /* Reference counter */
};
SilcCommand reply_cmd;
SilcCommandCb callback;
void *context;
- uint16 ident;
+ SilcUInt16 ident;
struct SilcClientCommandPendingStruct *next;
} SilcClientCommandPending;
const char *name,
SilcCommandCb command_function,
SilcCommandCb command_reply_function,
- uint8 max_args,
- uint16 ident);
+ SilcUInt8 max_args,
+ SilcUInt16 ident);
bool silc_client_command_unregister(SilcClient client,
SilcCommand command,
SilcCommandCb command_function,
SilcCommandCb command_reply_function,
- uint16 ident);
+ SilcUInt16 ident);
void silc_client_commands_register(SilcClient client);
void silc_client_commands_unregister(SilcClient client);
void silc_client_command_pending_del(SilcClientConnection conn,
SilcCommand reply_cmd,
- uint16 ident);
+ SilcUInt16 ident);
int silc_client_command_pending_check(SilcClientConnection conn,
SilcClientCommandReplyContext ctx,
SilcCommand command,
- uint16 ident);
+ SilcUInt16 ident);
SILC_CLIENT_CMD_FUNC(whois);
SILC_CLIENT_CMD_FUNC(whowas);
SilcClientID *client_id;
SilcClientEntry client_entry = NULL;
int argc;
- uint32 len;
+ SilcUInt32 len;
unsigned char *id_data, *tmp;
char *nickname = NULL, *username = NULL;
char *realname = NULL;
- uint32 idle = 0, mode = 0;
+ SilcUInt32 idle = 0, mode = 0;
SilcBuffer channels = NULL;
unsigned char *fingerprint;
- uint32 fingerprint_len;
+ SilcUInt32 fingerprint_len;
argc = silc_argument_get_arg_num(cmd->args);
have it cached. */
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
SilcClientEntry client_entry;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd->payload),
2, &tmp_len);
SilcCommandStatus status;
SilcClientID *client_id;
SilcClientEntry client_entry = NULL;
- uint32 len;
+ SilcUInt32 len;
unsigned char *id_data;
char *nickname, *username;
char *realname = NULL;
SilcServerEntry server_entry;
SilcChannelEntry channel_entry;
int argc;
- uint32 len;
+ SilcUInt32 len;
unsigned char *id_data;
char *name = NULL, *info = NULL;
SilcIDPayload idp = NULL;
have it cached. */
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
SilcClientEntry client_entry;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd->payload),
2, &tmp_len);
SilcCommandStatus status;
SilcIDPayload idp;
unsigned char *tmp;
- uint32 argc, len;
+ SilcUInt32 argc, len;
SILC_LOG_DEBUG(("Start"));
SilcClientCommandReplyContext cmd = (SilcClientCommandReplyContext)context;
SilcCommandStatus status;
unsigned char *tmp, *name, *topic;
- uint32 usercount = 0;
+ SilcUInt32 usercount = 0;
COMMAND_CHECK_STATUS_LIST;
SilcChannelID *channel_id = NULL;
unsigned char *tmp;
char *topic;
- uint32 argc, len;
+ SilcUInt32 argc, len;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
SilcChannelEntry channel;
SilcChannelID *channel_id;
unsigned char *tmp;
- uint32 len;
+ SilcUInt32 len;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
SilcServerEntry server;
SilcServerID *server_id = NULL;
char *server_name, *server_info;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Start"));
SilcChannelEntry channel;
SilcChannelUser chu;
SilcChannelID *channel_id;
- uint32 argc, mode = 0, len, list_count;
+ SilcUInt32 argc, mode = 0, len, list_count;
char *topic, *tmp, *channel_name = NULL, *hmac;
SilcBuffer keyp = NULL, client_id_list = NULL, client_mode_list = NULL;
int i;
/* Add clients we received in the reply to the channel */
for (i = 0; i < list_count; i++) {
- uint16 idp_len;
- uint32 mode;
+ SilcUInt16 idp_len;
+ SilcUInt32 mode;
SilcClientID *client_id;
SilcClientEntry client_entry;
SilcClientCommandReplyContext cmd = (SilcClientCommandReplyContext)context;
SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
SilcCommandStatus status;
- uint32 argc, i;
+ SilcUInt32 argc, i;
unsigned char *tmp;
char *motd = NULL, *cp, line[256];
SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
SilcCommandStatus status;
unsigned char *tmp;
- uint32 mode;
+ SilcUInt32 mode;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
SilcCommandStatus status;
unsigned char *tmp;
- uint32 mode;
+ SilcUInt32 mode;
SilcChannelID *channel_id;
SilcChannelEntry channel;
- uint32 len;
+ SilcUInt32 len;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
SilcChannelEntry channel;
SilcChannelUser chu;
unsigned char *modev, *tmp, *id;
- uint32 len, mode;
+ SilcUInt32 len, mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
SilcChannelEntry channel;
SilcChannelID *channel_id;
unsigned char *tmp;
- uint32 len;
+ SilcUInt32 len;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
static void silc_client_command_reply_users_cb(SilcClient client,
SilcClientConnection conn,
SilcChannelEntry *channels,
- uint32 channels_count,
+ SilcUInt32 channels_count,
void *context)
{
if (!channels_count) {
SilcBuffer client_id_list = NULL;
SilcBuffer client_mode_list = NULL;
unsigned char *tmp;
- uint32 tmp_len, list_count;
+ SilcUInt32 tmp_len, list_count;
int i;
unsigned char **res_argv = NULL;
- uint32 *res_argv_lens = NULL, *res_argv_types = NULL, res_argc = 0;
+ SilcUInt32 *res_argv_lens = NULL, *res_argv_types = NULL, res_argc = 0;
SILC_LOG_DEBUG(("Start"));
/* Cache the received Client ID's and modes. */
for (i = 0; i < list_count; i++) {
- uint16 idp_len;
- uint32 mode;
+ SilcUInt16 idp_len;
+ SilcUInt32 mode;
SilcClientID *client_id;
/* Client ID */
SilcServerEntry server_entry;
SilcSKEPKType type;
unsigned char *tmp, *pk;
- uint32 len;
- uint16 pk_len;
+ SilcUInt32 len;
+ SilcUInt16 pk_len;
SilcIdType id_type;
SilcPublicKey public_key = NULL;
have it cached. */
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
SilcClientEntry client_entry;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd->payload),
2, &tmp_len);
have it cached. */
if (status == SILC_STATUS_ERR_NO_SUCH_CLIENT_ID) {
SilcClientEntry client_entry;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
unsigned char *tmp =
silc_argument_get_arg_type(silc_command_get_args(cmd->payload),
2, &tmp_len);
SilcServerEntry server;
SilcServerID *server_id = NULL;
char *server_name, *server_info;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Start"));
/* If defined this executes the pending command. */
SilcCommandCb callback;
void *context;
- uint16 ident;
+ SilcUInt16 ident;
};
/* Macros */
SilcClientConnection conn,
const char *nickname,
const char *format,
- uint32 *clients_count)
+ SilcUInt32 *clients_count)
{
SilcIDCacheEntry id_cache;
SilcIDCacheList list = NULL;
{
GetClientInternal i = (GetClientInternal)context;
SilcClientEntry *clients;
- uint32 clients_count;
+ SilcUInt32 clients_count;
/* Get the clients */
clients = silc_client_get_clients_local(i->client, i->conn,
typedef struct {
SilcClient client;
SilcClientConnection conn;
- uint32 list_count;
+ SilcUInt32 list_count;
SilcBuffer client_id_list;
SilcGetClientCallback completion;
void *context;
SilcIDCacheEntry id_cache = NULL;
SilcBuffer client_id_list = i->client_id_list;
SilcClientEntry *clients = NULL;
- uint32 clients_count = 0;
+ SilcUInt32 clients_count = 0;
bool found = FALSE;
int c;
SILC_LOG_DEBUG(("Start"));
for (c = 0; c < i->list_count; c++) {
- uint16 idp_len;
+ SilcUInt16 idp_len;
SilcClientID *client_id;
/* Get Client ID */
void silc_client_get_clients_by_list(SilcClient client,
SilcClientConnection conn,
- uint32 list_count,
+ SilcUInt32 list_count,
SilcBuffer client_id_list,
SilcGetClientCallback completion,
void *context)
SilcIDCacheEntry id_cache = NULL;
int i;
unsigned char **res_argv = NULL;
- uint32 *res_argv_lens = NULL, *res_argv_types = NULL, res_argc = 0;
+ SilcUInt32 *res_argv_lens = NULL, *res_argv_types = NULL, res_argc = 0;
GetClientsByListInternal in;
SILC_LOG_DEBUG(("Start"));
in->context = context;
for (i = 0; i < list_count; i++) {
- uint16 idp_len;
+ SilcUInt16 idp_len;
SilcClientID *client_id;
SilcClientEntry entry;
SilcClientEntry
silc_client_add_client(SilcClient client, SilcClientConnection conn,
char *nickname, char *username,
- char *userinfo, SilcClientID *id, uint32 mode)
+ char *userinfo, SilcClientID *id, SilcUInt32 mode)
{
SilcClientEntry client_entry;
char *nick = NULL;
const char *nickname,
const char *username,
const char *userinfo,
- uint32 mode)
+ SilcUInt32 mode)
{
char *nick = NULL;
SilcChannelEntry silc_client_add_channel(SilcClient client,
SilcClientConnection conn,
const char *channel_name,
- uint32 mode,
+ SilcUInt32 mode,
SilcChannelID *channel_id)
{
SilcChannelEntry channel;
char *newnick = NULL;
int i, off = 0, len;
SilcClientEntry *clients;
- uint32 clients_count = 0;
+ SilcUInt32 clients_count = 0;
SilcClientEntry unformatted = NULL;
SILC_LOG_DEBUG(("Start"));
char *hostname; /* hostname */
char *server; /* SILC server name */
char *realname; /* Realname (userinfo) */
- uint32 num;
- uint32 mode; /* User mode in SILC */
+ SilcUInt32 num;
+ SilcUInt32 mode; /* User mode in SILC */
SilcClientID *id; /* The Client ID */
unsigned char *fingerprint; /* Fingerprint of client's public key */
- uint32 fingerprint_len; /* Length of the fingerprint */
+ SilcUInt32 fingerprint_len; /* Length of the fingerprint */
bool valid; /* FALSE if this entry is not valid */
SilcCipher send_key; /* Private message key for sending */
SilcCipher receive_key; /* Private message key for receiving */
unsigned char *key; /* Set only if appliation provided the
key material. NULL if the library
generated the key. */
- uint32 key_len;
+ SilcUInt32 key_len;
bool generated; /* TRUE if library generated the key */
SilcClientKeyAgreement ke; /* Current key agreement context or NULL */
SilcClientStatus status; /* Status mask */
/* Client and its mode on a channel */
struct SilcChannelUserStruct {
SilcClientEntry client;
- uint32 mode;
+ SilcUInt32 mode;
SilcChannelEntry channel;
};
SilcCipher cipher; /* The cipher and key */
SilcHmac hmac; /* The HMAC and hmac key */
unsigned char *key; /* The key data */
- uint32 key_len; /* The key length */
+ SilcUInt32 key_len; /* The key length */
};
/* Channel entry context. This is allocate for every channel client has
struct SilcChannelEntryStruct {
char *channel_name;
SilcChannelID *id;
- uint32 mode;
+ SilcUInt32 mode;
/* All clients that has joined this channel */
SilcHashTable user_list;
/* Channel keys */
SilcCipher channel_key; /* The channel key */
unsigned char *key; /* Raw key data */
- uint32 key_len;
+ SilcUInt32 key_len;
unsigned char iv[SILC_CIPHER_MAX_IV_SIZE]; /* Current IV */
SilcHmac hmac; /* Current HMAC */
SilcDList private_keys; /* List of private keys or NULL */
SilcClientEntry
silc_client_add_client(SilcClient client, SilcClientConnection conn,
char *nickname, char *username,
- char *userinfo, SilcClientID *id, uint32 mode);
+ char *userinfo, SilcClientID *id, SilcUInt32 mode);
void silc_client_update_client(SilcClient client,
SilcClientConnection conn,
SilcClientEntry client_entry,
const char *nickname,
const char *username,
const char *userinfo,
- uint32 mode);
+ SilcUInt32 mode);
void silc_client_del_client_entry(SilcClient client,
SilcClientConnection conn,
SilcClientEntry client_entry);
SilcChannelEntry silc_client_add_channel(SilcClient client,
SilcClientConnection conn,
const char *channel_name,
- uint32 mode,
+ SilcUInt32 mode,
SilcChannelID *channel_id);
bool silc_client_replace_channel_id(SilcClient client,
SilcClientConnection conn,
void silc_client_protocol_ke_verify_key(SilcSKE ske,
unsigned char *pk_data,
- uint32 pk_len,
+ SilcUInt32 pk_len,
SilcSKEPKType pk_type,
void *context,
SilcSKEVerifyCbCompletion completion,
/* Checks the version string of the server. */
SilcSKEStatus silc_ske_check_version(SilcSKE ske, unsigned char *version,
- uint32 len, void *context)
+ SilcUInt32 len, void *context)
{
SilcClientConnection conn = (SilcClientConnection)ske->sock->user_data;
SilcClient client = (SilcClient)ske->user_data;
silc_client_get_public_key_auth(SilcClient client,
SilcClientConnection conn,
unsigned char *auth_data,
- uint32 *auth_data_len,
+ SilcUInt32 *auth_data_len,
SilcSKE ske)
{
int len;
static void
silc_client_conn_auth_continue(unsigned char *auth_data,
- uint32 auth_data_len, void *context)
+ SilcUInt32 auth_data_len, void *context)
{
SilcProtocol protocol = (SilcProtocol)context;
SilcClientConnAuthInternalContext *ctx =
* to be authenticated.
*/
unsigned char *auth_data = NULL;
- uint32 auth_data_len = 0;
+ SilcUInt32 auth_data_len = 0;
unsigned char sign[1024];
switch(ctx->auth_meth) {
{
SilcClientConnection conn = (SilcClientConnection)ctx->sock->user_data;
SilcSKEKeyMaterial *keymat;
- uint32 key_len = silc_cipher_get_key_len(conn->send_key);
- uint32 hash_len = conn->hash->hash->hash_len;
+ SilcUInt32 key_len = silc_cipher_get_key_len(conn->send_key);
+ SilcUInt32 hash_len = conn->hash->hash->hash_len;
SILC_LOG_DEBUG(("Generating new %s session keys (no PFS)",
send ? "sending" : "receiving"));
{
SilcClientConnection conn = (SilcClientConnection)ctx->sock->user_data;
SilcSKEKeyMaterial *keymat;
- uint32 key_len = silc_cipher_get_key_len(conn->send_key);
- uint32 hash_len = conn->hash->hash->hash_len;
+ SilcUInt32 key_len = silc_cipher_get_key_len(conn->send_key);
+ SilcUInt32 hash_len = conn->hash->hash->hash_len;
unsigned char *tmpbuf;
- uint32 klen;
+ SilcUInt32 klen;
SILC_LOG_DEBUG(("Generating new %s session keys (with PFS)",
send ? "sending" : "receiving"));
starting the protocol if we know the authentication data. Otherwise
these are and remain NULL. */
unsigned char *auth_data;
- uint32 auth_data_len;
+ SilcUInt32 auth_data_len;
SilcTask timeout_task;
} SilcClientConnAuthInternalContext;
void *context);
void silc_client_protocol_ke_verify_key(SilcSKE ske,
unsigned char *pk_data,
- uint32 pk_len,
+ SilcUInt32 pk_len,
SilcSKEPKType pk_type,
void *context,
SilcSKEVerifyCbCompletion completion,
provided it. This is NULL if the
library generated the key or if
the SKE key material was used. */
- uint32 key_len; /* The key length */
+ SilcUInt32 key_len; /* The key length */
} *SilcPrivateMessageKeys;
/***/
* SYNOPSIS
*
* typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
- * uint32 passphrase_len,
+ * SilcUInt32 passphrase_len,
* void *context);
*
* DESCRIPTION
*
***/
typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
- uint32 passphrase_len,
+ SilcUInt32 passphrase_len,
void *context);
/****f* silcclient/SilcClientAPI/SilcVerifyPublicKey
* typedef void (*SilcGetAuthMeth)(bool success,
* SilcProtocolAuthMeth auth_meth,
* const unsigned char *auth_data,
- * uint32 auth_data_len, void *context);
+ * SilcUInt32 auth_data_len, void *context);
*
* DESCRIPTION
*
typedef void (*SilcGetAuthMeth)(bool success,
SilcProtocolAuthMeth auth_meth,
const unsigned char *auth_data,
- uint32 auth_data_len, void *context);
+ SilcUInt32 auth_data_len, void *context);
/****d* silcclient/SilcClientAPI/SilcClientMessageType
*
authentication method and authentication data is called. The `conn'
may be NULL. */
void (*get_auth_method)(SilcClient client, SilcClientConnection conn,
- char *hostname, uint16 port,
+ char *hostname, SilcUInt16 port,
SilcGetAuthMeth completion, void *context);
/* Verifies received public key. The `conn_type' indicates which entity
`completion' must be called after the public key has been verified. */
void (*verify_public_key)(SilcClient client, SilcClientConnection conn,
SilcSocketType conn_type, unsigned char *pk,
- uint32 pk_len, SilcSKEPKType pk_type,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
SilcVerifyPublicKey completion, void *context);
/* Ask (interact, that is) a passphrase from user. The passphrase is
`completion' and `context' arguments must be set by the application. */
int (*key_agreement)(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry, const char *hostname,
- uint16 port, SilcKeyAgreementCallback *completion,
+ SilcUInt16 port, SilcKeyAgreementCallback *completion,
void **context);
/* Notifies application that file transfer protocol session is being
transfer request, by calling the silc_client_file_receive or
silc_client_file_close, respectively. */
void (*ftp)(SilcClient client, SilcClientConnection conn,
- SilcClientEntry client_entry, uint32 session_id,
- const char *hostname, uint16 port);
+ SilcClientEntry client_entry, SilcUInt32 session_id,
+ const char *hostname, SilcUInt16 port);
} SilcClientOperations;
/***/
* SilcChannelPrivateKey key,
* SilcMessageFlags flags,
* unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* int force_send);
*
* DESCRIPTION
SilcChannelPrivateKey key,
SilcMessageFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send);
/****f* silcclient/SilcClientAPI/silc_client_send_private_message
* SilcClientEntry client_entry,
* SilcMessageFlags flags,
* unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* int force_send);
*
* DESCRIPTION
SilcClientEntry client_entry,
SilcMessageFlags flags,
unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
int force_send);
* typedef void (*SilcGetClientCallback)(SilcClient client,
* SilcClientConnection conn,
* SilcClientEntry *clients,
- * uint32 clients_count,
+ * SilcUInt32 clients_count,
* void *context);
*
* DESCRIPTION
typedef void (*SilcGetClientCallback)(SilcClient client,
SilcClientConnection conn,
SilcClientEntry *clients,
- uint32 clients_count,
+ SilcUInt32 clients_count,
void *context);
/****f* silcclient/SilcClientAPI/silc_client_get_clients
* SilcClientConnection conn,
* const char *nickname,
* const char *format,
- * uint32 *clients_count);
+ * SilcUInt32 *clients_count);
*
* DESCRIPTION
*
SilcClientConnection conn,
const char *nickname,
const char *format,
- uint32 *clients_count);
+ SilcUInt32 *clients_count);
/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_list
*
*
* void silc_client_get_clients_by_list(SilcClient client,
* SilcClientConnection conn,
- * uint32 list_count,
+ * SilcUInt32 list_count,
* SilcBuffer client_id_list,
* SilcGetClientCallback completion,
* void *context);
***/
void silc_client_get_clients_by_list(SilcClient client,
SilcClientConnection conn,
- uint32 list_count,
+ SilcUInt32 list_count,
SilcBuffer client_id_list,
SilcGetClientCallback completion,
void *context);
* typedef void (*SilcGetChannelCallback)(SilcClient client,
* SilcClientConnection conn,
* SilcChannelEntry *channels,
- * uint32 channels_count,
+ * SilcUInt32 channels_count,
* void *context);
*
* DESCRIPTION
typedef void (*SilcGetChannelCallback)(SilcClient client,
SilcClientConnection conn,
SilcChannelEntry *channels,
- uint32 channels_count,
+ SilcUInt32 channels_count,
void *context);
/****f* silcclient/SilcClientAPI/silc_client_get_channel
*
* void silc_client_command_send(SilcClient client,
* SilcClientConnection conn,
- * SilcCommand command, uint16 ident,
- * uint32 argc, ...);
+ * SilcCommand command, SilcUInt16 ident,
+ * SilcUInt32 argc, ...);
*
* DESCRIPTION
*
*
***/
void silc_client_command_send(SilcClient client, SilcClientConnection conn,
- SilcCommand command, uint16 ident,
- uint32 argc, ...);
+ SilcCommand command, SilcUInt16 ident,
+ SilcUInt32 argc, ...);
/****f* silcclient/SilcClientAPI/silc_client_command_pending
*
*
* void silc_client_command_pending(SilcClientConnection conn,
* SilcCommand reply_cmd,
- * uint16 ident,
+ * SilcUInt16 ident,
* SilcCommandCb callback,
* void *context);
*
***/
void silc_client_command_pending(SilcClientConnection conn,
SilcCommand reply_cmd,
- uint16 ident,
+ SilcUInt16 ident,
SilcCommandCb callback,
void *context);
* SilcClientEntry client_entry,
* char *cipher,
* unsigned char *key,
- * uint32 key_len,
+ * SilcUInt32 key_len,
* bool generate_key,
* bool responder);
*
SilcClientEntry client_entry,
char *cipher,
unsigned char *key,
- uint32 key_len,
+ SilcUInt32 key_len,
bool generate_key,
bool responder);
* SilcPrivateMessageKeys
* silc_client_list_private_message_keys(SilcClient client,
* SilcClientConnection conn,
- * uint32 *key_count);
+ * SilcUInt32 *key_count);
*
* DESCRIPTION
*
SilcPrivateMessageKeys
silc_client_list_private_message_keys(SilcClient client,
SilcClientConnection conn,
- uint32 *key_count);
+ SilcUInt32 *key_count);
/****f* silcclient/SilcClientAPI/silc_client_free_private_message_keys
*
* SYNOPSIS
*
* void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
- * uint32 key_count);
+ * SilcUInt32 key_count);
*
* DESCRIPTION
*
*
***/
void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
- uint32 key_count);
+ SilcUInt32 key_count);
/* Channel private key management (client_channel.c,
* char *cipher,
* char *hmac,
* unsigned char *key,
- * uint32 key_len);
+ * SilcUInt32 key_len);
*
* DESCRIPTION
*
char *cipher,
char *hmac,
unsigned char *key,
- uint32 key_len);
+ SilcUInt32 key_len);
/****f* silcclient/SilcClientAPI/silc_client_del_channel_private_keys
*
* silc_client_list_channel_private_keys(SilcClient client,
* SilcClientConnection conn,
* SilcChannelEntry channel,
- * uint32 *key_count);
+ * SilcUInt32 *key_count);
*
* DESCRIPTION
*
silc_client_list_channel_private_keys(SilcClient client,
SilcClientConnection conn,
SilcChannelEntry channel,
- uint32 *key_count);
+ SilcUInt32 *key_count);
/****f* silcclient/SilcClientAPI/silc_client_free_channel_private_keys
*
* SYNOPSIS
*
* void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
- * uint32 key_count);
+ * SilcUInt32 key_count);
*
* DESCRIPTION
*
*
***/
void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
- uint32 key_count);
+ SilcUInt32 key_count);
/* Key Agreement routines (client_keyagr.c) */
* SilcClientEntry client_entry,
* char *hostname,
* int port,
- * uint32 timeout_secs,
+ * SilcUInt32 timeout_secs,
* SilcKeyAgreementCallback completion,
* void *context);
*
const char *hostname,
const char *bindhost,
int port,
- uint32 timeout_secs,
+ SilcUInt32 timeout_secs,
SilcKeyAgreementCallback completion,
void *context);
* SilcClientConnection conn,
* SilcClientMonitorStatus status,
* SilcClientFileError error,
- * uint64 offset,
- * uint64 filesize,
+ * SilcUInt64 offset,
+ * SilcUInt64 filesize,
* SilcClientEntry client_entry,
- * uint32 session_id,
+ * SilcUInt32 session_id,
* const char *filepath,
* void *context);
*
SilcClientConnection conn,
SilcClientMonitorStatus status,
SilcClientFileError error,
- uint64 offset,
- uint64 filesize,
+ SilcUInt64 offset,
+ SilcUInt64 filesize,
SilcClientEntry client_entry,
- uint32 session_id,
+ SilcUInt32 session_id,
const char *filepath,
void *context);
* SilcClientFileMonitor monitor,
* void *monitor_context,
* const char *local_ip,
- * uint32 local_port,
+ * SilcUInt32 local_port,
* SilcClientEntry client_entry,
* const char *filepath);
- * uint32 *session_id);
+ * SilcUInt32 *session_id);
*
* DESCRIPTION
*
SilcClientFileMonitor monitor,
void *monitor_context,
const char *local_ip,
- uint32 local_port,
+ SilcUInt32 local_port,
SilcClientEntry client_entry,
const char *filepath,
- uint32 *session_id);
+ SilcUInt32 *session_id);
/****f* silcclient/SilcClientAPI/silc_client_file_receive
*
* SilcClientConnection conn,
* SilcClientFileMonitor monitor,
* void *monitor_context,
- * uint32 session_id);
+ * SilcUInt32 session_id);
*
* DESCRIPTION
*
SilcClientConnection conn,
SilcClientFileMonitor monitor,
void *monitor_context,
- uint32 session_id);
+ SilcUInt32 session_id);
/****f* silcclient/SilcClientAPI/silc_client_file_close
*
*
* SilcClientFileError silc_client_file_close(SilcClient client,
* SilcClientConnection conn,
- * uint32 session_id);
+ * SilcUInt32 session_id);
*
* DESCRIPTION
*
***/
SilcClientFileError silc_client_file_close(SilcClient client,
SilcClientConnection conn,
- uint32 session_id);
+ SilcUInt32 session_id);
#include "client.h"
#include "command.h"
******************************************************************************/
struct SilcArgumentPayloadStruct {
- uint32 argc;
+ SilcUInt32 argc;
unsigned char **argv;
- uint32 *argv_lens;
- uint32 *argv_types;
- uint32 pos;
+ SilcUInt32 *argv_lens;
+ SilcUInt32 *argv_types;
+ SilcUInt32 pos;
};
/* Parses arguments and returns them into Argument Payload structure. */
SilcArgumentPayload silc_argument_payload_parse(const unsigned char *payload,
- uint32 payload_len,
- uint32 argc)
+ SilcUInt32 payload_len,
+ SilcUInt32 argc)
{
SilcBufferStruct buffer;
SilcArgumentPayload new;
- uint16 p_len = 0;
+ SilcUInt16 p_len = 0;
unsigned char arg_num = 0;
unsigned char arg_type = 0;
- uint32 pull_len = 0;
+ SilcUInt32 pull_len = 0;
int i = 0, ret;
SILC_LOG_DEBUG(("Parsing argument payload"));
silc_buffer_set(&buffer, (unsigned char *)payload, payload_len);
new = silc_calloc(1, sizeof(*new));
new->argv = silc_calloc(argc, sizeof(unsigned char *));
- new->argv_lens = silc_calloc(argc, sizeof(uint32));
- new->argv_types = silc_calloc(argc, sizeof(uint32));
+ new->argv_lens = silc_calloc(argc, sizeof(SilcUInt32));
+ new->argv_types = silc_calloc(argc, sizeof(SilcUInt32));
/* Get arguments */
arg_num = 1;
/* Encodes arguments in to Argument Paylods returning them to SilcBuffer. */
-SilcBuffer silc_argument_payload_encode(uint32 argc,
+SilcBuffer silc_argument_payload_encode(SilcUInt32 argc,
unsigned char **argv,
- uint32 *argv_lens,
- uint32 *argv_types)
+ SilcUInt32 *argv_lens,
+ SilcUInt32 *argv_types)
{
SilcBuffer buffer;
- uint32 len;
+ SilcUInt32 len;
int i;
SILC_LOG_DEBUG(("Encoding Argument payload"));
SilcBuffer silc_argument_payload_encode_payload(SilcArgumentPayload payload)
{
SilcBuffer buffer;
- uint32 len;
+ SilcUInt32 len;
int i;
SILC_LOG_DEBUG(("Encoding Argument payload"));
/* Returns number of arguments in payload */
-uint32 silc_argument_get_arg_num(SilcArgumentPayload payload)
+SilcUInt32 silc_argument_get_arg_num(SilcArgumentPayload payload)
{
return payload ? payload->argc : 0;
}
/* Returns first argument from payload. */
unsigned char *silc_argument_get_first_arg(SilcArgumentPayload payload,
- uint32 *ret_len)
+ SilcUInt32 *ret_len)
{
if (!payload)
return NULL;
/* Returns next argument from payload or NULL if no more arguments. */
unsigned char *silc_argument_get_next_arg(SilcArgumentPayload payload,
- uint32 *ret_len)
+ SilcUInt32 *ret_len)
{
if (!payload)
return NULL;
/* Returns argument which type is `type'. */
unsigned char *silc_argument_get_arg_type(SilcArgumentPayload payload,
- uint32 type,
- uint32 *ret_len)
+ SilcUInt32 type,
+ SilcUInt32 *ret_len)
{
int i;
*
* SilcArgumentPayload
* silc_argument_payload_parse(const unsigned char *payload,
- * uint32 payload_len,
- * uint32 argc);
+ * SilcUInt32 payload_len,
+ * SilcUInt32 argc);
*
* DESCRIPTION
*
*
***/
SilcArgumentPayload silc_argument_payload_parse(const unsigned char *payload,
- uint32 payload_len,
- uint32 argc);
+ SilcUInt32 payload_len,
+ SilcUInt32 argc);
/****f* silccore/SilcArgumentAPI/silc_argument_payload_encode
*
* SYNOPSIS
*
- * SilcBuffer silc_argument_payload_encode(uint32 argc,
+ * SilcBuffer silc_argument_payload_encode(SilcUInt32 argc,
* unsigned char **argv,
- * uint32 *argv_lens,
- * uint32 *argv_types);
+ * SilcUInt32 *argv_lens,
+ * SilcUInt32 *argv_types);
*
* DESCRIPTION
*
* number of arguments.
*
***/
-SilcBuffer silc_argument_payload_encode(uint32 argc,
+SilcBuffer silc_argument_payload_encode(SilcUInt32 argc,
unsigned char **argv,
- uint32 *argv_lens,
- uint32 *argv_types);
+ SilcUInt32 *argv_lens,
+ SilcUInt32 *argv_types);
/****f* silccore/SilcArgumentAPI/silc_argument_payload_encode_payload
*
*
* SYNOPSIS
*
- * uint32 silc_argument_get_arg_num(SilcArgumentPayload payload);
+ * SilcUInt32 silc_argument_get_arg_num(SilcArgumentPayload payload);
*
* DESCRIPTION
*
* Returns the number of argument in the Argument Payload.
*
***/
-uint32 silc_argument_get_arg_num(SilcArgumentPayload payload);
+SilcUInt32 silc_argument_get_arg_num(SilcArgumentPayload payload);
/****f* silccore/SilcArgumentAPI/silc_argument_get_first_arg
*
* SYNOPSIS
*
* unsigned char *silc_argument_get_first_arg(SilcArgumentPayload payload,
- * uint32 *ret_len);
+ * SilcUInt32 *ret_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_argument_get_first_arg(SilcArgumentPayload payload,
- uint32 *ret_len);
+ SilcUInt32 *ret_len);
/****f* silccore/SilcArgumentAPI/silc_argument_get_next_arg
*
* SYNOPSIS
*
* unsigned char *silc_argument_get_next_arg(SilcArgumentPayload payload,
- * uint32 *ret_len);
+ * SilcUInt32 *ret_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_argument_get_next_arg(SilcArgumentPayload payload,
- uint32 *ret_len);
+ SilcUInt32 *ret_len);
/****f* silccore/SilcArgumentAPI/silc_argument_get_arg_type
*
* SYNOPSIS
*
* unsigned char *silc_argument_get_arg_type(SilcArgumentPayload payload,
- * uint32 type,
- * uint32 *ret_len);
+ * SilcUInt32 type,
+ * SilcUInt32 *ret_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_argument_get_arg_type(SilcArgumentPayload payload,
- uint32 type,
- uint32 *ret_len);
+ SilcUInt32 type,
+ SilcUInt32 *ret_len);
#endif
/* Authentication Payload structure */
struct SilcAuthPayloadStruct {
- uint16 len;
- uint16 auth_method;
- uint16 random_len;
+ SilcUInt16 len;
+ SilcUInt16 auth_method;
+ SilcUInt16 random_len;
unsigned char *random_data;
- uint16 auth_len;
+ SilcUInt16 auth_len;
unsigned char *auth_data;
};
/* Parses and returns Authentication Payload */
SilcAuthPayload silc_auth_payload_parse(const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcBufferStruct buffer;
SilcAuthPayload new;
SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
const unsigned char *random_data,
- uint16 random_len,
+ SilcUInt16 random_len,
const unsigned char *auth_data,
- uint16 auth_len)
+ SilcUInt16 auth_len)
{
SilcBuffer buffer;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Encoding Authentication Payload"));
/* Get the authentication data */
unsigned char *silc_auth_get_data(SilcAuthPayload payload,
- uint32 *auth_len)
+ SilcUInt32 *auth_len)
{
if (auth_len)
*auth_len = payload->auth_len;
static unsigned char *
silc_auth_public_key_encode_data(SilcPublicKey public_key,
const unsigned char *random,
- uint32 random_len, const void *id,
- SilcIdType type, uint32 *ret_len)
+ SilcUInt32 random_len, const void *id,
+ SilcIdType type, SilcUInt32 *ret_len)
{
SilcBuffer buf;
unsigned char *pk, *id_data, *ret;
- uint32 pk_len, id_len;
+ SilcUInt32 pk_len, id_len;
pk = silc_pkcs_public_key_encode(public_key, &pk_len);
if (!pk)
{
unsigned char *random;
unsigned char auth_data[1024];
- uint32 auth_len;
+ SilcUInt32 auth_len;
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcBuffer buf;
SilcPKCS pkcs;
const void *id, SilcIdType type)
{
unsigned char *tmp;
- uint32 tmp_len;
+ SilcUInt32 tmp_len;
SilcPKCS pkcs;
SILC_LOG_DEBUG(("Verifying authentication data"));
/* Same as above but the payload is not parsed yet. This will parse it. */
bool silc_auth_public_key_auth_verify_data(const unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcPublicKey public_key,
SilcHash hash,
const void *id, SilcIdType type)
`auth_data_len' is ignored. */
bool silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
- const void *auth_data, uint32 auth_data_len,
+ const void *auth_data, SilcUInt32 auth_data_len,
SilcHash hash, const void *id, SilcIdType type)
{
SILC_LOG_DEBUG(("Verifying authentication"));
/* Same as above but parses the authentication payload before verify. */
-bool silc_auth_verify_data(const unsigned char *payload, uint32 payload_len,
+bool silc_auth_verify_data(const unsigned char *payload, SilcUInt32 payload_len,
SilcAuthMethod auth_method, const void *auth_data,
- uint32 auth_data_len, SilcHash hash,
+ SilcUInt32 auth_data_len, SilcHash hash,
const void *id, SilcIdType type)
{
SilcAuthPayload auth_payload;
/* The Key Agreement protocol structure */
struct SilcKeyAgreementPayloadStruct {
- uint16 hostname_len;
+ SilcUInt16 hostname_len;
unsigned char *hostname;
- uint32 port;
+ SilcUInt32 port;
};
/* Parses and returns an allocated Key Agreement payload. */
SilcKeyAgreementPayload
silc_key_agreement_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcKeyAgreementPayload new;
/* Encodes the Key Agreement protocol and returns the encoded buffer */
SilcBuffer silc_key_agreement_payload_encode(const char *hostname,
- uint32 port)
+ SilcUInt32 port)
{
SilcBuffer buffer;
- uint32 len = hostname ? strlen(hostname) : 0;
+ SilcUInt32 len = hostname ? strlen(hostname) : 0;
SILC_LOG_DEBUG(("Encoding Key Agreement Payload"));
/* Returns the port in the payload */
-uint32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload)
+SilcUInt32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload)
{
return payload->port;
}
*
* NAME
*
- * typedef uint16 SilcAuthMethod;
+ * typedef SilcUInt16 SilcAuthMethod;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint16 SilcAuthMethod;
+typedef SilcUInt16 SilcAuthMethod;
#define SILC_AUTH_NONE 0 /* No authentication */
#define SILC_AUTH_PASSWORD 1 /* Passphrase authentication */
* SYNOPSIS
*
* SilcAuthPayload silc_auth_payload_parse(const unsigned char *data,
- * uint32 data_len);
+ * SilcUInt32 data_len);
*
* DESCRIPTION
*
*
***/
SilcAuthPayload silc_auth_payload_parse(const unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
/****f* silccore/SilcAuthAPI/silc_auth_payload_encode
*
*
* SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
* const unsigned char *random_data,
- * uint16 random_len,
+ * SilcUInt16 random_len,
* const unsigned char *auth_data,
- * uint16 auth_len);
+ * SilcUInt16 auth_len);
*
* DESCRIPTION
*
***/
SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
const unsigned char *random_data,
- uint16 random_len,
+ SilcUInt16 random_len,
const unsigned char *auth_data,
- uint16 auth_len);
+ SilcUInt16 auth_len);
/****f* silccore/SilcAuthAPI/silc_auth_payload_free
*
* SYNOPSIS
*
* unsigned char *silc_auth_get_data(SilcAuthPayload payload,
- * uint32 *auth_len);
+ * SilcUInt32 *auth_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_auth_get_data(SilcAuthPayload payload,
- uint32 *auth_len);
+ SilcUInt32 *auth_len);
/****f* silccore/SilcAuthAPI/silc_auth_public_key_auth_generate
*
* SYNOPSIS
*
* bool silc_auth_public_key_auth_verify_data(const unsigned char *payload,
- * uint32 payload_len,
+ * SilcUInt32 payload_len,
* SilcPublicKey public_key,
* SilcHash hash,
* const void *id,
*
***/
bool silc_auth_public_key_auth_verify_data(const unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcPublicKey public_key,
SilcHash hash,
const void *id, SilcIdType type);
*
* bool silc_auth_verify(SilcAuthPayload payload,
* SilcAuthMethod auth_method,
- * const void *auth_data, uint32 auth_data_len,
+ * const void *auth_data, SilcUInt32 auth_data_len,
* SilcHash hash, const void *id, SilcIdType type);
*
* DESCRIPTION
*
***/
bool silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
- const void *auth_data, uint32 auth_data_len,
+ const void *auth_data, SilcUInt32 auth_data_len,
SilcHash hash, const void *id, SilcIdType type);
/****f* silccore/SilcAuthAPI/silc_auth_verify_data
* SYNOPSIS
*
* bool silc_auth_verify_data(const unsigned char *payload,
- * uint32 payload_len,
+ * SilcUInt32 payload_len,
* SilcAuthMethod auth_method,
* const void *auth_data,
- * uint32 auth_data_len, SilcHash hash,
+ * SilcUInt32 auth_data_len, SilcHash hash,
* const void *id, SilcIdType type);
*
* DESCRIPTION
* `auth_data_len' is ignored.
*
***/
-bool silc_auth_verify_data(const unsigned char *payload, uint32 payload_len,
+bool silc_auth_verify_data(const unsigned char *payload, SilcUInt32 payload_len,
SilcAuthMethod auth_method, const void *auth_data,
- uint32 auth_data_len, SilcHash hash,
+ SilcUInt32 auth_data_len, SilcHash hash,
const void *id, SilcIdType type);
/****f* silccore/SilcAuthAPI/silc_key_agreement_payload_parse
*
* SilcKeyAgreementPayload
* silc_key_agreement_payload_parse(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
***/
SilcKeyAgreementPayload
silc_key_agreement_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcAuthAPI/silc_key_agreement_payload_encode
*
* SYNOPSIS
*
* SilcBuffer silc_key_agreement_payload_encode(char *hostname,
- * uint32 port);
+ * SilcUInt32 port);
*
* DESCRIPTION
*
*
***/
SilcBuffer silc_key_agreement_payload_encode(const char *hostname,
- uint32 port);
+ SilcUInt32 port);
/****f* silccore/SilcAuthAPI/silc_key_agreement_payload_free
*
*
* SYNOPSIS
*
- * uint32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
+ * SilcUInt32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
*
* DESCRIPTION
*
* the SILC Key Exchange protocol.
*
***/
-uint32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
+SilcUInt32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
#endif
/* Channel Message Payload structure. Contents of this structure is parsed
from SILC packets. */
struct SilcChannelPayloadStruct {
- uint16 name_len;
+ SilcUInt16 name_len;
unsigned char *channel_name;
- uint16 id_len;
+ SilcUInt16 id_len;
unsigned char *channel_id;
- uint32 mode;
+ SilcUInt32 mode;
};
/* Parses channel payload returning new channel payload structure. */
SilcChannelPayload silc_channel_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcChannelPayload new;
/* Parses list of channel payloads returning list of payloads. */
SilcDList silc_channel_payload_parse_list(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcDList list;
/* Encode new channel payload and returns it as buffer. */
SilcBuffer silc_channel_payload_encode(const unsigned char *channel_name,
- uint16 channel_name_len,
+ SilcUInt16 channel_name_len,
const unsigned char *channel_id,
- uint32 channel_id_len,
- uint32 mode)
+ SilcUInt32 channel_id_len,
+ SilcUInt32 mode)
{
SilcBuffer buffer;
/* Return the channel name */
unsigned char *silc_channel_get_name(SilcChannelPayload payload,
- uint32 *channel_name_len)
+ SilcUInt32 *channel_name_len)
{
if (channel_name_len)
*channel_name_len = payload->name_len;
/* Return the channel ID */
unsigned char *silc_channel_get_id(SilcChannelPayload payload,
- uint32 *channel_id_len)
+ SilcUInt32 *channel_id_len)
{
if (channel_id_len)
*channel_id_len = payload->id_len;
channel or perhaps the mode of the client on the channel. The protocol
dictates what the usage of the mode is in different circumstances. */
-uint32 silc_channel_get_mode(SilcChannelPayload payload)
+SilcUInt32 silc_channel_get_mode(SilcChannelPayload payload)
{
return payload->mode;
}
from SILC packets. */
struct SilcChannelMessagePayloadStruct {
SilcMessageFlags flags;
- uint16 data_len;
+ SilcUInt16 data_len;
unsigned char *data;
unsigned char *mac;
unsigned char *iv;
SilcCipher cipher,
SilcHmac hmac)
{
- uint32 iv_len, mac_len;
+ SilcUInt32 iv_len, mac_len;
unsigned char *end, *mac, mac2[32];
unsigned char *dst, iv[SILC_CIPHER_MAX_IV_SIZE];
SilcChannelMessagePayload
silc_channel_message_payload_parse(unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcCipher cipher,
SilcHmac hmac)
{
SilcBufferStruct buffer;
SilcChannelMessagePayload new;
int ret;
- uint32 iv_len, mac_len;
+ SilcUInt32 iv_len, mac_len;
SILC_LOG_DEBUG(("Parsing channel message payload"));
encrypted separately from other parts of the packet padding must
be applied to the payload. */
-SilcBuffer silc_channel_message_payload_encode(uint16 flags,
- uint16 data_len,
+SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
const unsigned char *data,
- uint16 iv_len,
+ SilcUInt16 iv_len,
unsigned char *iv,
SilcCipher cipher,
SilcHmac hmac)
{
int i;
SilcBuffer buffer;
- uint32 len, pad_len, mac_len;
+ SilcUInt32 len, pad_len, mac_len;
unsigned char pad[16];
unsigned char mac[32];
/* Return data */
unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
- uint32 *data_len)
+ SilcUInt32 *data_len)
{
if (data_len)
*data_len = payload->data_len;
/* Channel Key Payload structrue. Channel keys are parsed from SILC
packets into this structure. */
struct SilcChannelKeyPayloadStruct {
- uint16 id_len;
+ SilcUInt16 id_len;
unsigned char *id;
- uint16 cipher_len;
+ SilcUInt16 cipher_len;
unsigned char *cipher;
- uint16 key_len;
+ SilcUInt16 key_len;
unsigned char *key;
};
SilcChannelKeyPayload
silc_channel_key_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcChannelKeyPayload new;
/* Encodes channel key payload into a buffer and returns it. This is used
to add channel key payload into a packet. */
-SilcBuffer silc_channel_key_payload_encode(uint16 id_len,
+SilcBuffer silc_channel_key_payload_encode(SilcUInt16 id_len,
const unsigned char *id,
- uint16 cipher_len,
+ SilcUInt16 cipher_len,
const unsigned char *cipher,
- uint16 key_len,
+ SilcUInt16 key_len,
const unsigned char *key)
{
SilcBuffer buffer;
- uint32 len;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Encoding channel key payload"));
/* Return ID */
unsigned char *silc_channel_key_get_id(SilcChannelKeyPayload payload,
- uint32 *id_len)
+ SilcUInt32 *id_len)
{
if (id_len)
*id_len = payload->id_len;
/* Return cipher name */
unsigned char *silc_channel_key_get_cipher(SilcChannelKeyPayload payload,
- uint32 *cipher_len)
+ SilcUInt32 *cipher_len)
{
if (cipher_len)
*cipher_len = payload->cipher_len;
/* Return key */
unsigned char *silc_channel_key_get_key(SilcChannelKeyPayload payload,
- uint32 *key_len)
+ SilcUInt32 *key_len)
{
if (key_len)
*key_len = payload->key_len;
*
* NAME
*
- * typedef uint16 SilcMessageFlags;
+ * typedef SilcUInt16 SilcMessageFlags;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint16 SilcMessageFlags;
+typedef SilcUInt16 SilcMessageFlags;
/* The message flags (shared by both channel and private messages) */
#define SILC_MESSAGE_FLAG_NONE 0x0000
*
* SilcChannelPayload
* silc_channel_payload_parse(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
*
***/
SilcChannelPayload silc_channel_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcChannelAPI/silc_channel_payload_parse_list
*
*
* SilcDList
* silc_channel_payload_parse_list(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
*
***/
SilcDList silc_channel_payload_parse_list(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcChannelAPI/silc_channel_payload_encode
*
* SYNOPSIS
*
* SilcBuffer silc_channel_payload_encode(const unsigned char *channel_name,
- * uint16 channel_name_len,
+ * SilcUInt16 channel_name_len,
* const unsigned char *channel_id,
- * uint32 channel_id_len,
- * uint32 mode);
+ * SilcUInt32 channel_id_len,
+ * SilcUInt32 mode);
*
* DESCRIPTION
*
*
***/
SilcBuffer silc_channel_payload_encode(const unsigned char *channel_name,
- uint16 channel_name_len,
+ SilcUInt16 channel_name_len,
const unsigned char *channel_id,
- uint32 channel_id_len,
- uint32 mode);
+ SilcUInt32 channel_id_len,
+ SilcUInt32 mode);
/****f* silccore/SilcChannelAPI/silc_channel_payload_free
*
* SYNOPSIS
*
* unsigned char *silc_channel_get_name(SilcChannelPayload payload,
- * uint32 *channel_name_len);
+ * SilcUInt32 *channel_name_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_get_name(SilcChannelPayload payload,
- uint32 *channel_name_len);
+ SilcUInt32 *channel_name_len);
/****f* silccore/SilcChannelAPI/silc_channel_get_id
*
* SYNOPSIS
*
* unsigned char *silc_channel_get_id(SilcChannelPayload payload,
- * uint32 *channel_id_len);
+ * SilcUInt32 *channel_id_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_get_id(SilcChannelPayload payload,
- uint32 *channel_id_len);
+ SilcUInt32 *channel_id_len);
/****f* silccore/SilcChannelAPI/silc_channel_get_id_parse
*
*
* SYNOPSIS
*
- * uint32 silc_channel_get_mode(SilcChannelPayload payload);
+ * SilcUInt32 silc_channel_get_mode(SilcChannelPayload payload);
*
* DESCRIPTION
*
* dictates what the usage of the mode is in different circumstances.
*
***/
-uint32 silc_channel_get_mode(SilcChannelPayload payload);
+SilcUInt32 silc_channel_get_mode(SilcChannelPayload payload);
/****f* silccore/SilcChannelAPI/silc_channel_message_payload_decrypt
*
*
* SilcChannelMessagePayload
* silc_channel_message_payload_parse(const unsigned char *payload,
- * uint32 payload_len,
+ * SilcUInt32 payload_len,
* SilcCipher cipher,
* SilcHmac hmac);
*
***/
SilcChannelMessagePayload
silc_channel_message_payload_parse(unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcCipher cipher,
SilcHmac hmac);
*
* SYNOPSIS
*
- * SilcBuffer silc_channel_message_payload_encode(uint16 flags,
- * uint16 data_len,
+ * SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
+ * SilcUInt16 data_len,
* const unsigned char *data,
- * uint16 iv_len,
+ * SilcUInt16 iv_len,
* unsigned char *iv,
* SilcCipher cipher,
* SilcHmac hmac);
* payload.
*
***/
-SilcBuffer silc_channel_message_payload_encode(uint16 flags,
- uint16 data_len,
+SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
const unsigned char *data,
- uint16 iv_len,
+ SilcUInt16 iv_len,
unsigned char *iv,
SilcCipher cipher,
SilcHmac hmac);
*
* unsigned char *
* silc_channel_message_get_data(SilcChannelMessagePayload payload,
- * uint32 *data_len);
+ * SilcUInt32 *data_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
- uint32 *data_len);
+ SilcUInt32 *data_len);
/****f* silccore/SilcChannelAPI/silc_channel_message_get_mac
*
***/
SilcChannelKeyPayload
silc_channel_key_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcChannelAPI/silc_channel_key_payload_encode
*
* SYNOPSIS
*
- * SilcBuffer silc_channel_key_payload_encode(uint16 id_len,
+ * SilcBuffer silc_channel_key_payload_encode(SilcUInt16 id_len,
* const unsigned char *id,
- * uint16 cipher_len,
+ * SilcUInt16 cipher_len,
* const unsigned char *cipher,
- * uint16 key_len,
+ * SilcUInt16 key_len,
* const unsigned char *key);
*
* DESCRIPTION
* to add channel key payload into a packet.
*
***/
-SilcBuffer silc_channel_key_payload_encode(uint16 id_len,
+SilcBuffer silc_channel_key_payload_encode(SilcUInt16 id_len,
const unsigned char *id,
- uint16 cipher_len,
+ SilcUInt16 cipher_len,
const unsigned char *cipher,
- uint16 key_len,
+ SilcUInt16 key_len,
const unsigned char *key);
/****f* silccore/SilcChannelAPI/silc_channel_key_payload_free
* SYNOPSIS
*
* unsigned char *silc_channel_key_get_id(SilcChannelKeyPayload payload,
- * uint32 *id_len);
+ * SilcUInt32 *id_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_key_get_id(SilcChannelKeyPayload payload,
- uint32 *id_len);
+ SilcUInt32 *id_len);
/****f* silccore/SilcChannelAPI/silc_channel_key_get_cipher
*
* SYNOPSIS
*
* unsigned char *silc_channel_key_get_cipher(SilcChannelKeyPayload payload,
- * uint32 *cipher_len);
+ * SilcUInt32 *cipher_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_key_get_cipher(SilcChannelKeyPayload payload,
- uint32 *cipher_len);
+ SilcUInt32 *cipher_len);
/****f* silccore/SilcChannelAPI/silc_channel_key_get_key
*
* SYNOPSIS
*
* unsigned char *silc_channel_key_get_key(SilcChannelKeyPayload payload,
- * uint32 *key_len);
+ * SilcUInt32 *key_len);
*
* DESCRIPTION
*
*
***/
unsigned char *silc_channel_key_get_key(SilcChannelKeyPayload payload,
- uint32 *key_len);
+ SilcUInt32 *key_len);
#endif
from SILC packets. */
struct SilcCommandPayloadStruct {
SilcCommand cmd;
- uint16 ident;
+ SilcUInt16 ident;
SilcArgumentPayload args;
};
/* Parses command payload returning new command payload structure */
SilcCommandPayload silc_command_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcCommandPayload new;
unsigned char args_num;
- uint16 p_len;
+ SilcUInt16 p_len;
int ret;
SILC_LOG_DEBUG(("Parsing command payload"));
/* Encodes Command Payload returning it to SilcBuffer. */
SilcBuffer silc_command_payload_encode(SilcCommand cmd,
- uint32 argc,
+ SilcUInt32 argc,
unsigned char **argv,
- uint32 *argv_lens,
- uint32 *argv_types,
- uint16 ident)
+ SilcUInt32 *argv_lens,
+ SilcUInt32 *argv_types,
+ SilcUInt16 ident)
{
SilcBuffer buffer;
SilcBuffer args = NULL;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Encoding command payload"));
{
SilcBuffer buffer;
SilcBuffer args = NULL;
- uint32 len = 0;
- uint32 argc = 0;
+ SilcUInt32 len = 0;
+ SilcUInt32 argc = 0;
SILC_LOG_DEBUG(("Encoding command payload"));
}
/* Encodes Command payload with variable argument list. The arguments
- must be: uint32, unsigned char *, unsigned int, ... One
- {uint32, unsigned char * and unsigned int} forms one argument,
- thus `argc' in case when sending one {uint32, unsigned char *
- and uint32} equals one (1) and when sending two of those it
+ must be: SilcUInt32, unsigned char *, unsigned int, ... One
+ {SilcUInt32, unsigned char * and unsigned int} forms one argument,
+ thus `argc' in case when sending one {SilcUInt32, unsigned char *
+ and SilcUInt32} equals one (1) and when sending two of those it
equals two (2), and so on. This has to be preserved or bad things
will happen. The variable arguments is: {type, data, data_len}. */
SilcBuffer silc_command_payload_encode_va(SilcCommand cmd,
- uint16 ident,
- uint32 argc, ...)
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer buffer;
/* Same as above but with va_list. */
SilcBuffer silc_command_payload_encode_vap(SilcCommand cmd,
- uint16 ident,
- uint32 argc, va_list ap)
+ SilcUInt16 ident,
+ SilcUInt32 argc, va_list ap)
{
unsigned char **argv = NULL;
- uint32 *argv_lens = NULL, *argv_types = NULL;
+ SilcUInt32 *argv_lens = NULL, *argv_types = NULL;
unsigned char *x;
- uint32 x_len;
- uint32 x_type;
+ SilcUInt32 x_len;
+ SilcUInt32 x_type;
SilcBuffer buffer;
int i, k = 0;
if (argc) {
argv = silc_calloc(argc, sizeof(unsigned char *));
- argv_lens = silc_calloc(argc, sizeof(uint32));
- argv_types = silc_calloc(argc, sizeof(uint32));
+ argv_lens = silc_calloc(argc, sizeof(SilcUInt32));
+ argv_types = silc_calloc(argc, sizeof(SilcUInt32));
for (i = 0, k = 0; i < argc; i++) {
- x_type = va_arg(ap, uint32);
+ x_type = va_arg(ap, SilcUInt32);
x = va_arg(ap, unsigned char *);
- x_len = va_arg(ap, uint32);
+ x_len = va_arg(ap, SilcUInt32);
if (!x_type || !x || !x_len)
continue;
SilcBuffer
silc_command_reply_payload_encode_va(SilcCommand cmd,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...)
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...)
{
va_list ap;
SilcBuffer buffer;
SilcBuffer
silc_command_reply_payload_encode_vap(SilcCommand cmd,
SilcCommandStatus status,
- uint16 ident, uint32 argc,
+ SilcUInt16 ident, SilcUInt32 argc,
va_list ap)
{
unsigned char **argv;
- uint32 *argv_lens = NULL, *argv_types = NULL;
+ SilcUInt32 *argv_lens = NULL, *argv_types = NULL;
unsigned char status_data[2];
unsigned char *x;
- uint32 x_len;
- uint32 x_type;
+ SilcUInt32 x_len;
+ SilcUInt32 x_type;
SilcBuffer buffer;
int i, k;
argc++;
argv = silc_calloc(argc, sizeof(unsigned char *));
- argv_lens = silc_calloc(argc, sizeof(uint32));
- argv_types = silc_calloc(argc, sizeof(uint32));
+ argv_lens = silc_calloc(argc, sizeof(SilcUInt32));
+ argv_types = silc_calloc(argc, sizeof(SilcUInt32));
SILC_PUT16_MSB(status, status_data);
argv[0] = silc_memdup(status_data, sizeof(status_data));
argv_types[0] = 1;
for (i = 1, k = 1; i < argc; i++) {
- x_type = va_arg(ap, uint32);
+ x_type = va_arg(ap, SilcUInt32);
x = va_arg(ap, unsigned char *);
- x_len = va_arg(ap, uint32);
+ x_len = va_arg(ap, SilcUInt32);
if (!x_type || !x || !x_len)
continue;
/* Returns identifier */
-uint16 silc_command_get_ident(SilcCommandPayload payload)
+SilcUInt16 silc_command_get_ident(SilcCommandPayload payload)
{
return payload->ident;
}
payloads are frequentlly resent in SILC and thusly this makes it easy
to set the identifier. */
-void silc_command_set_ident(SilcCommandPayload payload, uint16 ident)
+void silc_command_set_ident(SilcCommandPayload payload, SilcUInt16 ident)
{
payload->ident = ident;
}
*
* NAME
*
- * typedef uint16 SilcCommandStatus;
+ * typedef SilcUInt16 SilcCommandStatus;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint16 SilcCommandStatus;
+typedef SilcUInt16 SilcCommandStatus;
/* Command Status messages */
#define SILC_STATUS_OK 0
*
* SilcCommandPayload
* silc_command_payload_parse(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
*
***/
SilcCommandPayload silc_command_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcCommandAPI/silc_command_payload_encode
*
* SYNOPSIS
*
* SilcBuffer silc_command_payload_encode(SilcCommand cmd,
- * uint32 argc,
+ * SilcUInt32 argc,
* unsigned char **argv,
- * uint32 *argv_lens,
- * uint32 *argv_types,
- * uint16 ident);
+ * SilcUInt32 *argv_lens,
+ * SilcUInt32 *argv_types,
+ * SilcUInt16 ident);
*
* DESCRIPTION
*
*
***/
SilcBuffer silc_command_payload_encode(SilcCommand cmd,
- uint32 argc,
+ SilcUInt32 argc,
unsigned char **argv,
- uint32 *argv_lens,
- uint32 *argv_types,
- uint16 ident);
+ SilcUInt32 *argv_lens,
+ SilcUInt32 *argv_types,
+ SilcUInt16 ident);
/****f* silccore/SilcCommandAPI/silc_command_payload_encode_payload
*
* SYNOPSIS
*
* SilcBuffer silc_command_payload_encode_va(SilcCommand cmd,
- * uint16 ident,
- * uint32 argc, ...);
+ * SilcUInt16 ident,
+ * SilcUInt32 argc, ...);
*
* DESCRIPTION
*
* Encodes Command payload with variable argument list. The arguments
- * must be: uint32, unsigned char *, unsigned int, ... One
- * {uint32, unsigned char * and unsigned int} forms one argument,
- * thus `argc' in case when sending one {uint32, unsigned char *
- * and uint32} equals one (1) and when sending two of those it
+ * must be: SilcUInt32, unsigned char *, unsigned int, ... One
+ * {SilcUInt32, unsigned char * and unsigned int} forms one argument,
+ * thus `argc' in case when sending one {SilcUInt32, unsigned char *
+ * and SilcUInt32} equals one (1) and when sending two of those it
* equals two (2), and so on. This has to be preserved or bad things
* will happen. The variable arguments is: {type, data, data_len}.
*
***/
SilcBuffer silc_command_payload_encode_va(SilcCommand cmd,
- uint16 ident,
- uint32 argc, ...);
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...);
/****f* silccore/SilcCommandAPI/silc_command_payload_encode_vap
*
* SYNOPSIS
*
* SilcBuffer silc_command_payload_encode_vap(SilcCommand cmd,
- * uint16 ident,
- * uint32 argc, va_list ap);
+ * SilcUInt16 ident,
+ * SilcUInt32 argc, va_list ap);
*
* DESCRIPTION
*
*
***/
SilcBuffer silc_command_payload_encode_vap(SilcCommand cmd,
- uint16 ident,
- uint32 argc, va_list ap);
+ SilcUInt16 ident,
+ SilcUInt32 argc, va_list ap);
/****f* silccore/SilcCommandAPI/silc_command_reply_payload_encode_va
*
* SilcBuffer
* silc_command_reply_payload_encode_va(SilcCommand cmd,
* SilcCommandStatus status,
- * uint16 ident,
- * uint32 argc, ...);
+ * SilcUInt16 ident,
+ * SilcUInt32 argc, ...);
*
* DESCRIPTION
*
SilcBuffer
silc_command_reply_payload_encode_va(SilcCommand cmd,
SilcCommandStatus status,
- uint16 ident,
- uint32 argc, ...);
+ SilcUInt16 ident,
+ SilcUInt32 argc, ...);
/****f* silccore/SilcCommandAPI/silc_command_reply_payload_encode_vap
*
* SilcBuffer
* silc_command_reply_payload_encode_vap(SilcCommand cmd,
* SilcCommandStatus status,
- * uint16 ident, uint32 argc,
+ * SilcUInt16 ident, SilcUInt32 argc,
* va_list ap);
*
* DESCRIPTION
SilcBuffer
silc_command_reply_payload_encode_vap(SilcCommand cmd,
SilcCommandStatus status,
- uint16 ident, uint32 argc,
+ SilcUInt16 ident, SilcUInt32 argc,
va_list ap);
/****f* silccore/SilcCommandAPI/silc_command_free
*
* SYNOPSIS
*
- * uint16 silc_command_get_ident(SilcCommandPayload payload);
+ * SilcUInt16 silc_command_get_ident(SilcCommandPayload payload);
*
* DESCRIPTION
*
* the same identifier in the command reply.
*
***/
-uint16 silc_command_get_ident(SilcCommandPayload payload);
+SilcUInt16 silc_command_get_ident(SilcCommandPayload payload);
/****f* silccore/SilcCommandAPI/silc_command_set_ident
*
* SYNOPSIS
*
- * void silc_command_set_ident(SilcCommandPayload payload, uint16 ident);
+ * void silc_command_set_ident(SilcCommandPayload payload, SilcUInt16 ident);
*
* DESCRIPTION
*
* to set the identifier without encoding new Command Payload.
*
***/
-void silc_command_set_ident(SilcCommandPayload payload, uint16 ident);
+void silc_command_set_ident(SilcCommandPayload payload, SilcUInt16 ident);
/****f* silccore/SilcCommandAPI/silc_command_set_command
*
struct SilcIDPayloadStruct {
SilcIdType type;
- uint16 len;
+ SilcUInt16 len;
unsigned char *id;
};
/* Parses buffer and return ID payload into payload structure */
SilcIDPayload silc_id_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcIDPayload new;
/* Return the ID directly from the raw payload data. */
-void *silc_id_payload_parse_id(const unsigned char *data, uint32 len)
+void *silc_id_payload_parse_id(const unsigned char *data, SilcUInt32 len)
{
SilcBufferStruct buffer;
SilcIdType type;
- uint16 idlen;
+ SilcUInt16 idlen;
unsigned char *id_data = NULL;
int ret;
void *id;
{
SilcBuffer buffer;
unsigned char *id_data;
- uint32 len;
+ SilcUInt32 len;
id_data = silc_id_id2str(id, type);
len = silc_id_get_len(id, type);
}
SilcBuffer silc_id_payload_encode_data(const unsigned char *id,
- uint32 id_len, SilcIdType type)
+ SilcUInt32 id_len, SilcIdType type)
{
SilcBuffer buffer;
/* Get length of ID */
-uint32 silc_id_payload_get_len(SilcIDPayload payload)
+SilcUInt32 silc_id_payload_get_len(SilcIDPayload payload)
{
return payload ? payload->len : 0;
}
SilcServerID *server_id;
SilcClientID *client_id;
SilcChannelID *channel_id;
- uint32 id_len = silc_id_get_len(id, type);
+ SilcUInt32 id_len = silc_id_get_len(id, type);
switch(type) {
case SILC_ID_SERVER:
/* Converts string to a ID */
-void *silc_id_str2id(const unsigned char *id, uint32 id_len, SilcIdType type)
+void *silc_id_str2id(const unsigned char *id, SilcUInt32 id_len, SilcIdType type)
{
switch(type) {
/* Returns length of the ID */
-uint32 silc_id_get_len(const void *id, SilcIdType type)
+SilcUInt32 silc_id_get_len(const void *id, SilcIdType type)
{
switch(type) {
case SILC_ID_SERVER:
*
* NAME
*
- * typedef uint16 SilcIdType;
+ * typedef SilcUInt16 SilcIdType;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint16 SilcIdType;
+typedef SilcUInt16 SilcIdType;
/* The SILC ID Types */
#define SILC_ID_NONE 0
* SYNOPSIS
*
* SilcIDPayload silc_id_payload_parse(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
*
***/
SilcIDPayload silc_id_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcIDAPI/silc_id_payload_parse_id
*
* SYNOPSIS
*
- * void *silc_id_payload_parse_id(const unsigned char *data, uint32 len);
+ * void *silc_id_payload_parse_id(const unsigned char *data, SilcUInt32 len);
*
* DESCRIPTION
*
* caller must free the returned ID.
*
***/
-void *silc_id_payload_parse_id(const unsigned char *data, uint32 len);
+void *silc_id_payload_parse_id(const unsigned char *data, SilcUInt32 len);
/****f* silccore/SilcIDAPI/silc_id_payload_encode
*
*
***/
SilcBuffer silc_id_payload_encode_data(const unsigned char *id,
- uint32 id_len, SilcIdType type);
+ SilcUInt32 id_len, SilcIdType type);
/****f* silccore/SilcIDAPI/silc_id_payload_free
*
*
* SYNOPSIS
*
- * uint32 silc_id_payload_get_len(SilcIDPayload payload);
+ * SilcUInt32 silc_id_payload_get_len(SilcIDPayload payload);
*
* DESCRIPTION
*
* Returns the length of the ID in the ID Payload.
*
***/
-uint32 silc_id_payload_get_len(SilcIDPayload payload);
+SilcUInt32 silc_id_payload_get_len(SilcIDPayload payload);
/****s* silccore/SilcIDAPI/SilcIDIP
*
*/
typedef struct {
unsigned char data[16]; /* IP data (in MSB first order) */
- uint8 data_len; /* Length of the data (4 or 16) */
+ SilcUInt8 data_len; /* Length of the data (4 or 16) */
} SilcIDIP;
/***/
*/
typedef struct {
SilcIDIP ip; /* n bit IP address */
- uint16 port; /* 16 bit port */
- uint16 rnd; /* 16 bit random number */
+ SilcUInt16 port; /* 16 bit port */
+ SilcUInt16 rnd; /* 16 bit random number */
} SilcServerID;
/***/
*/
typedef struct {
SilcIDIP ip; /* n bit IP address */
- uint16 port; /* 16 bit port */
- uint16 rnd; /* 16 bit random number */
+ SilcUInt16 port; /* 16 bit port */
+ SilcUInt16 rnd; /* 16 bit random number */
} SilcChannelID;
/***/
*
* SYNOPSIS
*
- * void *silc_id_str2id(const unsigned char *id, uint32 id_len,
+ * void *silc_id_str2id(const unsigned char *id, SilcUInt32 id_len,
* SilcIdType type);
*
* DESCRIPTION
* ID out of data that has been taken for example from packet.
*
***/
-void *silc_id_str2id(const unsigned char *id, uint32 id_len, SilcIdType type);
+void *silc_id_str2id(const unsigned char *id, SilcUInt32 id_len, SilcIdType type);
/****f* silccore/SilcIDAPI/silc_id_get_len
*
* SYNOPSIS
*
- * uint32 silc_id_get_len(const void *id, SilcIdType type);
+ * SilcUInt32 silc_id_get_len(const void *id, SilcIdType type);
*
* DESCRIPTION
*
* Returns the true length of the ID of the type `type'.
*
***/
-uint32 silc_id_get_len(const void *id, SilcIdType type);
+SilcUInt32 silc_id_get_len(const void *id, SilcIdType type);
/****f* silccore/SilcIDAPI/silc_id_dup
*
struct SilcIDCacheListStruct {
SilcIDCacheEntry cache[64];
SilcIDCacheEntry *cache_dyn;
- uint32 cache_dyn_count;
- uint32 cache_count;
- uint32 pos;
+ SilcUInt32 cache_dyn_count;
+ SilcUInt32 cache_count;
+ SilcUInt32 pos;
bool dyn;
};
The `id_type' defines the types of the ID's that will be saved to the
cache. */
-SilcIDCache silc_idcache_alloc(uint32 count, SilcIdType id_type,
+SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
SilcIDCacheDestructor destructor)
{
SilcIDCache cache;
cache = silc_calloc(1, sizeof(*cache));
cache->id_table = silc_hash_table_alloc(count, silc_hash_id,
- (void *)(uint32)id_type,
+ (void *)(SilcUInt32)id_type,
silc_hash_id_compare,
- (void *)(uint32)id_type,
+ (void *)(SilcUInt32)id_type,
silc_idcache_destructor, NULL,
FALSE);
cache->name_table = silc_hash_table_alloc(count, silc_hash_string, NULL,
void *user_context)
{
SilcIDCache cache = (SilcIDCache)user_context;
- uint32 curtime = time(NULL);
+ SilcUInt32 curtime = time(NULL);
SilcIDCacheEntry c = (SilcIDCacheEntry)context;
if (c->expire && c->expire < curtime) {
*
* A name associated with the ID.
*
- * uint32 expire
+ * SilcUInt32 expire
*
* Time when this cache entry expires. This is normal time() value
* plus the validity. Cache entry has expired if current time is
typedef struct {
void *id;
char *name;
- uint32 expire;
+ SilcUInt32 expire;
void *context;
} *SilcIDCacheEntry;
/***/
*
* SYNOPSIS
*
- * SilcIDCache silc_idcache_alloc(uint32 count, SilcIdType id_type,
+ * SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
* SilcIDCacheDestructor destructor);
*
* DESCRIPTION
* cache.
*
***/
-SilcIDCache silc_idcache_alloc(uint32 count, SilcIdType id_type,
+SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
SilcIDCacheDestructor destructor);
/****f* silccore/SilcIDCacheAPI/silc_idcache_free
/* Parse notify payload buffer and return data into payload structure */
SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
- uint32 payload_len)
+ SilcUInt32 payload_len)
{
SilcBufferStruct buffer;
SilcNotifyPayload new;
- uint16 len;
+ SilcUInt16 len;
int ret;
SILC_LOG_DEBUG(("Parsing Notify payload"));
/* Encode notify payload with variable argument list. If `argc' is > 0
argument payloads will be associated to the notify payload. Variable
- arguments must be {usigned char *, uint32 (len)}. */
+ arguments must be {usigned char *, SilcUInt32 (len)}. */
-SilcBuffer silc_notify_payload_encode(SilcNotifyType type, uint32 argc,
+SilcBuffer silc_notify_payload_encode(SilcNotifyType type, SilcUInt32 argc,
va_list ap)
{
SilcBuffer buffer;
SilcBuffer args = NULL;
unsigned char **argv;
- uint32 *argv_lens = NULL, *argv_types = NULL;
+ SilcUInt32 *argv_lens = NULL, *argv_types = NULL;
unsigned char *x;
- uint32 x_len;
+ SilcUInt32 x_len;
int i, k = 0, len = 0;
if (argc) {
argv = silc_calloc(argc, sizeof(unsigned char *));
- argv_lens = silc_calloc(argc, sizeof(uint32));
- argv_types = silc_calloc(argc, sizeof(uint32));
+ argv_lens = silc_calloc(argc, sizeof(SilcUInt32));
+ argv_types = silc_calloc(argc, sizeof(SilcUInt32));
for (i = 0, k = 0; i < argc; i++) {
x = va_arg(ap, unsigned char *);
- x_len = va_arg(ap, uint32);
+ x_len = va_arg(ap, SilcUInt32);
if (!x || !x_len)
continue;
/* Same as above but takes argument from the `args' Argument Payload. */
SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
- uint32 argc,
+ SilcUInt32 argc,
SilcBuffer args)
{
SilcBuffer buffer;
/* Return argument nums */
-uint32 silc_notify_get_arg_num(SilcNotifyPayload payload)
+SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload)
{
return payload->argc;
}
*
* NAME
*
- * typedef uint16 SilcNotifyType;
+ * typedef SilcUInt16 SilcNotifyType;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint16 SilcNotifyType;
+typedef SilcUInt16 SilcNotifyType;
/* SILC notify types. Server may send these notify types to client to
notify of some action. */
*
* SilcNotifyPayload
* silc_notify_payload_parse(const unsigned char *payload,
- * uint32 payload_len);
+ * SilcUInt32 payload_len);
*
* DESCRIPTION
*
*
***/
SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
- uint32 payload_len);
+ SilcUInt32 payload_len);
/****f* silccore/SilcNotifyAPI/silc_notify_payload_encode
*
* SYNOPSIS
*
- * SilcBuffer silc_notify_payload_encode(SilcNotifyType type, uint32 argc,
+ * SilcBuffer silc_notify_payload_encode(SilcNotifyType type, SilcUInt32 argc,
* va_list ap);
*
* DESCRIPTION
*
* Encode notify payload with variable argument list. If `argc' is > 0
* argument payloads will be associated to the notify payload. Variable
- * arguments must be {usigned char *, uint32 (len)}.
+ * arguments must be {usigned char *, SilcUInt32 (len)}.
*
***/
-SilcBuffer silc_notify_payload_encode(SilcNotifyType type, uint32 argc,
+SilcBuffer silc_notify_payload_encode(SilcNotifyType type, SilcUInt32 argc,
va_list ap);
/****f* silccore/SilcNotifyAPI/silc_notify_payload_encode_args
* SYNOPSIS
*
* SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
- * uint32 argc,
+ * SilcUInt32 argc,
* SilcBuffer args);
*
* DESCRIPTION
*
***/
SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
- uint32 argc,
+ SilcUInt32 argc,
SilcBuffer args);
/****f* silccore/SilcNotifyAPI/silc_notify_payload_free
*
* SYNOPSIS
*
- * uint32 silc_notify_get_arg_num(SilcNotifyPayload payload);
+ * SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
*
* DESCRIPTION
*
* Return the number of the arguments associated with the Notify Payload.
*
***/
-uint32 silc_notify_get_arg_num(SilcNotifyPayload payload);
+SilcUInt32 silc_notify_get_arg_num(SilcNotifyPayload payload);
/****f* silccore/SilcNotifyAPI/silc_notify_get_args
*
other process of HMAC computing and encryption is needed this function
cannot be used. */
-void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac, uint32 sequence,
- SilcBuffer buffer, uint32 len)
+void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac, SilcUInt32 sequence,
+ SilcBuffer buffer, SilcUInt32 len)
{
unsigned char mac[32];
- uint32 mac_len;
+ SilcUInt32 mac_len;
/* Compute HMAC. This assumes that HMAC is created from the entire
data area thus this uses the length found in buffer, not the length
outgoing buffer in SilcSocketConnection object. */
void silc_packet_send_prepare(SilcSocketConnection sock,
- uint32 header_len,
- uint32 padlen,
- uint32 data_len)
+ SilcUInt32 header_len,
+ SilcUInt32 padlen,
+ SilcUInt32 data_len)
{
int totlen, oldlen;
******************************************************************************/
static int silc_packet_decrypt(SilcCipher cipher, SilcHmac hmac,
- uint32 sequence, SilcBuffer buffer,
+ SilcUInt32 sequence, SilcBuffer buffer,
bool normal);
/* Receives packet from network and reads the data into connection's
bool silc_packet_receive_process(SilcSocketConnection sock,
bool local_is_router,
SilcCipher cipher, SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketParserCallback parser,
void *parser_context)
{
after packet has been totally decrypted and parsed. */
static int silc_packet_check_mac(SilcHmac hmac, SilcBuffer buffer,
- uint32 sequence)
+ SilcUInt32 sequence)
{
/* Check MAC */
if (hmac) {
unsigned char mac[32], psn[4];
- uint32 mac_len;
+ SilcUInt32 mac_len;
SILC_LOG_DEBUG(("Verifying MAC"));
{
/* Decrypt rest of the header plus padding */
if (cipher) {
- uint16 len;
+ SilcUInt16 len;
/* Pull MAC from packet before decryption */
if (hmac) {
/* padding length + src id len + dst id len + header length - 16
bytes already decrypted, gives the rest of the encrypted packet */
- len = (((uint8)buffer->data[4] + (uint8)buffer->data[6] +
- (uint8)buffer->data[7] + SILC_PACKET_HEADER_LEN) -
+ len = (((SilcUInt8)buffer->data[4] + (SilcUInt8)buffer->data[6] +
+ (SilcUInt8)buffer->data[7] + SILC_PACKET_HEADER_LEN) -
SILC_PACKET_MIN_HEADER_LEN);
silc_buffer_pull(buffer, SILC_PACKET_MIN_HEADER_LEN);
is special and requires special procesing. */
static int silc_packet_decrypt(SilcCipher cipher, SilcHmac hmac,
- uint32 sequence, SilcBuffer buffer,
+ SilcUInt32 sequence, SilcBuffer buffer,
bool normal)
{
/* If the packet type is not any special type lets decrypt rest
SilcPacketType silc_packet_parse(SilcPacketContext *ctx, SilcCipher cipher)
{
SilcBuffer buffer = ctx->buffer;
- uint8 tmp;
+ SilcUInt8 tmp;
int len, ret;
SILC_LOG_DEBUG(("Parsing incoming packet"));
SilcCipher cipher)
{
SilcBuffer buffer = ctx->buffer;
- uint8 tmp;
+ SilcUInt8 tmp;
int len, ret;
SILC_LOG_DEBUG(("Parsing incoming packet"));
* Packet flags. Flags are defined above.
*
* unsigned char *src_id
- * uint8 src_id_len
+ * SilcUInt8 src_id_len
* unsigned char src_id_type
*
* Source ID, its length and type. On packet reception retuned ID's
* are always the hash values of the ID's from the packet.
*
* unsigned char *dst_id;
- * uint8 dst_id_len;
+ * SilcUInt8 dst_id_len;
* unsigned char src_id_type;
*
* Destination ID, its length and type. On packet reception retuned
* ID's are always the hash values of the ID's from the packet.
*
- * uint16 truelen
- * uint8 padlen
+ * SilcUInt16 truelen
+ * SilcUInt8 padlen
*
* The true lenght of the packet and the padded length of the packet.
* These may be set by the caller before calling any of the
* calling silc_packet_context_dup and decreased by calling the
* silc_packet_context_free.
*
- * uint32 sequence;
+ * SilcUInt32 sequence;
*
* Packet sequence number.
*
typedef struct {
SilcBuffer buffer;
- uint16 truelen;
+ SilcUInt16 truelen;
SilcPacketFlags flags;
SilcPacketType type;
- uint8 padlen;
+ SilcUInt8 padlen;
unsigned char *src_id;
- uint8 src_id_len;
- uint8 src_id_type;
+ SilcUInt8 src_id_len;
+ SilcUInt8 src_id_type;
unsigned char *dst_id;
- uint8 dst_id_len;
- uint8 dst_id_type;
+ SilcUInt8 dst_id_len;
+ SilcUInt8 dst_id_type;
int users;
bool long_pad; /* Set to TRUE to use maximum padding
in packet (up to 256 bytes). */
- uint32 sequence;
+ SilcUInt32 sequence;
} SilcPacketContext;
/****s* silccore/SilcPacketAPI/SilcPacketParserContext
* SYNOPSIS
*
* void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac,
- * SilcBuffer buffer, uint32 len);
+ * SilcBuffer buffer, SilcUInt32 len);
*
* DESCRIPTION
*
* cannot be used.
*
***/
-void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac, uint32 sequence,
- SilcBuffer buffer, uint32 len);
+void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac, SilcUInt32 sequence,
+ SilcBuffer buffer, SilcUInt32 len);
/****f* silccore/SilcPacketAPI/silc_packet_assemble
*
* SYNOPSIS
*
* void silc_packet_send_prepare(SilcSocketConnection sock,
- * uint32 header_len,
- * uint32 padlen,
- * uint32 data_len);
+ * SilcUInt32 header_len,
+ * SilcUInt32 padlen,
+ * SilcUInt32 data_len);
*
* DESCRIPTION
*
*
***/
void silc_packet_send_prepare(SilcSocketConnection sock,
- uint32 header_len,
- uint32 padlen,
- uint32 data_len);
+ SilcUInt32 header_len,
+ SilcUInt32 padlen,
+ SilcUInt32 data_len);
/****f* silccore/SilcPacketAPI/silc_packet_receive
*
bool silc_packet_receive_process(SilcSocketConnection sock,
bool local_is_router,
SilcCipher cipher, SilcHmac hmac,
- uint32 sequence,
+ SilcUInt32 sequence,
SilcPacketParserCallback parser,
void *parser_context);
/* Private Message Payload structure. Contents of this structure is parsed
from SILC packets. */
struct SilcPrivateMessagePayloadStruct {
- uint16 flags;
- uint16 message_len;
+ SilcUInt16 flags;
+ SilcUInt16 message_len;
unsigned char *message;
};
SilcPrivateMessagePayload
silc_private_message_payload_parse(unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcCipher cipher)
{
SilcBufferStruct buffer;
the cipher is provided the packet is also encrypted here. It is provided
if the private message private keys are used. */
-SilcBuffer silc_private_message_payload_encode(uint16 flags,
- uint16 data_len,
+SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
const unsigned char *data,
SilcCipher cipher)
{
int i;
SilcBuffer buffer;
- uint32 len, pad_len = 0;
+ SilcUInt32 len, pad_len = 0;
unsigned char pad[16];
SILC_LOG_DEBUG(("Encoding private message payload"));
/* Return flags */
-uint16
+SilcUInt16
silc_private_message_get_flags(SilcPrivateMessagePayload payload)
{
return payload->flags;
unsigned char *
silc_private_message_get_message(SilcPrivateMessagePayload payload,
- uint32 *message_len)
+ SilcUInt32 *message_len)
{
if (message_len)
*message_len = payload->message_len;
*
* SilcPrivateMessagePayload
* silc_private_message_payload_parse(unsigned char *payload,
- * uint32 payload_len,
+ * SilcUInt32 payload_len,
* SilcCipher cipher);
*
* DESCRIPTION
***/
SilcPrivateMessagePayload
silc_private_message_payload_parse(unsigned char *payload,
- uint32 payload_len,
+ SilcUInt32 payload_len,
SilcCipher cipher);
/****f* silccore/SilcPrivateAPI/silc_private_message_payload_encode
*
* SYNOPSIS
*
- * SilcBuffer silc_private_message_payload_encode(uint16 flags,
- * uint16 data_len,
+ * SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
+ * SilcUInt16 data_len,
* const unsigned char *data,
* SilcCipher cipher);
*
* if the private message private keys are used.
*
***/
-SilcBuffer silc_private_message_payload_encode(uint16 flags,
- uint16 data_len,
+SilcBuffer silc_private_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
const unsigned char *data,
SilcCipher cipher);
*
* SYNOPSIS
*
- * uint16
+ * SilcUInt16
* silc_private_message_get_flags(SilcPrivateMessagePayload payload);
*
* DESCRIPTION
* channel message flags.
*
***/
-uint16
+SilcUInt16
silc_private_message_get_flags(SilcPrivateMessagePayload payload);
/****f* silccore/SilcPrivateAPI/silc_private_message_get_message
*
* unsigned char *
* silc_private_message_get_nickname(SilcPrivateMessagePayload payload,
- * uint32 *nickname_len);
+ * SilcUInt32 *nickname_len);
*
* DESCRIPTION
*
***/
unsigned char *
silc_private_message_get_message(SilcPrivateMessagePayload payload,
- uint32 *message_len);
+ SilcUInt32 *message_len);
#endif
SILC_CIPHER_API_SET_KEY(aes)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
rijndael_set_key((RijndaelContext *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(aes)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(aes)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_ENCRYPT_CBC(blowfish)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(blowfish)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
/*
* Round loop unrolling macros, S is a pointer to a S-Box array
- * organized in 4 uint32s at a row.
+ * organized in 4 SilcUInt32s at a row.
*/
#define GET32_3(x) (((x) & 0xff))
SILC_CIPHER_API_SET_KEY(cast)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
cast_set_key((CastContext *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(cast)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(cast)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
/* General definitions for algorithms */
typedef unsigned char u1byte;
-typedef uint32 u4byte;
-typedef uint32 u32;
+typedef SilcUInt32 u4byte;
+typedef SilcUInt32 u32;
#define rotr(x, nr) (((x) >> ((int)(nr))) | ((x) << (32 - (int)(nr))))
#define rotl(x, nr) (((x) << ((int)(nr))) | ((x) >> (32 - (int)(nr))))
SILC_CIPHER_API_SET_KEY(mars)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
mars_set_key((MarsContext *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(mars)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(mars)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
-void byteReverse(unsigned char *buf, uint32s);
+void byteReverse(unsigned char *buf, SilcUInt32s);
#ifndef ASM_MD5
/*
* Note: this code is harmless on little-endian machines.
*/
-void byteReverse(unsigned char *buf, uint32s)
+void byteReverse(unsigned char *buf, SilcUInt32s)
{
- uint32 t;
+ SilcUInt32 t;
do {
- t = (uint32)((unsigned)buf[3]<<8 | buf[2]) << 16 |
+ t = (SilcUInt32)((unsigned)buf[3]<<8 | buf[2]) << 16 |
((unsigned)buf[1]<<8 | buf[0]);
- *(uint32 *)buf = t;
+ *(SilcUInt32 *)buf = t;
buf += 4;
} while (--longs);
}
void
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
- uint32 t;
+ SilcUInt32 t;
/* Update bitcount */
t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32)len << 3)) < t)
+ if ((ctx->bits[0] = t + ((SilcUInt32)len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32 *)ctx->in)[ 14 ] = ctx->bits[0];
- ((uint32 *)ctx->in)[ 15 ] = ctx->bits[1];
+ ((SilcUInt32 *)ctx->in)[ 14 ] = ctx->bits[0];
+ ((SilcUInt32 *)ctx->in)[ 15 ] = ctx->bits[1];
MD5Transform(ctx->buf, ctx->in);
byteReverse((unsigned char *)ctx->buf, 4);
* the data and converts bytes into longwords for this routine.
*/
void
-MD5Transform(uint32 buf[4], const unsigned char kbuf[64])
+MD5Transform(SilcUInt32 buf[4], const unsigned char kbuf[64])
{
- register uint32 a, b, c, d, i;
- uint32 in[16];
+ register SilcUInt32 a, b, c, d, i;
+ SilcUInt32 in[16];
for (i = 0; i < 16; i++)
SILC_GET32_MSB(in[i], kbuf + 4 * i);
#define MD5_INTERNAL_H
struct MD5Context {
- uint32 buf[4];
- uint32 bits[2];
+ SilcUInt32 buf[4];
+ SilcUInt32 bits[2];
unsigned char in[64];
};
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
-void MD5Transform(uint32 buf[4], const unsigned char kbuf[64]);
+void MD5Transform(SilcUInt32 buf[4], const unsigned char kbuf[64]);
/*
* This is needed to make RSAREF happy on some MS-DOS compilers.
* the rules defined in PKCS #1.
*/
static unsigned char *
-RSA_FormatOneBlock(uint32 modulusLen, RSA_BlockType blockType,
- unsigned char *data, uint32 data_len)
+RSA_FormatOneBlock(SilcUInt32 modulusLen, RSA_BlockType blockType,
+ unsigned char *data, SilcUInt32 data_len)
{
unsigned char *block;
unsigned char *bp;
}
static int
-RSA_FormatBlock(unsigned char **result, uint32 *result_len,
- uint32 modulusLen,
+RSA_FormatBlock(unsigned char **result, SilcUInt32 *result_len,
+ SilcUInt32 modulusLen,
RSA_BlockType blockType, unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
/*
* XXX For now assume that the data length fits in a single
*/
unsigned char *
RSA_DecodeOneBlock(unsigned char *data,
- uint32 modulusLen,
- uint32 expectedLen,
+ SilcUInt32 modulusLen,
+ SilcUInt32 expectedLen,
RSA_BlockType bt,
- uint32 *pResultLen)
+ SilcUInt32 *pResultLen)
{
RSA_BlockType blockType;
unsigned char *dp, *res;
- uint32 i, len = 0;
+ SilcUInt32 i, len = 0;
dp = data;
if (dp[0] != RSA_BLOCK_FIRST_OCTET) {
SilcMPInt mp_tmp;
SilcMPInt mp_dst;
unsigned char *padded;
- uint32 padded_len, len = key->bits / 8;
+ SilcUInt32 padded_len, len = key->bits / 8;
/* Pad data */
if (!RSA_FormatBlock(&padded, &padded_len, len,
SilcMPInt mp_tmp;
SilcMPInt mp_dst;
unsigned char *padded, *unpadded;
- uint32 padded_len;
+ SilcUInt32 padded_len;
silc_mp_init(&mp_tmp);
silc_mp_init(&mp_dst);
SilcMPInt mp_tmp;
SilcMPInt mp_dst;
unsigned char *padded;
- uint32 padded_len;
- uint32 len = key->bits / 8;
+ SilcUInt32 padded_len;
+ SilcUInt32 len = key->bits / 8;
/* Pad data */
if (!RSA_FormatBlock(&padded, &padded_len, len, RSA_BlockPrivate,
SilcMPInt mp_tmp2;
SilcMPInt mp_dst;
unsigned char *verify, *unpadded;
- uint32 verify_len, len = key->bits / 8;
+ SilcUInt32 verify_len, len = key->bits / 8;
silc_mp_init(&mp_tmp2);
silc_mp_init(&mp_dst);
SILC_CIPHER_API_SET_KEY(rc5)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
rc5_set_key((RC5Context *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(rc5)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(rc5)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
/* Sets RC5 key */
-int rc5_set_key(RC5Context *ctx, const uint32 in_key[], int key_len)
+int rc5_set_key(RC5Context *ctx, const SilcUInt32 in_key[], int key_len)
{
u32 i, j, k, A, B, L[c];
u32 *out_key = ctx->out_key;
} RC5Context;
/* Prototypes */
-int rc5_set_key(RC5Context *ctx, const uint32 in_key[], int key_len);
+int rc5_set_key(RC5Context *ctx, const SilcUInt32 in_key[], int key_len);
int rc5_encrypt(RC5Context *ctx, u32 *in, u32 *out);
int rc5_decrypt(RC5Context *ctx, u32 *in, u32 *out);
SILC_CIPHER_API_SET_KEY(rc6)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
rc6_set_key((RC6Context *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(rc6)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(rc6)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_PKCS_API_INIT(rsa)
{
- uint32 prime_bits = keylen / 2;
+ SilcUInt32 prime_bits = keylen / 2;
SilcMPInt p, q;
bool found = FALSE;
{
RsaKey *key = (RsaKey *)context;
unsigned char *e, *n, *ret;
- uint32 e_len, n_len;
+ SilcUInt32 e_len, n_len;
unsigned char tmp[4];
e = silc_mp_mp2bin(&key->e, 0, &e_len);
{
RsaKey *key = (RsaKey *)context;
unsigned char *e, *n, *d, *ret;
- uint32 e_len, n_len, d_len;
+ SilcUInt32 e_len, n_len, d_len;
unsigned char tmp[4];
e = silc_mp_mp2bin(&key->e, 0, &e_len);
{
RsaKey *key = (RsaKey *)context;
unsigned char tmp[4];
- uint32 e_len, n_len;
+ SilcUInt32 e_len, n_len;
if (key->pub_set) {
silc_mp_uninit(&key->e);
{
RsaKey *key = (RsaKey *)context;
unsigned char tmp[4];
- uint32 e_len, n_len, d_len;
+ SilcUInt32 e_len, n_len, d_len;
if (key->prv_set) {
silc_mp_uninit(&key->d);
to compute the modulus n has to be generated before calling this. They
are then sent as argument for the function. */
-void rsa_generate_keys(RsaKey *key, uint32 bits,
+void rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
SilcMPInt *p, SilcMPInt *q)
{
SilcMPInt phi, hlp;
SilcMPInt d; /* private exponent */
} RsaKey;
-void rsa_generate_keys(RsaKey *key, uint32 bits,
+void rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
SilcMPInt *p, SilcMPInt *q);
void rsa_clear_keys(RsaKey *key);
void rsa_en_de_crypt(SilcMPInt *cm, SilcMPInt *mc,
context->count[0] = context->count[1] = 0;
}
-#define rol(x, nr) (((x) << ((uint32)(nr))) | ((x) >> (32 - (uint32)(nr))))
+#define rol(x, nr) (((x) << ((SilcUInt32)(nr))) | ((x) >> (32 - (SilcUInt32)(nr))))
-#define GET_WORD(cp) ((uint32)(uint8)(cp)[0]) << 24 \
- | ((uint32)(uint8)(cp)[1] << 16) \
- | ((uint32)(uint8)(cp)[2] << 8) \
- | ((uint32)(uint8)(cp)[3])
+#define GET_WORD(cp) ((SilcUInt32)(SilcUInt8)(cp)[0]) << 24 \
+ | ((SilcUInt32)(SilcUInt8)(cp)[1] << 16) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[2] << 8) \
+ | ((SilcUInt32)(SilcUInt8)(cp)[3])
#define blk0(i) (W[i] = GET_WORD(data))
#define blk1(i) (W[i&15] = rol(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
#define R3(v,w,x,y,z,i) z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
#define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
-void SHA1Transform(uint32 *state, const unsigned char *data)
+void SHA1Transform(SilcUInt32 *state, const unsigned char *data)
{
- uint32 W[16];
+ SilcUInt32 W[16];
/* Copy context->state[] to working vars */
- uint32 a = state[0];
- uint32 b = state[1];
- uint32 c = state[2];
- uint32 d = state[3];
- uint32 e = state[4];
+ SilcUInt32 a = state[0];
+ SilcUInt32 b = state[1];
+ SilcUInt32 c = state[2];
+ SilcUInt32 d = state[3];
+ SilcUInt32 e = state[4];
/* 4 rounds of 20 operations each. Loop unrolled. */
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
/* Run your data through this. */
-void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32 len)
+void SHA1Update(SHA1_CTX* context, unsigned char* data, SilcUInt32 len)
{
- uint32 i, j;
+ SilcUInt32 i, j;
j = (context->count[0] >> 3) & 63;
if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++;
void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{
- uint32 i, j;
+ SilcUInt32 i, j;
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
/* Context declaration */
typedef struct {
- uint32 state[5];
- uint32 count[2];
+ SilcUInt32 state[5];
+ SilcUInt32 count[2];
unsigned char buffer[64];
} SHA1_CTX;
/* Function forward declerations */
-void SHA1Transform(uint32 *state, const unsigned char *data);
+void SHA1Transform(SilcUInt32 *state, const unsigned char *data);
void SHA1Init(SHA1_CTX* context);
-void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32 len);
+void SHA1Update(SHA1_CTX* context, unsigned char* data, SilcUInt32 len);
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
#endif
/* Encrypts */
bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
return cipher->cipher->encrypt(cipher->context, src, dst, len, iv);
/* Decrypts */
bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
return cipher->cipher->decrypt(cipher->context, src, dst, len, iv);
/* Sets the key for the cipher */
bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
- uint32 keylen)
+ SilcUInt32 keylen)
{
return cipher->cipher->set_key(cipher->context, key, keylen);
}
/* Returns the key length of the cipher. */
-uint32 silc_cipher_get_key_len(SilcCipher cipher)
+SilcUInt32 silc_cipher_get_key_len(SilcCipher cipher)
{
return cipher->cipher->key_len;
}
/* Returns the block size of the cipher. */
-uint32 silc_cipher_get_block_len(SilcCipher cipher)
+SilcUInt32 silc_cipher_get_block_len(SilcCipher cipher)
{
return cipher->cipher->block_len;
}
Logical name of the cipher.
- uint32 block_len
+ SilcUInt32 block_len
Block size of the cipher.
- uint32 key_len
+ SilcUInt32 key_len
Length of the key of the cipher (in bits).
*/
typedef struct {
char *name;
- uint32 block_len;
- uint32 key_len;
+ SilcUInt32 block_len;
+ SilcUInt32 key_len;
- bool (*set_key)(void *, const unsigned char *, uint32);
- bool (*set_key_with_string)(void *, const unsigned char *, uint32);
+ bool (*set_key)(void *, const unsigned char *, SilcUInt32);
+ bool (*set_key_with_string)(void *, const unsigned char *, SilcUInt32);
bool (*encrypt)(void *, const unsigned char *, unsigned char *,
- uint32, unsigned char *);
+ SilcUInt32, unsigned char *);
bool (*decrypt)(void *, const unsigned char *, unsigned char *,
- uint32, unsigned char *);
- uint32 (*context_len)();
+ SilcUInt32, unsigned char *);
+ SilcUInt32 (*context_len)();
} SilcCipherObject;
#define SILC_CIPHER_MAX_IV_SIZE 16
unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
void (*set_iv)(struct SilcCipherStruct *, const unsigned char *);
void (*get_iv)(struct SilcCipherStruct *, unsigned char *);
- uint32 (*get_key_len)(struct SilcCipherStruct *);
- uint32 (*get_block_len)(struct SilcCipherStruct *);
+ SilcUInt32 (*get_key_len)(struct SilcCipherStruct *);
+ SilcUInt32 (*get_block_len)(struct SilcCipherStruct *);
} *SilcCipher;
/* Marks for all ciphers in silc. This can be used in silc_cipher_unregister
#define SILC_CIPHER_API_SET_KEY(cipher) \
bool silc_##cipher##_set_key(void *context, \
const unsigned char *key, \
- uint32 keylen)
+ SilcUInt32 keylen)
#define SILC_CIPHER_API_SET_KEY_WITH_STRING(cipher) \
bool silc_##cipher##_set_key_with_string(void *context, \
const unsigned char *string, \
- uint32 stringlen)
+ SilcUInt32 stringlen)
#define SILC_CIPHER_API_ENCRYPT_CBC(cipher) \
bool silc_##cipher##_encrypt_cbc(void *context, \
const unsigned char *src, \
unsigned char *dst, \
- uint32 len, \
+ SilcUInt32 len, \
unsigned char *iv)
#define SILC_CIPHER_API_DECRYPT_CBC(cipher) \
bool silc_##cipher##_decrypt_cbc(void *context, \
const unsigned char *src, \
unsigned char *dst, \
- uint32 len, \
+ SilcUInt32 len, \
unsigned char *iv)
#define SILC_CIPHER_API_CONTEXT_LEN(cipher) \
-uint32 silc_##cipher##_context_len()
+SilcUInt32 silc_##cipher##_context_len()
/* Prototypes */
bool silc_cipher_register(SilcCipherObject *cipher);
bool silc_cipher_is_supported(const unsigned char *name);
char *silc_cipher_get_supported(void);
bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv);
bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv);
bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
- uint32 keylen);
+ SilcUInt32 keylen);
void silc_cipher_set_iv(SilcCipher cipher, const unsigned char *iv);
void silc_cipher_get_iv(SilcCipher cipher, unsigned char *iv);
-uint32 silc_cipher_get_key_len(SilcCipher cipher);
-uint32 silc_cipher_get_block_len(SilcCipher cipher);
+SilcUInt32 silc_cipher_get_key_len(SilcCipher cipher);
+SilcUInt32 silc_cipher_get_block_len(SilcCipher cipher);
#endif
* SYNOPSIS
*
* bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
- * uint32 *z_len);
+ * SilcUInt32 *z_len);
*
* DESCRIPTION
*
*
***/
bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
- uint32 *z_len);
+ SilcUInt32 *z_len);
#endif
/* Returns the length of the hash digest. */
-uint32 silc_hash_len(SilcHash hash)
+SilcUInt32 silc_hash_len(SilcHash hash)
{
return hash->hash->hash_len;
}
/* Creates the hash value and returns it to the return_hash argument. */
void silc_hash_make(SilcHash hash, const unsigned char *data,
- uint32 len, unsigned char *return_hash)
+ SilcUInt32 len, unsigned char *return_hash)
{
hash->hash->init(hash->context);
hash->hash->update(hash->context, (unsigned char *)data, len);
caller. */
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
unsigned char h[32];
fingerprint to the babbleprint. */
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
char *babbleprint;
/* The default Silc hash object to represent any hash function in SILC. */
typedef struct {
char *name;
- uint32 hash_len;
- uint32 block_len;
+ SilcUInt32 hash_len;
+ SilcUInt32 block_len;
void (*init)(void *);
- void (*update)(void *, unsigned char *, uint32);
+ void (*update)(void *, unsigned char *, SilcUInt32);
void (*final)(void *, unsigned char *);
- void (*transform)(uint32 *, unsigned char *);
- uint32 (*context_len)();
+ void (*transform)(SilcUInt32 *, unsigned char *);
+ SilcUInt32 (*context_len)();
} SilcHashObject;
/* The main SILC hash structure. Use SilcHash instead of SilcHashStruct.
void *context;
void (*make_hash)(struct SilcHashStruct *, const unsigned char *,
- uint32, unsigned char *);
+ SilcUInt32, unsigned char *);
} *SilcHash;
/* Marks for all hash functions. This can be used in silc_hash_unregister
void silc_##hash##_init(void *context)
#define SILC_HASH_API_UPDATE(hash) \
void silc_##hash##_update(void *context, unsigned char *data, \
- uint32 len)
+ SilcUInt32 len)
#define SILC_HASH_API_FINAL(hash) \
void silc_##hash##_final(void *context, unsigned char *digest)
#define SILC_HASH_API_TRANSFORM(hash) \
-void silc_##hash##_transform(uint32 *state, \
+void silc_##hash##_transform(SilcUInt32 *state, \
unsigned char *buffer)
#define SILC_HASH_API_CONTEXT_LEN(hash) \
-uint32 silc_##hash##_context_len()
+SilcUInt32 silc_##hash##_context_len()
/* Prototypes */
bool silc_hash_register(SilcHashObject *hash);
bool silc_hash_register_default(void);
bool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash);
void silc_hash_free(SilcHash hash);
-uint32 silc_hash_len(SilcHash hash);
+SilcUInt32 silc_hash_len(SilcHash hash);
bool silc_hash_is_supported(const unsigned char *name);
char *silc_hash_get_supported(void);
void silc_hash_make(SilcHash hash, const unsigned char *data,
- uint32 len, unsigned char *return_hash);
+ SilcUInt32 len, unsigned char *return_hash);
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
#endif
bool allocated_hash; /* TRUE if the hash was allocated */
unsigned char *key;
- uint32 key_len;
+ SilcUInt32 key_len;
unsigned char inner_pad[64];
unsigned char outer_pad[64];
};
static void silc_hmac_init_internal(SilcHmac hmac, unsigned char *key,
- uint32 key_len)
+ SilcUInt32 key_len)
{
SilcHash hash = hmac->hash;
unsigned char hvalue[20];
/* Returns the length of the MAC that the HMAC will produce. */
-uint32 silc_hmac_len(SilcHmac hmac)
+SilcUInt32 silc_hmac_len(SilcHmac hmac)
{
return hmac->hmac->len;
}
/* Sets the HMAC key used in the HMAC creation */
void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
- uint32 key_len)
+ SilcUInt32 key_len)
{
if (hmac->key) {
memset(hmac->key, 0, hmac->key_len);
uses the internal key set with silc_hmac_set_key. */
void silc_hmac_make(SilcHmac hmac, unsigned char *data,
- uint32 data_len, unsigned char *return_hash,
- uint32 *return_len)
+ SilcUInt32 data_len, unsigned char *return_hash,
+ SilcUInt32 *return_len)
{
SILC_LOG_DEBUG(("Making HMAC for message"));
key. The key is sent as argument to the function. */
void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
- uint32 data_len,
- unsigned char *key, uint32 key_len,
+ SilcUInt32 data_len,
+ unsigned char *key, SilcUInt32 key_len,
unsigned char *return_hash,
- uint32 *return_len)
+ SilcUInt32 *return_len)
{
SILC_LOG_DEBUG(("Making HMAC for message"));
routine allows these dangerous truncations. */
void silc_hmac_make_truncated(SilcHmac hmac, unsigned char *data,
- uint32 data_len,
- uint32 truncated_len,
+ SilcUInt32 data_len,
+ SilcUInt32 truncated_len,
unsigned char *return_hash)
{
unsigned char hvalue[20];
/* Same as above but with specific key */
void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
- uint32 key_len)
+ SilcUInt32 key_len)
{
SilcHash hash = hmac->hash;
/* Add data to be used in the MAC computation. */
void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcHash hash = hmac->hash;
hash->hash->update(hmac->hash_context, (unsigned char *)data, data_len);
/* Compute the final MAC. */
void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
- uint32 *return_len)
+ SilcUInt32 *return_len)
{
SilcHash hash = hmac->hash;
unsigned char mac[20];
***/
typedef struct {
char *name;
- uint32 len;
+ SilcUInt32 len;
} SilcHmacObject;
/* Marks for all hmacs. This can be used in silc_hmac_unregister
*
* SYNOPSIS
*
- * uint32 silc_hmac_len(SilcHmac hmac);
+ * SilcUInt32 silc_hmac_len(SilcHmac hmac);
*
* DESCRIPTION
*
* Returns the length of the MAC that the HMAC will produce.
*
***/
-uint32 silc_hmac_len(SilcHmac hmac);
+SilcUInt32 silc_hmac_len(SilcHmac hmac);
/****f* silccrypt/SilcHMACAPI/silc_hmac_get_hash
*
* SYNOPSIS
*
* void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
- * uint32 key_len);
+ * SilcUInt32 key_len);
*
* DESCRIPTION
*
*
***/
void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
- uint32 key_len);
+ SilcUInt32 key_len);
/****f* silccrypt/SilcHMACAPI/silc_hmac_make
*
* SYNOPSIS
*
* void silc_hmac_make(SilcHmac hmac, unsigned char *data,
- * uint32 data_len, unsigned char *return_hash,
- * uint32 *return_len);
+ * SilcUInt32 data_len, unsigned char *return_hash,
+ * SilcUInt32 *return_len);
*
* DESCRIPTION
*
*
***/
void silc_hmac_make(SilcHmac hmac, unsigned char *data,
- uint32 data_len, unsigned char *return_hash,
- uint32 *return_len);
+ SilcUInt32 data_len, unsigned char *return_hash,
+ SilcUInt32 *return_len);
/****f* silccrypt/SilcHMACAPI/silc_hmac_make_with_key
*
* SYNOPSIS
*
* void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
- * uint32 data_len,
- * unsigned char *key, uint32 key_len,
+ * SilcUInt32 data_len,
+ * unsigned char *key, SilcUInt32 key_len,
* unsigned char *return_hash,
- * uint32 *return_len);
+ * SilcUInt32 *return_len);
*
* DESCRIPTION
*
*
***/
void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
- uint32 data_len,
- unsigned char *key, uint32 key_len,
+ SilcUInt32 data_len,
+ unsigned char *key, SilcUInt32 key_len,
unsigned char *return_hash,
- uint32 *return_len);
+ SilcUInt32 *return_len);
/****f* silccrypt/SilcHMACAPI/silc_hmac_make_truncated
*
*
* void silc_hmac_make_truncated(SilcHmac hmac,
* unsigned char *data,
- * uint32 data_len,
- * uint32 truncated_len,
+ * SilcUInt32 data_len,
+ * SilcUInt32 truncated_len,
* unsigned char *return_hash);
*
* DESCRIPTION
***/
void silc_hmac_make_truncated(SilcHmac hmac,
unsigned char *data,
- uint32 data_len,
- uint32 truncated_len,
+ SilcUInt32 data_len,
+ SilcUInt32 truncated_len,
unsigned char *return_hash);
/****f* silccrypt/SilcHMACAPI/silc_hmac_init
* SYNOPSIS
*
* void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
- * uint32 key_len);
+ * SilcUInt32 key_len);
*
* DESCRIPTION
*
*
***/
void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
- uint32 key_len);
+ SilcUInt32 key_len);
/****f* silccrypt/SilcHMACAPI/silc_hmac_update
*
* SYNOPSIS
*
* void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
- * uint32 data_len);
+ * SilcUInt32 data_len);
*
* DESCRIPTION
*
* EXAMPLE
*
* unsigned char mac[20];
- * uint32 mac_len;
+ * SilcUInt32 mac_len;
*
* silc_hmac_init(hmac);
* silc_hmac_update(hmac, data, data_len);
*
***/
void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
/****f* silccrypt/SilcHMACAPI/silc_hmac_final
*
* SYNOPSIS
*
* void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
- * uint32 *return_len);
+ * SilcUInt32 *return_len);
*
* DESCRIPTION
*
*
***/
void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
- uint32 *return_len);
+ SilcUInt32 *return_len);
#endif
/* Returns the length of the key */
-uint32 silc_pkcs_get_key_len(SilcPKCS pkcs)
+SilcUInt32 silc_pkcs_get_key_len(SilcPKCS pkcs)
{
return pkcs->key_len;
}
/* Returns SILC style public key */
-unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, uint32 *len)
+unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, SilcUInt32 *len)
{
return pkcs->pkcs->get_public_key(pkcs->context, len);
}
/* Returns SILC style private key */
-unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, uint32 *len)
+unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, SilcUInt32 *len)
{
return pkcs->pkcs->get_private_key(pkcs->context, len);
}
/* Sets public key from SilcPublicKey. */
-uint32 silc_pkcs_public_key_set(SilcPKCS pkcs, SilcPublicKey public_key)
+SilcUInt32 silc_pkcs_public_key_set(SilcPKCS pkcs, SilcPublicKey public_key)
{
pkcs->key_len = pkcs->pkcs->set_public_key(pkcs->context, public_key->pk,
public_key->pk_len);
/* Sets public key from data. */
-uint32 silc_pkcs_public_key_data_set(SilcPKCS pkcs, unsigned char *pk,
- uint32 pk_len)
+SilcUInt32 silc_pkcs_public_key_data_set(SilcPKCS pkcs, unsigned char *pk,
+ SilcUInt32 pk_len)
{
pkcs->key_len = pkcs->pkcs->set_public_key(pkcs->context, pk, pk_len);
return pkcs->key_len;
/* Sets private key from data. */
int silc_pkcs_private_key_data_set(SilcPKCS pkcs, unsigned char *prv,
- uint32 prv_len)
+ SilcUInt32 prv_len)
{
return pkcs->pkcs->set_private_key(pkcs->context, prv, prv_len);
}
/* Encrypts */
-int silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len)
+int silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->encrypt(pkcs->context, src, src_len, dst, dst_len);
}
/* Decrypts */
-int silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len)
+int silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->decrypt(pkcs->context, src, src_len, dst, dst_len);
}
/* Generates signature */
-int silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len)
+int silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->sign(pkcs->context, src, src_len, dst, dst_len);
}
/* Verifies signature */
int silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
- uint32 signature_len, unsigned char *data,
- uint32 data_len)
+ SilcUInt32 signature_len, unsigned char *data,
+ SilcUInt32 data_len)
{
return pkcs->pkcs->verify(pkcs->context, signature, signature_len,
data, data_len);
/* Generates signature with hash. The hash is signed. */
int silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
- unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len)
+ unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len)
{
unsigned char hashr[32];
- uint32 hash_len;
+ SilcUInt32 hash_len;
int ret;
silc_hash_make(hash, src, src_len, hashr);
int silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *signature,
- uint32 signature_len,
+ SilcUInt32 signature_len,
unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
unsigned char hashr[32];
- uint32 hash_len;
+ SilcUInt32 hash_len;
int ret;
silc_hash_make(hash, data, data_len, hashr);
{
SilcBuffer buf;
char *identifier;
- uint32 len, tlen = 0;
+ SilcUInt32 len, tlen = 0;
if (!username || !host)
return NULL;
SilcPublicKey silc_pkcs_public_key_alloc(char *name, char *identifier,
unsigned char *pk,
- uint32 pk_len)
+ SilcUInt32 pk_len)
{
SilcPublicKey public_key;
duplicated. */
SilcPrivateKey silc_pkcs_private_key_alloc(char *name, unsigned char *prv,
- uint32 prv_len)
+ SilcUInt32 prv_len)
{
SilcPrivateKey private_key;
data. */
unsigned char *
-silc_pkcs_public_key_encode(SilcPublicKey public_key, uint32 *len)
+silc_pkcs_public_key_encode(SilcPublicKey public_key, SilcUInt32 *len)
{
SilcBuffer buf;
unsigned char *ret;
/* Encodes SILC style public key. Returns the encoded data. */
unsigned char *
-silc_pkcs_public_key_data_encode(unsigned char *pk, uint32 pk_len,
+silc_pkcs_public_key_data_encode(unsigned char *pk, SilcUInt32 pk_len,
char *pkcs, char *identifier,
- uint32 *len)
+ SilcUInt32 *len)
{
SilcBuffer buf;
unsigned char *ret;
- uint32 totlen;
+ SilcUInt32 totlen;
totlen = 4 + 2 + strlen(pkcs) + 2 + strlen(identifier) + pk_len;
buf = silc_buffer_alloc(totlen);
/* Decodes SILC style public key. Returns TRUE if the decoding was
successful. Allocates new public key as well. */
-int silc_pkcs_public_key_decode(unsigned char *data, uint32 data_len,
+int silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPublicKey *public_key)
{
SilcBuffer buf;
SilcPKCS alg;
- uint16 pkcs_len, identifier_len;
- uint32 totlen, key_len;
+ SilcUInt16 pkcs_len, identifier_len;
+ SilcUInt32 totlen, key_len;
unsigned char *pkcs_name = NULL, *ident = NULL, *key_data = NULL;
int ret;
/* Encodes SILC private key from SilcPrivateKey. Returns the encoded data. */
unsigned char *
-silc_pkcs_private_key_encode(SilcPrivateKey private_key, uint32 *len)
+silc_pkcs_private_key_encode(SilcPrivateKey private_key, SilcUInt32 *len)
{
SilcBuffer buf;
unsigned char *ret;
- uint32 totlen;
+ SilcUInt32 totlen;
totlen = 2 + strlen(private_key->name) + private_key->prv_len;
buf = silc_buffer_alloc(totlen);
/* Encodes SILC private key. Returns the encoded data. */
unsigned char *
-silc_pkcs_private_key_data_encode(unsigned char *prv, uint32 prv_len,
- char *pkcs, uint32 *len)
+silc_pkcs_private_key_data_encode(unsigned char *prv, SilcUInt32 prv_len,
+ char *pkcs, SilcUInt32 *len)
{
SilcBuffer buf;
unsigned char *ret;
- uint32 totlen;
+ SilcUInt32 totlen;
totlen = 2 + strlen(pkcs) + prv_len;
buf = silc_buffer_alloc(totlen);
/* Decodes SILC style public key. Returns TRUE if the decoding was
successful. Allocates new private key as well. */
-int silc_pkcs_private_key_decode(unsigned char *data, uint32 data_len,
+int silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPrivateKey *private_key)
{
SilcBuffer buf;
SilcPKCS alg;
- uint16 pkcs_len;
- uint32 key_len;
+ SilcUInt16 pkcs_len;
+ SilcUInt32 key_len;
unsigned char *pkcs_name = NULL, *key_data = NULL;
int ret;
static int silc_pkcs_save_public_key_internal(char *filename,
unsigned char *data,
- uint32 data_len,
- uint32 encoding)
+ SilcUInt32 data_len,
+ SilcUInt32 encoding)
{
SilcBuffer buf;
- uint32 len;
+ SilcUInt32 len;
switch(encoding) {
case SILC_PKCS_FILE_BIN:
/* Saves public key into file */
int silc_pkcs_save_public_key(char *filename, SilcPublicKey public_key,
- uint32 encoding)
+ SilcUInt32 encoding)
{
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
data = silc_pkcs_public_key_encode(public_key, &data_len);
return silc_pkcs_save_public_key_internal(filename, data, data_len,
/* Saves public key into file */
int silc_pkcs_save_public_key_data(char *filename, unsigned char *data,
- uint32 data_len,
- uint32 encoding)
+ SilcUInt32 data_len,
+ SilcUInt32 encoding)
{
return silc_pkcs_save_public_key_internal(filename, data, data_len,
encoding);
static int silc_pkcs_save_private_key_internal(char *filename,
unsigned char *data,
- uint32 data_len,
- uint32 encoding)
+ SilcUInt32 data_len,
+ SilcUInt32 encoding)
{
SilcBuffer buf;
- uint32 len;
+ SilcUInt32 len;
switch(encoding) {
case SILC_PKCS_FILE_BIN:
int silc_pkcs_save_private_key(char *filename, SilcPrivateKey private_key,
unsigned char *passphrase,
- uint32 encoding)
+ SilcUInt32 encoding)
{
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
data = silc_pkcs_private_key_encode(private_key, &data_len);
return silc_pkcs_save_private_key_internal(filename, data, data_len,
/* XXX The buffer should be encrypted if passphrase is provided. */
int silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
unsigned char *passphrase,
- uint32 encoding)
+ SilcUInt32 encoding)
{
return silc_pkcs_save_private_key_internal(filename, data, data_len,
encoding);
is loading was successful. */
int silc_pkcs_load_public_key(char *filename, SilcPublicKey *public_key,
- uint32 encoding)
+ SilcUInt32 encoding)
{
unsigned char *cp, *old, *data, byte;
- uint32 i, data_len, len;
+ SilcUInt32 i, data_len, len;
old = data = silc_file_readfile(filename, &data_len);
if (!data)
/* XXX Should support encrypted private key files */
int silc_pkcs_load_private_key(char *filename, SilcPrivateKey *private_key,
- uint32 encoding)
+ SilcUInt32 encoding)
{
unsigned char *cp, *old, *data, byte;
- uint32 i, data_len, len;
+ SilcUInt32 i, data_len, len;
old = data = silc_file_readfile(filename, &data_len);
if (!data)
any PKCS in SILC. */
typedef struct SilcPKCSObjectStruct {
char *name;
- int (*init)(void *, uint32, SilcRng);
+ int (*init)(void *, SilcUInt32, SilcRng);
void (*clear_keys)(void *);
- unsigned char *(*get_public_key)(void *, uint32 *);
- unsigned char *(*get_private_key)(void *, uint32 *);
- uint32 (*set_public_key)(void *, unsigned char *, uint32);
- int (*set_private_key)(void *, unsigned char *, uint32);
- uint32 (*context_len)();
- int (*encrypt)(void *, unsigned char *, uint32,
- unsigned char *, uint32 *);
- int (*decrypt)(void *, unsigned char *, uint32,
- unsigned char *, uint32 *);
- int (*sign)(void *, unsigned char *, uint32,
- unsigned char *, uint32 *);
- int (*verify)(void *, unsigned char *, uint32,
- unsigned char *, uint32);
+ unsigned char *(*get_public_key)(void *, SilcUInt32 *);
+ unsigned char *(*get_private_key)(void *, SilcUInt32 *);
+ SilcUInt32 (*set_public_key)(void *, unsigned char *, SilcUInt32);
+ int (*set_private_key)(void *, unsigned char *, SilcUInt32);
+ SilcUInt32 (*context_len)();
+ int (*encrypt)(void *, unsigned char *, SilcUInt32,
+ unsigned char *, SilcUInt32 *);
+ int (*decrypt)(void *, unsigned char *, SilcUInt32,
+ unsigned char *, SilcUInt32 *);
+ int (*sign)(void *, unsigned char *, SilcUInt32,
+ unsigned char *, SilcUInt32 *);
+ int (*verify)(void *, unsigned char *, SilcUInt32,
+ unsigned char *, SilcUInt32);
} SilcPKCSObject;
/* The main SILC PKCS structure. Use SilcPKCS instead of SilcPKCSStruct.
typedef struct SilcPKCSStruct {
void *context;
SilcPKCSObject *pkcs;
- uint32 key_len;
+ SilcUInt32 key_len;
- uint32 (*get_key_len)(struct SilcPKCSStruct *);
+ SilcUInt32 (*get_key_len)(struct SilcPKCSStruct *);
} *SilcPKCS;
/* SILC style public key object. Public key is read from file to this
object. Public keys received from network must be in this format as
well. */
typedef struct {
- uint32 len;
+ SilcUInt32 len;
char *name;
char *identifier;
unsigned char *pk;
- uint32 pk_len;
+ SilcUInt32 pk_len;
} *SilcPublicKey;
/* SILC style private key object. Private key is read from file to this
typedef struct {
char *name;
unsigned char *prv;
- uint32 prv_len;
+ SilcUInt32 prv_len;
} *SilcPrivateKey;
/* Decoded SILC Public Key identifier. Note that some of the fields
would look something like this:
#define SILC_PKCS_API_INIT(pkcs) \
- inline int silc_##pkcs##_init(void *context, uint32 keylen, \
+ inline int silc_##pkcs##_init(void *context, SilcUInt32 keylen, \
void *p1, void *p2)
Now we wouldn't have to send the SilcRng object since the primes are
*/
#define SILC_PKCS_API_INIT(pkcs) \
-int silc_##pkcs##_init(void *context, uint32 keylen, \
+int silc_##pkcs##_init(void *context, SilcUInt32 keylen, \
SilcRng rng)
#define SILC_PKCS_API_CLEAR_KEYS(pkcs) \
void silc_##pkcs##_clear_keys(void *context)
#define SILC_PKCS_API_GET_PUBLIC_KEY(pkcs) \
unsigned char *silc_##pkcs##_get_public_key(void *context, \
- uint32 *ret_len)
+ SilcUInt32 *ret_len)
#define SILC_PKCS_API_GET_PRIVATE_KEY(pkcs) \
unsigned char *silc_##pkcs##_get_private_key(void *context, \
- uint32 *ret_len)
+ SilcUInt32 *ret_len)
#define SILC_PKCS_API_SET_PUBLIC_KEY(pkcs) \
-uint32 silc_##pkcs##_set_public_key(void *context, unsigned char *key_data, \
- uint32 key_len)
+SilcUInt32 silc_##pkcs##_set_public_key(void *context, unsigned char *key_data, \
+ SilcUInt32 key_len)
#define SILC_PKCS_API_SET_PRIVATE_KEY(pkcs) \
int silc_##pkcs##_set_private_key(void *context, unsigned char *key_data, \
- uint32 key_len)
+ SilcUInt32 key_len)
#define SILC_PKCS_API_CONTEXT_LEN(pkcs) \
-uint32 silc_##pkcs##_context_len()
+SilcUInt32 silc_##pkcs##_context_len()
#define SILC_PKCS_API_ENCRYPT(pkcs) \
int silc_##pkcs##_encrypt(void *context, \
unsigned char *src, \
- uint32 src_len, \
+ SilcUInt32 src_len, \
unsigned char *dst, \
- uint32 *dst_len)
+ SilcUInt32 *dst_len)
#define SILC_PKCS_API_DECRYPT(pkcs) \
int silc_##pkcs##_decrypt(void *context, \
unsigned char *src, \
- uint32 src_len, \
+ SilcUInt32 src_len, \
unsigned char *dst, \
- uint32 *dst_len)
+ SilcUInt32 *dst_len)
#define SILC_PKCS_API_SIGN(pkcs) \
int silc_##pkcs##_sign(void *context, \
unsigned char *src, \
- uint32 src_len, \
+ SilcUInt32 src_len, \
unsigned char *dst, \
- uint32 *dst_len)
+ SilcUInt32 *dst_len)
#define SILC_PKCS_API_VERIFY(pkcs) \
int silc_##pkcs##_verify(void *context, \
unsigned char *signature, \
- uint32 signature_len, \
+ SilcUInt32 signature_len, \
unsigned char *data, \
- uint32 data_len)
+ SilcUInt32 data_len)
/* Prototypes */
bool silc_pkcs_register(SilcPKCSObject *pkcs);
void silc_pkcs_free(SilcPKCS pkcs);
int silc_pkcs_is_supported(const unsigned char *name);
char *silc_pkcs_get_supported(void);
-uint32 silc_pkcs_get_key_len(SilcPKCS self);
-unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, uint32 *len);
-unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, uint32 *len);
-uint32 silc_pkcs_public_key_set(SilcPKCS pkcs, SilcPublicKey public_key);
-uint32 silc_pkcs_public_key_data_set(SilcPKCS pkcs, unsigned char *pk,
- uint32 pk_len);
+SilcUInt32 silc_pkcs_get_key_len(SilcPKCS self);
+unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, SilcUInt32 *len);
+unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, SilcUInt32 *len);
+SilcUInt32 silc_pkcs_public_key_set(SilcPKCS pkcs, SilcPublicKey public_key);
+SilcUInt32 silc_pkcs_public_key_data_set(SilcPKCS pkcs, unsigned char *pk,
+ SilcUInt32 pk_len);
int silc_pkcs_private_key_set(SilcPKCS pkcs, SilcPrivateKey private_key);
int silc_pkcs_private_key_data_set(SilcPKCS pkcs, unsigned char *prv,
- uint32 prv_len);
-int silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len);
-int silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len);
-int silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len);
+ SilcUInt32 prv_len);
+int silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len);
+int silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len);
+int silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len);
int silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
- uint32 signature_len, unsigned char *data,
- uint32 data_len);
+ SilcUInt32 signature_len, unsigned char *data,
+ SilcUInt32 data_len);
int silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
- unsigned char *src, uint32 src_len,
- unsigned char *dst, uint32 *dst_len);
+ unsigned char *src, SilcUInt32 src_len,
+ unsigned char *dst, SilcUInt32 *dst_len);
int silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *signature,
- uint32 signature_len,
+ SilcUInt32 signature_len,
unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
char *silc_pkcs_encode_identifier(char *username, char *host, char *realname,
char *email, char *org, char *country);
SilcPublicKeyIdentifier silc_pkcs_decode_identifier(char *identifier);
void silc_pkcs_free_identifier(SilcPublicKeyIdentifier identifier);
SilcPublicKey silc_pkcs_public_key_alloc(char *name, char *identifier,
unsigned char *pk,
- uint32 pk_len);
+ SilcUInt32 pk_len);
void silc_pkcs_public_key_free(SilcPublicKey public_key);
SilcPrivateKey silc_pkcs_private_key_alloc(char *name, unsigned char *prv,
- uint32 prv_len);
+ SilcUInt32 prv_len);
void silc_pkcs_private_key_free(SilcPrivateKey private_key);
unsigned char *
-silc_pkcs_public_key_encode(SilcPublicKey public_key, uint32 *len);
+silc_pkcs_public_key_encode(SilcPublicKey public_key, SilcUInt32 *len);
unsigned char *
-silc_pkcs_public_key_data_encode(unsigned char *pk, uint32 pk_len,
+silc_pkcs_public_key_data_encode(unsigned char *pk, SilcUInt32 pk_len,
char *pkcs, char *identifier,
- uint32 *len);
-int silc_pkcs_public_key_decode(unsigned char *data, uint32 data_len,
+ SilcUInt32 *len);
+int silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPublicKey *public_key);
bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2);
unsigned char *
-silc_pkcs_private_key_encode(SilcPrivateKey private_key, uint32 *len);
+silc_pkcs_private_key_encode(SilcPrivateKey private_key, SilcUInt32 *len);
unsigned char *
-silc_pkcs_private_key_data_encode(unsigned char *prv, uint32 prv_len,
- char *pkcs, uint32 *len);
-int silc_pkcs_private_key_decode(unsigned char *data, uint32 data_len,
+silc_pkcs_private_key_data_encode(unsigned char *prv, SilcUInt32 prv_len,
+ char *pkcs, SilcUInt32 *len);
+int silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPrivateKey *private_key);
int silc_pkcs_save_public_key(char *filename, SilcPublicKey public_key,
- uint32 encoding);
+ SilcUInt32 encoding);
int silc_pkcs_save_public_key_data(char *filename, unsigned char *data,
- uint32 data_len,
- uint32 encoding);
+ SilcUInt32 data_len,
+ SilcUInt32 encoding);
int silc_pkcs_save_private_key(char *filename, SilcPrivateKey private_key,
unsigned char *passphrase,
- uint32 encoding);
+ SilcUInt32 encoding);
int silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
unsigned char *passphrase,
- uint32 encoding);
+ SilcUInt32 encoding);
int silc_pkcs_load_public_key(char *filename, SilcPublicKey *public_key,
- uint32 encoding);
+ SilcUInt32 encoding);
int silc_pkcs_load_private_key(char *filename, SilcPrivateKey *private_key,
- uint32 encoding);
+ SilcUInt32 encoding);
#endif
/* Byte size of the random data pool. */
#define SILC_RNG_POOLSIZE 1024
-static uint32 silc_rng_get_position(SilcRng rng);
+static SilcUInt32 silc_rng_get_position(SilcRng rng);
static void silc_rng_stir_pool(SilcRng rng);
-static void silc_rng_xor(SilcRng rng, uint32 val, unsigned int pos);
+static void silc_rng_xor(SilcRng rng, SilcUInt32 val, unsigned int pos);
static void silc_rng_exec_command(SilcRng rng, char *command);
static void silc_rng_get_hard_noise(SilcRng rng);
static void silc_rng_get_medium_noise(SilcRng rng);
from the same point of the pool. Short description of the fields
following.
- uint32 low
- uint32 pos
+ SilcUInt32 low
+ SilcUInt32 pos
The index for the random pool buffer. Lowest and current
positions.
*/
typedef struct SilcRngStateContext {
- uint32 low;
- uint32 pos;
+ SilcUInt32 low;
+ SilcUInt32 pos;
struct SilcRngStateContext *next;
} *SilcRngState;
random pool. This is allocated when RNG object is allocated and
free'd when RNG object is free'd.
- uint8 threshold
+ SilcUInt8 threshold
Threshold to indicate when it is required to acquire more
noise from the environment. More soft noise is acquired after
unsigned char key[64];
SilcRngState state;
SilcHash sha1;
- uint8 threshold;
+ SilcUInt8 threshold;
char *devrandom;
int fd_devurandom;
};
#ifndef SILC_WIN32
struct tms ptime;
#endif
- uint32 pos;
+ SilcUInt32 pos;
pos = silc_rng_get_position(rng);
/* This function adds the contents of the buffer as noise into random
pool. After adding the noise the pool is stirred. */
-void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, uint32 len)
+void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, SilcUInt32 len)
{
- uint32 i, pos;
+ SilcUInt32 i, pos;
pos = silc_rng_get_position(rng);
/* XOR's data into the pool */
-static void silc_rng_xor(SilcRng rng, uint32 val, unsigned int pos)
+static void silc_rng_xor(SilcRng rng, SilcUInt32 val, unsigned int pos)
{
assert(rng != NULL);
rng->pool[pos] ^= val + val;
static void silc_rng_stir_pool(SilcRng rng)
{
int i;
- uint32 iv[5];
+ SilcUInt32 iv[5];
/* Get the IV */
memcpy(iv, &rng->pool[16], sizeof(iv));
/* Returns next position where data is fetched from the pool or
put to the pool. */
-static uint32 silc_rng_get_position(SilcRng rng)
+static SilcUInt32 silc_rng_get_position(SilcRng rng)
{
SilcRngState next;
- uint32 pos;
+ SilcUInt32 pos;
next = rng->state->next;
/* Returns random byte. */
-uint8 silc_rng_get_byte(SilcRng rng)
+SilcUInt8 silc_rng_get_byte(SilcRng rng)
{
rng->threshold++;
/* Returns 16 bit random number */
-uint16 silc_rng_get_rn16(SilcRng rng)
+SilcUInt16 silc_rng_get_rn16(SilcRng rng)
{
unsigned char rn[2];
- uint16 num;
+ SilcUInt16 num;
rn[0] = silc_rng_get_byte(rng);
rn[1] = silc_rng_get_byte(rng);
/* Returns 32 bit random number */
-uint32 silc_rng_get_rn32(SilcRng rng)
+SilcUInt32 silc_rng_get_rn32(SilcRng rng)
{
unsigned char rn[4];
- uint16 num;
+ SilcUInt16 num;
rn[0] = silc_rng_get_byte(rng);
rn[1] = silc_rng_get_byte(rng);
/* Returns random number string. Returned string is in HEX format. */
-unsigned char *silc_rng_get_rn_string(SilcRng rng, uint32 len)
+unsigned char *silc_rng_get_rn_string(SilcRng rng, SilcUInt32 len)
{
int i;
unsigned char *string;
/* Returns random number binary data. */
-unsigned char *silc_rng_get_rn_data(SilcRng rng, uint32 len)
+unsigned char *silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len)
{
int i;
unsigned char *data;
/* These are analogous to the functions above. */
-uint8 silc_rng_global_get_byte(void)
+SilcUInt8 silc_rng_global_get_byte(void)
{
return global_rng ? silc_rng_get_byte(global_rng) : 0;
}
/* Return random byte as fast as possible. Reads from /dev/urandom if
available. If not then return from normal RNG (not so fast). */
-uint8 silc_rng_global_get_byte_fast(void)
+SilcUInt8 silc_rng_global_get_byte_fast(void)
{
#ifndef SILC_WIN32
unsigned char buf[1];
#endif
}
-uint16 silc_rng_global_get_rn16(void)
+SilcUInt16 silc_rng_global_get_rn16(void)
{
return global_rng ? silc_rng_get_rn16(global_rng) : 0;
}
-uint32 silc_rng_global_get_rn32(void)
+SilcUInt32 silc_rng_global_get_rn32(void)
{
return global_rng ? silc_rng_get_rn32(global_rng) : 0;
}
-unsigned char *silc_rng_global_get_rn_string(uint32 len)
+unsigned char *silc_rng_global_get_rn_string(SilcUInt32 len)
{
return global_rng ? silc_rng_get_rn_string(global_rng, len) : NULL;
}
-unsigned char *silc_rng_global_get_rn_data(uint32 len)
+unsigned char *silc_rng_global_get_rn_data(SilcUInt32 len)
{
return global_rng ? silc_rng_get_rn_data(global_rng, len) : NULL;
}
-void silc_rng_global_add_noise(unsigned char *buffer, uint32 len)
+void silc_rng_global_add_noise(unsigned char *buffer, SilcUInt32 len)
{
if (global_rng)
silc_rng_add_noise(global_rng, buffer, len);
*
* SYNOPSIS
*
- * uint8 silc_rng_get_byte(SilcRng rng);
+ * SilcUInt8 silc_rng_get_byte(SilcRng rng);
*
* DESCRIPTION
*
* Returns one 8-bit random byte from the random number generator.
*
***/
-uint8 silc_rng_get_byte(SilcRng rng);
+SilcUInt8 silc_rng_get_byte(SilcRng rng);
/****f* silccrypt/SilcRNGAPI/silc_rng_get_rn16
*
* SYNOPSIS
*
- * uint16 silc_rng_get_rn16(SilcRng rng);
+ * SilcUInt16 silc_rng_get_rn16(SilcRng rng);
*
* DESCRIPTION
*
* Returns one 16-bit random number from the random number generator.
*
***/
-uint16 silc_rng_get_rn16(SilcRng rng);
+SilcUInt16 silc_rng_get_rn16(SilcRng rng);
/****f* silccrypt/SilcRNGAPI/silc_rng_get_rn32
*
* SYNOPSIS
*
- * uint32 silc_rng_get_rn32(SilcRng rng);
+ * SilcUInt32 silc_rng_get_rn32(SilcRng rng);
*
* DESCRIPTION
*
* Returns one 32-bit random number from the random number generator.
*
***/
-uint32 silc_rng_get_rn32(SilcRng rng);
+SilcUInt32 silc_rng_get_rn32(SilcRng rng);
/****f* silccrypt/SilcRNGAPI/silc_rng_get_rn_string
*
* SYNOPSIS
*
- * unsigned char *silc_rng_get_rn_string(SilcRng rng, uint32 len);
+ * unsigned char *silc_rng_get_rn_string(SilcRng rng, SilcUInt32 len);
*
* DESCRIPTION
*
* The caller must free returned data buffer.
*
***/
-unsigned char *silc_rng_get_rn_string(SilcRng rng, uint32 len);
+unsigned char *silc_rng_get_rn_string(SilcRng rng, SilcUInt32 len);
/****f* silccrypt/SilcRNGAPI/silc_rng_get_rn_data
*
* SYNOPSIS
*
- * unsigned char *silc_rng_get_rn_data(SilcRng rng, uint32 len);
+ * unsigned char *silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len);
*
* DESCRIPTION
*
* caller must free returned data buffer.
*
***/
-unsigned char *silc_rng_get_rn_data(SilcRng rng, uint32 len);
+unsigned char *silc_rng_get_rn_data(SilcRng rng, SilcUInt32 len);
/****f* silccrypt/SilcRNGAPI/silc_rng_add_noise
*
* SYNOPSIS
*
- * void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, uint32 len);
+ * void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, SilcUInt32 len);
*
* DESCRIPTION
*
* is restirred (reseeded) when this function is called.
*
***/
-void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, uint32 len);
+void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, SilcUInt32 len);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_init
*
*
* SYNOPSIS
*
- * uint8 silc_rng_global_get_byte(void);
+ * SilcUInt8 silc_rng_global_get_byte(void);
*
* DESCRIPTION
*
* Returns one 8-bit random byte from the random number generator.
*
***/
-uint8 silc_rng_global_get_byte(void);
+SilcUInt8 silc_rng_global_get_byte(void);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_byte_fast
*
* SYNOPSIS
*
- * uint8 silc_rng_global_get_byte_fast(void);
+ * SilcUInt8 silc_rng_global_get_byte_fast(void);
*
* DESCRIPTION
*
* the byte from SILC RNG and is effectively same as silc_rng_get_byte.
*
***/
-uint8 silc_rng_global_get_byte_fast(void);
+SilcUInt8 silc_rng_global_get_byte_fast(void);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_rn16
*
* SYNOPSIS
*
- * uint16 silc_rng_global_get_rn16(void);
+ * SilcUInt16 silc_rng_global_get_rn16(void);
*
* DESCRIPTION
*
* Returns one 16-bit random number from the random number generator.
*
***/
-uint16 silc_rng_global_get_rn16(void);
+SilcUInt16 silc_rng_global_get_rn16(void);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_rn32
*
* SYNOPSIS
*
- * uint32 silc_rng_global_get_rn32(void);
+ * SilcUInt32 silc_rng_global_get_rn32(void);
*
* DESCRIPTION
*
* Returns one 32-bit random number from the random number generator.
*
***/
-uint32 silc_rng_global_get_rn32(void);
+SilcUInt32 silc_rng_global_get_rn32(void);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_rn_string
*
* SYNOPSIS
*
- * unsigned char *silc_rng_global_get_rn_string(uint32 len);
+ * unsigned char *silc_rng_global_get_rn_string(SilcUInt32 len);
*
* DESCRIPTION
*
* The caller must free returned data buffer.
*
***/
-unsigned char *silc_rng_global_get_rn_string(uint32 len);
+unsigned char *silc_rng_global_get_rn_string(SilcUInt32 len);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_rn_data
*
* SYNOPSIS
*
- * unsigned char *silc_rng_global_get_rn_data(uint32 len);
+ * unsigned char *silc_rng_global_get_rn_data(SilcUInt32 len);
*
* DESCRIPTION
*
* caller must free returned data buffer.
*
***/
-unsigned char *silc_rng_global_get_rn_data(uint32 len);
+unsigned char *silc_rng_global_get_rn_data(SilcUInt32 len);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_add_noise
*
* SYNOPSIS
*
- * void silc_rng_global_add_noise(unsigned char *buffer, uint32 len);
+ * void silc_rng_global_add_noise(unsigned char *buffer, SilcUInt32 len);
*
* DESCRIPTION
*
*
***/
-void silc_rng_global_add_noise(unsigned char *buffer, uint32 len);
+void silc_rng_global_add_noise(unsigned char *buffer, SilcUInt32 len);
#endif
SILC_CIPHER_API_SET_KEY(twofish)
{
- uint32 k[8];
+ SilcUInt32 k[8];
SILC_GET_WORD_KEY(key, k, keylen);
twofish_set_key((TwofishContext *)context, k, keylen);
SILC_CIPHER_API_ENCRYPT_CBC(twofish)
{
- uint32 tiv[4];
+ SilcUInt32 tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
SILC_CIPHER_API_DECRYPT_CBC(twofish)
{
- uint32 tmp[4], tmp2[4], tiv[4];
+ SilcUInt32 tmp[4], tmp2[4], tiv[4];
int i;
SILC_CBC_GET_IV(tiv, iv);
mpz_set(dst, src);
}
-void silc_mp_set_ui(SilcMPInt *dst, uint32 ui)
+void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui)
{
mpz_set_ui(dst, ui);
}
-void silc_mp_set_si(SilcMPInt *dst, int32 si)
+void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si)
{
mpz_set_si(dst, si);
}
mpz_set_str(dst, str, base);
}
-uint32 silc_mp_get_ui(SilcMPInt *mp)
+SilcUInt32 silc_mp_get_ui(SilcMPInt *mp)
{
- return (uint32)mpz_get_ui(mp);
+ return (SilcUInt32)mpz_get_ui(mp);
}
char *silc_mp_get_str(char *str, SilcMPInt *mp, int base)
mpz_add(dst, mp1, mp2);
}
-void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_add_ui(dst, mp1, ui);
}
mpz_sub(dst, mp1, mp2);
}
-void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_sub_ui(dst, mp1, ui);
}
mpz_mul(dst, mp1, mp2);
}
-void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_mul_ui(dst, mp1, ui);
}
-void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
mpz_mul_2exp(dst, mp1, exp);
}
mpz_div(dst, mp1, mp2);
}
-void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_div_ui(dst, mp1, ui);
}
mpz_mod(r, mp1, mp2);
}
-void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
mpz_fdiv_q_2exp(dst, mp1, exp);
}
void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1,
- uint32 exp)
+ SilcUInt32 exp)
{
if (q)
mpz_fdiv_q_2exp(q, mp1, exp);
mpz_mod(dst, mp1, mp2);
}
-void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_mod_ui(dst, mp1, ui);
}
-void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mpz_mod_2exp(dst, mp1, ui);
}
void silc_mp_pow(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp)
{
- uint32 uiexp = mpz_get_ui(exp);
+ SilcUInt32 uiexp = mpz_get_ui(exp);
mpz_pow_ui(dst, mp1, uiexp);
}
-void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
mpz_pow_ui(dst, mp1, exp);
}
mpz_powm(dst, mp1, exp, mod);
}
-void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
+void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp,
SilcMPInt *mod)
{
mpz_powm_ui(dst, mp1, exp, mod);
return mpz_cmp(mp1, mp2);
}
-int silc_mp_cmp_si(SilcMPInt *mp1, int32 si)
+int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si)
{
return mpz_cmp_si(mp1, si);
}
-int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui)
+int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui)
{
return mpz_cmp_ui(mp1, ui);
}
(void)mp_copy(src, dst);
}
-void silc_mp_set_ui(SilcMPInt *dst, uint32 ui)
+void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui)
{
mp_set(dst, ui);
}
-void silc_mp_set_si(SilcMPInt *dst, int32 si)
+void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si)
{
(void)mp_set_int(dst, si);
}
(void)mp_read_variable_radix(dst, str, base);
}
-uint32 silc_mp_get_ui(SilcMPInt *mp)
+SilcUInt32 silc_mp_get_ui(SilcMPInt *mp)
{
- return (uint32)MP_DIGIT(mp, 0);
+ return (SilcUInt32)MP_DIGIT(mp, 0);
}
char *silc_mp_get_str(char *str, SilcMPInt *mp, int base)
(void)mp_add(mp1, mp2, dst);
}
-void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mp_add_d(mp1, ui, dst);
}
(void)mp_sub(mp1, mp2, dst);
}
-void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
(void)mp_sub_d(mp1, (mp_digit)ui, dst);
}
(void)mp_mul(mp1, mp2, dst);
}
-void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
(void)mp_mul_d(mp1, (mp_digit)ui, dst);
}
-void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
SilcMPInt tmp;
silc_mp_init(&tmp);
(void)mp_div(mp1, mp2, dst, NULL);
}
-void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
(void)mp_div_d(mp1, (mp_digit)ui, dst, NULL);
}
(void)mp_div(mp1, mp2, q, r);
}
-void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
SilcMPInt tmp;
silc_mp_init(&tmp);
}
void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1,
- uint32 exp)
+ SilcUInt32 exp)
{
if (q) {
(void)mp_2expt(q, (mp_digit)exp);
(void)mp_mod(mp1, mp2, dst);
}
-void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
mp_digit uidst;
(void)mp_mod_d(mp1, (mp_digit)ui, &uidst);
mp_set(dst, uidst);
}
-void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui)
+void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui)
{
SilcMPInt tmp;
silc_mp_init(&tmp);
(void)mp_expt(mp1, exp, dst);
}
-void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp)
+void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp)
{
(void)mp_expt_d(mp1, (mp_digit)exp, dst);
}
(void)mp_exptmod(mp1, exp, mod, dst);
}
-void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
+void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp,
SilcMPInt *mod)
{
(void)mp_exptmod_d(mp1, (mp_digit)exp, mod, dst);
return mp_cmp(mp1, mp2);
}
-int silc_mp_cmp_si(SilcMPInt *mp1, int32 si)
+int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si)
{
return mp_cmp_int(mp1, (long)si);
}
-int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui)
+int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui)
{
return mp_cmp_d(mp1, ui);
}
must be free'd by the caller. If `len' is provided the destination
buffer is allocated that large. If zero then the size is approximated. */
-unsigned char *silc_mp_mp2bin(SilcMPInt *val, uint32 len,
- uint32 *ret_len)
+unsigned char *silc_mp_mp2bin(SilcMPInt *val, SilcUInt32 len,
+ SilcUInt32 *ret_len)
{
int i;
- uint32 size;
+ SilcUInt32 size;
unsigned char *ret;
SilcMPInt tmp;
returned into `dst' and it's length to the `ret_len'. */
void silc_mp_mp2bin_noalloc(SilcMPInt *val, unsigned char *dst,
- uint32 dst_len)
+ SilcUInt32 dst_len)
{
int i;
- uint32 size = dst_len;
+ SilcUInt32 size = dst_len;
SilcMPInt tmp;
silc_mp_init(&tmp);
/* Decodes binary data into MP integer. The integer sent as argument
must be initialized. */
-void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcMPInt *ret)
+void silc_mp_bin2mp(unsigned char *data, SilcUInt32 len, SilcMPInt *ret)
{
int i;
*
* SYNOPSIS
*
- * int silc_math_gen_prime(SilcMPInt *prime, uint32 bits, bool verbose);
+ * int silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, bool verbose);
*
* DESCRIPTION
*
* about the progress of generation.
*
***/
-bool silc_math_gen_prime(SilcMPInt *prime, uint32 bits, bool verbose);
+bool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, bool verbose);
/****f* silcmath/SilcMathAPI/silc_math_prime_test
*
*
* SYNOPSIS
*
- * void silc_mp_set_ui(SilcMPInt *dst, uint32 ui);
+ * void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui);
*
* DESCRIPTION
*
* initialized.
*
***/
-void silc_mp_set_ui(SilcMPInt *dst, uint32 ui);
+void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_set_si
*
* SYNOPSIS
*
- * void silc_mp_set_si(SilcMPInt *dst, int32 si);
+ * void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si);
*
* DESCRIPTION
*
* already be initialized.
*
***/
-void silc_mp_set_si(SilcMPInt *dst, int32 si);
+void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si);
/****f* silcmath/SilcMPAPI/silc_mp_set_str
*
*
* SYNOPSIS
*
- * uint32 silc_mp_get_ui(SilcMPInt *mp);
+ * SilcUInt32 silc_mp_get_ui(SilcMPInt *mp);
*
* DESCRIPTION
*
* Returns the least significant unsigned word from `mp'.
*
***/
-uint32 silc_mp_get_ui(SilcMPInt *mp);
+SilcUInt32 silc_mp_get_ui(SilcMPInt *mp);
/****f* silcmath/SilcMPAPI/silc_mp_get_str
*
*
* SYNOPSIS
*
- * void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+ * void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* to `dst'.
*
***/
-void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_sub
*
*
* SYNOPSIS
*
- * void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+ * void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* to `dst'.
*
***/
-void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_mul
*
*
* SYNOPSIS
*
- * void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+ * void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* to `dst'.
*
***/
-void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_mul_2exp
*
* SYNOPSIS
*
- * void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
+ * void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp);
*
* DESCRIPTION
*
* `dst'. This is equivalent to dst = mp1 * (2 ^ exp).
*
***/
-void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
+void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp);
/****f* silcmath/SilcMPAPI/silc_mp_sqrt
*
*
* SYNOPSIS
*
- * void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+ * void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* `dst'. This is equivalent to dst = mp1 / ui;
*
***/
-void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_div_qr
*
* This is equivalent to dst = mp1 / (2 ^ exp).
*
***/
-void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
+void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp);
/****f* silcmath/SilcMPAPI/silc_mp_div_2exp_qr
*
* SYNOPSIS
*
* void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1,
- * uint32 exp);
+ * SilcUInt32 exp);
*
* DESCRIPTION
*
*
***/
void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1,
- uint32 exp);
+ SilcUInt32 exp);
/****f* silcmath/SilcMPAPI/silc_mp_mod
*
*
* SYNOPSIS
*
- * void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+ * void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* to dst = mp1 mod ui.
*
***/
-void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_mod_2exp
*
* function returns the remainder as well.
*
***/
-void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, uint32 ui);
+void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_pow
*
*
* SYNOPSIS
*
- * void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
+ * void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp);
*
* DESCRIPTION
*
* equivalent to dst = mp1 ^ exp.
*
***/
-void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp);
+void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp);
/****f* silcmath/SilcMPAPI/silc_mp_pow_mod
*
*
* SYNOPSIS
*
- * void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
+ * void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp,
* SilcMPInt *mod);
*
* DESCRIPTION
* This is equivalent to dst = (mp1 ^ exp) mod mod.
*
***/
-void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, uint32 exp,
+void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp,
SilcMPInt *mod);
/****f* silcmath/SilcMPAPI/silc_mp_modinv
*
* SYNOPSIS
*
- * int silc_mp_cmp_si(SilcMPInt *mp1, int32 si);
+ * int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si);
*
* DESCRIPTION
*
* if `mp1' > `si', `mp1' == `si', or `mp1' < `si', respectively.
*
***/
-int silc_mp_cmp_si(SilcMPInt *mp1, int32 si);
+int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si);
/****f* silcmath/SilcMPAPI/silc_mp_cmp_ui
*
* SYNOPSIS
*
- * int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui);
+ * int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui);
*
* DESCRIPTION
*
* respectively.
*
***/
-int silc_mp_cmp_ui(SilcMPInt *mp1, uint32 ui);
+int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui);
/****f* silcmath/SilcMPAPI/silc_mp_mp2bin
*
* SYNOPSIS
*
- * unsigned char *silc_mp_mp2bin(SilcMPInt *val, uint32 len,
- * uint32 *ret_len);
+ * unsigned char *silc_mp_mp2bin(SilcMPInt *val, SilcUInt32 len,
+ * SilcUInt32 *ret_len);
*
* DESCRIPTION
*
* buffer is allocated that large. If zero then the size is approximated.
*
***/
-unsigned char *silc_mp_mp2bin(SilcMPInt *val, uint32 len,
- uint32 *ret_len);
+unsigned char *silc_mp_mp2bin(SilcMPInt *val, SilcUInt32 len,
+ SilcUInt32 *ret_len);
/****f* silcmath/SilcMPAPI/silc_mp_mp2bin_noalloc
*
* SYNOPSIS
*
* void silc_mp_mp2bin_noalloc(SilcMPInt *val, unsigned char *dst,
- * uint32 dst_len);
+ * SilcUInt32 dst_len);
*
* DESCRIPTION
*
*
***/
void silc_mp_mp2bin_noalloc(SilcMPInt *val, unsigned char *dst,
- uint32 dst_len);
+ SilcUInt32 dst_len);
/****f* silcmath/SilcMPAPI/silc_mp_bin2mp
*
* SYNOPSIS
*
- * void silc_mp_bin2mp(unsigned char *data, uint32 len,
+ * void silc_mp_bin2mp(unsigned char *data, SilcUInt32 len,
* SilcMPInt *ret);
*
* DESCRIPTION
* must be initialized.
*
***/
-void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcMPInt *ret);
+void silc_mp_bin2mp(unsigned char *data, SilcUInt32 len, SilcMPInt *ret);
/****f* silcmath/SilcMPAPI/silc_mp_abs
*
*/
-static uint32 primetable[] =
+static SilcUInt32 primetable[] =
{
2, 3, 5, 7, 11, 13, 17, 19,
23, 29, 31, 37, 41, 43, 47, 53,
If argument verbose is TRUE this will display some status information
about the progress of generation. */
-bool silc_math_gen_prime(SilcMPInt *prime, uint32 bits, bool verbose)
+bool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, bool verbose)
{
unsigned char *numbuf = NULL;
- uint32 i, b, k;
- uint32 *spmods;
+ SilcUInt32 i, b, k;
+ SilcUInt32 *spmods;
SilcMPInt r, base, tmp, tmp2, oprime;
silc_mp_init(&r);
/* Init modulo table with the prime candidate and the primes
in the primetable. */
- spmods = silc_calloc(1, sizeof(primetable) * sizeof(uint32));
+ spmods = silc_calloc(1, sizeof(primetable) * sizeof(SilcUInt32));
for (i = 0; primetable[i] != 0; i++) {
silc_mp_mod_ui(&tmp, prime, primetable[i]);
spmods[i] = silc_mp_get_ui(&tmp);
/* Request context. Every request will allocate this context and set
the correct callback function according the `type' field. */
typedef struct SilcSFTPRequestStruct {
- uint32 id;
+ SilcUInt32 id;
SilcSFTPPacket type;
SilcSFTPStatusCallback status;
SilcSFTPHandleCallback handle;
void *send_context;
SilcSFTPVersionCallback version;
void *version_context;
- uint32 id;
+ SilcUInt32 id;
SilcList requests;
SilcBuffer packet;
} *SilcSFTPClient;
/* File handle */
struct SilcSFTPHandleStruct {
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
};
/* Creates SilcSFTPHandle and returns pointer to it. The caller must free
the context. */
static SilcSFTPHandle silc_sftp_handle_create(unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcSFTPHandle handle;
static void silc_sftp_handle_get(SilcSFTPHandle handle,
const unsigned char **data,
- uint32 *data_len)
+ SilcUInt32 *data_len)
{
*data = (const unsigned char *)handle->data;
*data_len = handle->data_len;
static void silc_sftp_send_packet(SilcSFTPClient sftp,
SilcSFTPPacket type,
- uint32 len, ...)
+ SilcUInt32 len, ...)
{
SilcBuffer tmp;
va_list vp;
/* Finds request by request ID. */
-static SilcSFTPRequest silc_sftp_find_request(SilcSFTPClient sftp, uint32 id)
+static SilcSFTPRequest silc_sftp_find_request(SilcSFTPClient sftp, SilcUInt32 id)
{
SilcSFTPRequest req;
{
/* Data returned */
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
if (status != SILC_SFTP_STATUS_OK) {
if (req->data)
}
data = (unsigned char *)va_arg(vp, unsigned char *);
- data_len = (uint32)va_arg(vp, uint32);
+ data_len = (SilcUInt32)va_arg(vp, SilcUInt32);
if (req->data)
(*req->data)((SilcSFTP)sftp, status, (const unsigned char *)data,
/* Handle returned */
SilcSFTPHandle handle;
unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
if (status != SILC_SFTP_STATUS_OK) {
if (req->handle)
}
hdata = (unsigned char *)va_arg(vp, unsigned char *);
- hdata_len = (uint32)va_arg(vp, uint32);
+ hdata_len = (SilcUInt32)va_arg(vp, SilcUInt32);
handle = silc_sftp_handle_create(hdata, hdata_len);
if (req->handle)
{
/* Extended reply returned */
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
if (status != SILC_SFTP_STATUS_OK) {
if (req->extended)
}
data = (unsigned char *)va_arg(vp, unsigned char *);
- data_len = (uint32)va_arg(vp, uint32);
+ data_len = (SilcUInt32)va_arg(vp, SilcUInt32);
if (req->extended)
(*req->extended)((SilcSFTP)sftp, status, (const unsigned char *)data,
SilcSFTPRequest req;
SilcSFTPPacket type;
const unsigned char *payload = NULL;
- uint32 payload_len;
+ SilcUInt32 payload_len;
int ret;
SilcBufferStruct buf;
- uint32 id;
+ SilcUInt32 id;
SILC_LOG_DEBUG(("Start"));
case SILC_SFTP_STATUS:
{
- uint32 status;
+ SilcUInt32 status;
char *message = NULL, *language_tag = NULL;
SILC_LOG_DEBUG(("Status packet"));
case SILC_SFTP_HANDLE:
{
unsigned char *handle = NULL;
- uint32 handle_len;
+ SilcUInt32 handle_len;
SILC_LOG_DEBUG(("Handle packet"));
case SILC_SFTP_DATA:
{
unsigned char *data = NULL;
- uint32 data_len = 0;
+ SilcUInt32 data_len = 0;
SILC_LOG_DEBUG(("Data packet"));
case SILC_SFTP_NAME:
{
- uint32 count;
+ SilcUInt32 count;
SilcSFTPName name = NULL;
SILC_LOG_DEBUG(("Name packet"));
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
SilcBuffer attrs_buf;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Open request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Close request"));
void silc_sftp_read(SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
- uint32 len,
+ SilcUInt64 offset,
+ SilcUInt32 len,
SilcSFTPDataCallback callback,
void *context)
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len2 = 0;
+ SilcUInt32 len2 = 0;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Read request"));
void silc_sftp_write(SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
+ SilcUInt64 offset,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPStatusCallback callback,
void *context)
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Write request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Remove request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Rename request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SilcBuffer attrs_buf;
SILC_LOG_DEBUG(("Mkdir request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Rmdir request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Opendir request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Readdir request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Stat request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Lstat request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Fstat request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SilcBuffer attrs_buf;
SILC_LOG_DEBUG(("Setstat request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SilcBuffer attrs_buf;
const unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Fsetstat request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Readlink request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Symlink request"));
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Realpath request"));
void silc_sftp_extended(SilcSFTP sftp,
const char *request,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPExtendedCallback callback,
void *context)
{
SilcSFTPClient client = (SilcSFTPClient)sftp;
SilcSFTPRequest req;
- uint32 len = 0;
+ SilcUInt32 len = 0;
SILC_LOG_DEBUG(("Extended request"));
bool directory; /* TRUE if this is directory */
SilcSFTPFSMemoryPerm perm; /* Permissions */
struct MemFSEntryStruct **entry; /* Files and sub-directories */
- uint32 entry_count; /* Number of files and sub-directories */
+ SilcUInt32 entry_count; /* Number of files and sub-directories */
struct MemFSEntryStruct *parent; /* non-NULL if `directory' is TRUE,
includes parent directory. */
unsigned long created; /* Time of creation */
/* File handle. */
typedef struct {
- uint32 handle; /* Handle index */
+ SilcUInt32 handle; /* Handle index */
int fd; /* Real file handle */
MemFSEntry entry; /* Filesystem entry */
} *MemFSFileHandle;
MemFSEntry root; /* Root of the filesystem hierarchy */
SilcSFTPFSMemoryPerm root_perm;
MemFSFileHandle *handles; /* Open file handles */
- uint32 handles_count;
+ SilcUInt32 handles_count;
} *MemFS;
/* Generates absolute path from relative path that may include '.' and '..'
This does not check subdirectories recursively. */
static MemFSEntry mem_find_entry(MemFSEntry dir, const char *name,
- uint32 name_len)
+ SilcUInt32 name_len)
{
int i;
not check subdirectories recursively. */
static bool mem_del_entry_name(MemFSEntry dir, const char *name,
- uint32 name_len, bool check_perm)
+ SilcUInt32 name_len, bool check_perm)
{
MemFSEntry entry;
/* Find handle by handle index. */
-static MemFSFileHandle mem_find_handle(MemFS fs, uint32 handle)
+static MemFSFileHandle mem_find_handle(MemFS fs, SilcUInt32 handle)
{
if (handle > fs->handles_count)
return NULL;
SilcSFTPHandle mem_get_handle(void *context, SilcSFTP sftp,
const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
MemFS fs = (MemFS)context;
- uint32 handle;
+ SilcUInt32 handle;
if (data_len < 4)
return NULL;
unsigned char *mem_encode_handle(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint32 *handle_len)
+ SilcUInt32 *handle_len)
{
unsigned char *data;
MemFSFileHandle h = (MemFSFileHandle)handle;
void mem_read(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
- uint32 len,
+ SilcUInt64 offset,
+ SilcUInt32 len,
SilcSFTPDataCallback callback,
void *callback_context)
{
void mem_write(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
+ SilcUInt64 offset,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPStatusCallback callback,
void *callback_context)
{
SilcSFTPAttributes attrs;
int i;
char long_name[256];
- uint64 filesize = 0;
+ SilcUInt64 filesize = 0;
char *date;
struct stat stats;
void mem_extended(void *context, SilcSFTP sftp,
const char *request,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPExtendedCallback callback,
void *callback_context)
{
static void silc_sftp_send_packet(SilcSFTPServer sftp,
SilcSFTPPacket type,
- uint32 len, ...)
+ SilcUInt32 len, ...)
{
SilcBuffer tmp;
va_list vp;
static void silc_sftp_send_error(SilcSFTPServer sftp,
SilcSFTPStatus status,
- uint32 id)
+ SilcUInt32 id)
{
SILC_LOG_DEBUG(("Send error %d", status));
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
int mlen, llen;
SILC_LOG_DEBUG(("Status callback"));
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Handle callback"));
SILC_LOG_DEBUG(("Request ID: %d", id));
static void silc_sftp_server_data(SilcSFTP sftp,
SilcSFTPStatus status,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
SILC_LOG_DEBUG(("Data callback"));
SILC_LOG_DEBUG(("Request ID: %d", id));
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
SilcBuffer namebuf;
SILC_LOG_DEBUG(("Name callback"));
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
SilcBuffer attr_buf;
SILC_LOG_DEBUG(("Attr callback"));
static void silc_sftp_server_extended(SilcSFTP sftp,
SilcSFTPStatus status,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
void *context)
{
SilcSFTPServer server = (SilcSFTPServer)sftp;
- uint32 id = (uint32)context;
+ SilcUInt32 id = (SilcUInt32)context;
SILC_LOG_DEBUG(("Extended callback"));
SILC_LOG_DEBUG(("Request ID: %d", id));
SilcSFTPPacket type;
char *filename = NULL, *path = NULL;
const unsigned char *payload = NULL;
- uint32 payload_len;
+ SilcUInt32 payload_len;
int ret;
SilcBufferStruct buf;
- uint32 id;
+ SilcUInt32 id;
SilcSFTPAttributes attrs;
SilcSFTPHandle handle;
SilcSFTPMonitorDataStruct mdata;
{
SilcSFTPFileOperation pflags;
unsigned char *attr_buf;
- uint32 attr_len = 0;
+ SilcUInt32 attr_len = 0;
SilcBufferStruct tmpbuf;
SILC_LOG_DEBUG(("Open request"));
case SILC_SFTP_CLOSE:
{
unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Close request"));
case SILC_SFTP_READ:
{
unsigned char *hdata;
- uint32 hdata_len;
- uint64 offset;
- uint32 len;
+ SilcUInt32 hdata_len;
+ SilcUInt64 offset;
+ SilcUInt32 len;
SILC_LOG_DEBUG(("Read request"));
case SILC_SFTP_WRITE:
{
unsigned char *hdata;
- uint32 hdata_len;
- uint64 offset;
+ SilcUInt32 hdata_len;
+ SilcUInt64 offset;
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
SILC_LOG_DEBUG(("Read request"));
case SILC_SFTP_MKDIR:
{
unsigned char *attr_buf;
- uint32 attr_len = 0;
+ SilcUInt32 attr_len = 0;
SilcBufferStruct tmpbuf;
SILC_LOG_DEBUG(("Mkdir request"));
case SILC_SFTP_READDIR:
{
unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Readdir request"));
case SILC_SFTP_FSTAT:
{
unsigned char *hdata;
- uint32 hdata_len;
+ SilcUInt32 hdata_len;
SILC_LOG_DEBUG(("Fstat request"));
case SILC_SFTP_SETSTAT:
{
unsigned char *attr_buf;
- uint32 attr_len = 0;
+ SilcUInt32 attr_len = 0;
SilcBufferStruct tmpbuf;
SILC_LOG_DEBUG(("Setstat request"));
case SILC_SFTP_FSETSTAT:
{
unsigned char *hdata, *attr_buf;
- uint32 hdata_len, attr_len = 0;
+ SilcUInt32 hdata_len, attr_len = 0;
SilcBufferStruct tmpbuf;
SILC_LOG_DEBUG(("Fsetstat request"));
{
char *request = NULL;
unsigned char *data;
- uint32 data_len;
+ SilcUInt32 data_len;
SILC_LOG_DEBUG(("Extended request"));
fit to `packet_buf' will be reallocated. */
SilcBuffer silc_sftp_packet_encode(SilcSFTPPacket packet,
- SilcBuffer packet_buf, uint32 len, ...)
+ SilcBuffer packet_buf, SilcUInt32 len, ...)
{
SilcBuffer buffer;
va_list vp;
pointer as argument. */
SilcBuffer silc_sftp_packet_encode_vp(SilcSFTPPacket packet,
- SilcBuffer packet_buf, uint32 len,
+ SilcBuffer packet_buf, SilcUInt32 len,
va_list vp)
{
SilcBuffer buffer;
SilcSFTPPacket silc_sftp_packet_decode(SilcBuffer packet,
unsigned char **payload,
- uint32 *payload_len)
+ SilcUInt32 *payload_len)
{
- uint32 len;
- uint8 type;
+ SilcUInt32 len;
+ SilcUInt8 type;
int ret;
ret = silc_buffer_unformat(packet,
sizeof(*attr->extended_data));
for (i = 0; i < attr->extended_count; i++) {
unsigned char *tmp, *tmp2;
- uint32 tmp_len, tmp2_len;
+ SilcUInt32 tmp_len, tmp2_len;
if (silc_buffer_unformat(buffer,
SILC_STR_UI32_NSTRING(&tmp, &tmp_len),
`count' many name, longname and attribute values. Returns the allocated
structure or NULL on error. */
-SilcSFTPName silc_sftp_name_decode(uint32 count, SilcBuffer buffer)
+SilcSFTPName silc_sftp_name_decode(SilcUInt32 count, SilcBuffer buffer)
{
SilcSFTPName name;
int i;
#ifndef SFTP_UTIL_H
#define SFTP_UTIL_H
-typedef uint32 SilcSFTPPacket;
+typedef SilcUInt32 SilcSFTPPacket;
/* SFTP packet types */
#define SILC_SFTP_INIT 1
to that buffer instead of allocating new one. If the new data cannot
fit to `packet_buf' will be reallocated. */
SilcBuffer silc_sftp_packet_encode(SilcSFTPPacket packet,
- SilcBuffer packet_buf, uint32 len, ...);
+ SilcBuffer packet_buf, SilcUInt32 len, ...);
/* Same as silc_sftp_packet_encode but takes the variable argument list
pointer as argument. */
SilcBuffer silc_sftp_packet_encode_vp(SilcSFTPPacket packet,
- SilcBuffer packet_buf, uint32 len,
+ SilcBuffer packet_buf, SilcUInt32 len,
va_list vp);
/* Decodes the SFTP packet data `data' and return the SFTP packet type.
NULL if error occurred during decoding. */
SilcSFTPPacket silc_sftp_packet_decode(SilcBuffer packet,
unsigned char **payload,
- uint32 *payload_len);
+ SilcUInt32 *payload_len);
/* Encodes the SFTP attributes to a buffer and returns the allocated buffer.
The caller must free the buffer. */
/* Decodes a SilcSFTPName structure from the `buffer' that must include
`count' many name, longname and attribute values. Returns the allocated
structure or NULL on error. */
-SilcSFTPName silc_sftp_name_decode(uint32 count, SilcBuffer buffer);
+SilcSFTPName silc_sftp_name_decode(SilcUInt32 count, SilcBuffer buffer);
/* Frees the name context and its internals. */
void silc_sftp_name_free(SilcSFTPName name);
*
* NAME
*
- * typedef uint32 SilcSFTPVersion;
+ * typedef SilcUInt32 SilcSFTPVersion;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef uint32 SilcSFTPVersion;
+typedef SilcUInt32 SilcSFTPVersion;
/***/
/* SFTP protocol version */
*
***/
typedef struct {
- uint32 flags; /* Flags to indicate present attributes */
- uint64 size; /* Sife of the file in bytes */
- uint32 uid; /* Unix user ID */
- uint32 gid; /* Unix group ID */
- uint32 permissions; /* POSIX file permission bitmask */
- uint32 atime; /* Access time of file */
- uint32 mtime; /* Modification time of file */
-
- uint32 extended_count; /* Extended type and data count */
+ SilcUInt32 flags; /* Flags to indicate present attributes */
+ SilcUInt64 size; /* Sife of the file in bytes */
+ SilcUInt32 uid; /* Unix user ID */
+ SilcUInt32 gid; /* Unix group ID */
+ SilcUInt32 permissions; /* POSIX file permission bitmask */
+ SilcUInt32 atime; /* Access time of file */
+ SilcUInt32 mtime; /* Modification time of file */
+
+ SilcUInt32 extended_count; /* Extended type and data count */
SilcBuffer *extended_type;
SilcBuffer *extended_data;
} *SilcSFTPAttributes, SilcSFTPAttributesStruct;
char **filename;
char **long_filename;
SilcSFTPAttributes *attrs;
- uint32 count; /* Number of files */
+ SilcUInt32 count; /* Number of files */
} *SilcSFTPName, SilcSFTPNameStruct;
/****s* silcsftp/SilcSFTPAPI/SilcSFTPHandle
* typedef void (*SilcSFTPDataCallback)(SilcSFTP sftp,
* SilcSFTPStatus status,
* const unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* void *context);
*
* DESCRIPTION
typedef void (*SilcSFTPDataCallback)(SilcSFTP sftp,
SilcSFTPStatus status,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
void *context);
/****f* silcsftp/SilcSFTPAPI/SilcSFTPNameCallback
* typedef void (*SilcSFTPExtendedCallback)(SilcSFTP sftp,
* SilcSFTPStatus status,
* const unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* void *context);
*
* DESCRIPTION
typedef void (*SilcSFTPExtendedCallback)(SilcSFTP sftp,
SilcSFTPStatus status,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
void *context);
*
* void silc_sftp_read(SilcSFTP sftp,
* SilcSFTPHandle handle,
- * uint64 offset,
- * uint32 len,
+ * SilcUInt64 offset,
+ * SilcUInt32 len,
* SilcSFTPDataCallback callback,
* void *context);
*
***/
void silc_sftp_read(SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
- uint32 len,
+ SilcUInt64 offset,
+ SilcUInt32 len,
SilcSFTPDataCallback callback,
void *context);
*
* void silc_sftp_write(SilcSFTP sftp,
* SilcSFTPHandle handle,
- * uint64 offset,
+ * SilcUInt64 offset,
* const unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* SilcSFTPStatusCallback callback,
* void *context);
*
***/
void silc_sftp_write(SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
+ SilcUInt64 offset,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPStatusCallback callback,
void *context);
* void silc_sftp_extended(SilcSFTP sftp,
* const char *request,
* const unsigned char *data,
- * uint32 data_len,
+ * SilcUInt32 data_len,
* SilcSFTPExtendedCallback callback,
* void *context);
*
void silc_sftp_extended(SilcSFTP sftp,
const char *request,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPExtendedCallback callback,
void *context);
_SETSTAT, _READLINK, _SYMLINK, _REALPATH */
char *name2; /* _RENAME, _SYMLINK */
SilcSFTPFileOperation pflags; /* _OPEN */
- uint64 offset; /* _READ, _WRITE */
- uint32 data_len; /* _READ, _WRITE */
+ SilcUInt64 offset; /* _READ, _WRITE */
+ SilcUInt32 data_len; /* _READ, _WRITE */
SilcSFTPName names; /* _READDIR, _READLINK, _REALPATH */
} *SilcSFTPMonitorData, SilcSFTPMonitorDataStruct;
/***/
If the handle is not found this returns NULL. */
SilcSFTPHandle (*sftp_get_handle)(void *context, SilcSFTP sftp,
const unsigned char *data,
- uint32 data_len);
+ SilcUInt32 data_len);
/* Return encoded handle of `handle' or NULL on error. The caller
must free the returned buffer. */
unsigned char *(*sftp_encode_handle)(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint32 *handle_len);
+ SilcUInt32 *handle_len);
/* Open a file indicated by the `filename' with flags indicated by the
`pflags', and with attributes indicated by the `attr'. Calls the
called to return the read data. */
void (*sftp_read)(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
- uint32 len,
+ SilcUInt64 offset,
+ SilcUInt32 len,
SilcSFTPDataCallback callback,
void *callback_context);
is called to indicate the status of the writing. */
void (*sftp_write)(void *context, SilcSFTP sftp,
SilcSFTPHandle handle,
- uint64 offset,
+ SilcUInt64 offset,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPStatusCallback callback,
void *callback_context);
void (*sftp_extended)(void *context, SilcSFTP sftp,
const char *request,
const unsigned char *data,
- uint32 data_len,
+ SilcUInt32 data_len,
SilcSFTPExtendedCallback callback,
void *callback_context);
} *SilcSFTPFilesystemOps;
char *dir;
char *file;
bool opendir;
-uint64 offset;
+SilcUInt64 offset;
static void sftp_name(SilcSFTP sftp, SilcSFTPStatus status,
const SilcSFTPName name, void *context);
static void sftp_handle(SilcSFTP sftp, SilcSFTPStatus status,
SilcSFTPHandle handle, void *context);
static void sftp_data(SilcSFTP sftp, SilcSFTPStatus status,
- const unsigned char *data, uint32 data_len,
+ const unsigned char *data, SilcUInt32 data_len,
void *context);
static void send_packet(SilcSocketConnection sock,
}
static void sftp_data(SilcSFTP sftp, SilcSFTPStatus status,
- const unsigned char *data, uint32 data_len,
+ const unsigned char *data, SilcUInt32 data_len,
void *context)
{
SilcSFTPHandle handle = (SilcSFTPHandle)context;
{
SilcBuffer buf;
unsigned char *x_str;
- uint32 x_len;
+ SilcUInt32 x_len;
int ret;
SILC_LOG_DEBUG(("Encoding KE Payload"));
SilcSKEStatus status = SILC_SKE_STATUS_ERROR;
SilcSKEKEPayload *payload;
unsigned char *x = NULL;
- uint16 x_len;
- uint32 tot_len = 0, len2;
+ SilcUInt16 x_len;
+ SilcUInt32 tot_len = 0, len2;
int ret;
SILC_LOG_DEBUG(("Decoding Key Exchange Payload"));
/* Static functions */
static SilcSKEStatus silc_ske_create_rnd(SilcSKE ske, SilcMPInt *n,
- uint32 len,
+ SilcUInt32 len,
SilcMPInt *rnd);
static SilcSKEStatus silc_ske_make_hash(SilcSKE ske,
unsigned char *return_hash,
- uint32 *return_hash_len,
+ SilcUInt32 *return_hash_len,
int initiator);
/* Structure to hold all SKE callbacks. */
SilcBuffer payload_buf;
SilcMPInt *x;
SilcSKEKEPayload *payload;
- uint32 pk_len;
+ SilcUInt32 pk_len;
SILC_LOG_DEBUG(("Start"));
/* Compute signature data if we are doing mutual authentication */
if (private_key && ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
unsigned char hash[32], sign[1024];
- uint32 hash_len, sign_len;
+ SilcUInt32 hash_len, sign_len;
SILC_LOG_DEBUG(("We are doing mutual authentication"));
SILC_LOG_DEBUG(("Computing HASH_i value"));
{
SilcSKEKEPayload *payload;
unsigned char hash[32];
- uint32 hash_len;
+ SilcUInt32 hash_len;
SilcPublicKey public_key = NULL;
/* If the SKE was freed during the async call then free it really now,
ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
SilcPublicKey public_key = NULL;
unsigned char hash[32];
- uint32 hash_len;
+ SilcUInt32 hash_len;
/* Decode the public key */
if (!silc_pkcs_public_key_decode(recv_payload->pk_data,
SilcBuffer payload_buf;
SilcMPInt *KEY;
unsigned char hash[32], sign[1024], *pk;
- uint32 hash_len, sign_len, pk_len;
+ SilcUInt32 hash_len, sign_len, pk_len;
SILC_LOG_DEBUG(("Start"));
packet = silc_buffer_alloc(4);
silc_buffer_pull_tail(packet, SILC_BUFFER_END(packet));
silc_buffer_format(packet,
- SILC_STR_UI_INT((uint32)SILC_SKE_STATUS_OK),
+ SILC_STR_UI_INT((SilcUInt32)SILC_SKE_STATUS_OK),
SILC_STR_END);
if (ske->callbacks->send_packet)
packet = silc_buffer_alloc(4);
silc_buffer_pull_tail(packet, SILC_BUFFER_END(packet));
silc_buffer_format(packet,
- SILC_STR_UI_INT((uint32)status),
+ SILC_STR_UI_INT((SilcUInt32)status),
SILC_STR_END);
if (ske->callbacks->send_packet)
of len bits. The rnd sent as argument must be initialized. */
static SilcSKEStatus silc_ske_create_rnd(SilcSKE ske, SilcMPInt *n,
- uint32 len,
+ SilcUInt32 len,
SilcMPInt *rnd)
{
SilcSKEStatus status = SILC_SKE_STATUS_OK;
static SilcSKEStatus silc_ske_make_hash(SilcSKE ske,
unsigned char *return_hash,
- uint32 *return_hash_len,
+ SilcUInt32 *return_hash_len,
int initiator)
{
SilcSKEStatus status = SILC_SKE_STATUS_OK;
SilcBuffer buf;
unsigned char *e, *f, *KEY;
- uint32 e_len, f_len, KEY_len;
+ SilcUInt32 e_len, f_len, KEY_len;
int ret;
SILC_LOG_DEBUG(("Start"));
SilcSKEStatus
silc_ske_process_key_material_data(unsigned char *data,
- uint32 data_len,
- uint32 req_iv_len,
- uint32 req_enc_key_len,
- uint32 req_hmac_key_len,
+ SilcUInt32 data_len,
+ SilcUInt32 req_iv_len,
+ SilcUInt32 req_enc_key_len,
+ SilcUInt32 req_hmac_key_len,
SilcHash hash,
SilcSKEKeyMaterial *key)
{
SilcBuffer buf;
unsigned char hashd[32];
- uint32 hash_len = req_hmac_key_len;
- uint32 enc_key_len = req_enc_key_len / 8;
+ SilcUInt32 hash_len = req_hmac_key_len;
+ SilcUInt32 enc_key_len = req_enc_key_len / 8;
SILC_LOG_DEBUG(("Start"));
the actual keys to be used in the SILC. */
SilcSKEStatus silc_ske_process_key_material(SilcSKE ske,
- uint32 req_iv_len,
- uint32 req_enc_key_len,
- uint32 req_hmac_key_len,
+ SilcUInt32 req_iv_len,
+ SilcUInt32 req_enc_key_len,
+ SilcUInt32 req_hmac_key_len,
SilcSKEKeyMaterial *key)
{
SilcSKEStatus status;
SilcBuffer buf;
unsigned char *tmpbuf;
- uint32 klen;
+ SilcUInt32 klen;
/* Encode KEY to binary data */
tmpbuf = silc_mp_mp2bin(ske->KEY, 0, &klen);
*
* typedef void (*SilcSKEVerifyCb)(SilcSKE ske,
* unsigned char *pk_data,
- * uint32 pk_len,
+ * SilcUInt32 pk_len,
* SilcSKEPKType pk_type,
* void *context,
* SilcSKEVerifyCbCompletion completion,
***/
typedef void (*SilcSKEVerifyCb)(SilcSKE ske,
unsigned char *pk_data,
- uint32 pk_len,
+ SilcUInt32 pk_len,
SilcSKEPKType pk_type,
void *context,
SilcSKEVerifyCbCompletion completion,
*
* typedef SilcSKEStatus (*SilcSKECheckVersion)(SilcSKE ske,
* unsigned char *version,
- * uint32 len, void *context);
+ * SilcUInt32 len, void *context);
*
* DESCRIPTION
*
***/
typedef SilcSKEStatus (*SilcSKECheckVersion)(SilcSKE ske,
unsigned char *version,
- uint32 len, void *context);
+ SilcUInt32 len, void *context);
/****s* silcske/SilcSKEAPI/SilcSKEKeyMaterial
*
typedef struct {
unsigned char *send_iv;
unsigned char *receive_iv;
- uint32 iv_len;
+ SilcUInt32 iv_len;
unsigned char *send_enc_key;
unsigned char *receive_enc_key;
- uint32 enc_key_len;
+ SilcUInt32 enc_key_len;
unsigned char *send_hmac_key;
unsigned char *receive_hmac_key;
- uint32 hmac_key_len;
+ SilcUInt32 hmac_key_len;
} SilcSKEKeyMaterial;
/* Length of cookie in Start Payload */
/* The hash value HASH of the key exchange */
unsigned char *hash;
- uint32 hash_len;
+ SilcUInt32 hash_len;
/* Random Number Generator. This is set by the caller and must
be free'd by the caller. */
SilcSKECallbacks callbacks;
/* Backwards support version indicator */
- uint32 backward_version;
+ SilcUInt32 backward_version;
};
/***/
* SYNOPSIS
*
* SilcSKEStatus silc_ske_process_key_material(SilcSKE ske,
- * uint32 req_iv_len,
- * uint32 req_enc_key_len,
- * uint32 req_hmac_key_len,
+ * SilcUInt32 req_iv_len,
+ * SilcUInt32 req_enc_key_len,
+ * SilcUInt32 req_hmac_key_len,
* SilcSKEKeyMaterial *key);
*
* DESCRIPTION
*
***/
SilcSKEStatus silc_ske_process_key_material(SilcSKE ske,
- uint32 req_iv_len,
- uint32 req_enc_key_len,
- uint32 req_hmac_key_len,
+ SilcUInt32 req_iv_len,
+ SilcUInt32 req_enc_key_len,
+ SilcUInt32 req_hmac_key_len,
SilcSKEKeyMaterial *key);
/****f* silcske/SilcSKEAPI/silc_ske_process_key_material_data
*
* SilcSKEStatus
* silc_ske_process_key_material_data(unsigned char *data,
- * uint32 data_len,
- * uint32 req_iv_len,
- * uint32 req_enc_key_len,
- * uint32 req_hmac_key_len,
+ * SilcUInt32 data_len,
+ * SilcUInt32 req_iv_len,
+ * SilcUInt32 req_enc_key_len,
+ * SilcUInt32 req_hmac_key_len,
* SilcHash hash,
* SilcSKEKeyMaterial *key);
*
***/
SilcSKEStatus
silc_ske_process_key_material_data(unsigned char *data,
- uint32 data_len,
- uint32 req_iv_len,
- uint32 req_enc_key_len,
- uint32 req_hmac_key_len,
+ SilcUInt32 data_len,
+ SilcUInt32 req_iv_len,
+ SilcUInt32 req_enc_key_len,
+ SilcUInt32 req_hmac_key_len,
SilcHash hash,
SilcSKEKeyMaterial *key);
/* SILC Key Exchange Start Payload */
struct SilcSKEStartPayloadStruct {
unsigned char flags;
- uint16 len;
+ SilcUInt16 len;
unsigned char *cookie;
- uint16 cookie_len;
+ SilcUInt16 cookie_len;
unsigned char *version;
- uint16 version_len;
+ SilcUInt16 version_len;
- uint16 ke_grp_len;
+ SilcUInt16 ke_grp_len;
unsigned char *ke_grp_list;
- uint16 pkcs_alg_len;
+ SilcUInt16 pkcs_alg_len;
unsigned char *pkcs_alg_list;
- uint16 enc_alg_len;
+ SilcUInt16 enc_alg_len;
unsigned char *enc_alg_list;
- uint16 hash_alg_len;
+ SilcUInt16 hash_alg_len;
unsigned char *hash_alg_list;
- uint16 hmac_alg_len;
+ SilcUInt16 hmac_alg_len;
unsigned char *hmac_alg_list;
- uint16 comp_alg_len;
+ SilcUInt16 comp_alg_len;
unsigned char *comp_alg_list;
};
/* SILC Key Exchange Payload */
struct SilcSKEKEPayloadStruct {
- uint16 pk_len;
+ SilcUInt16 pk_len;
unsigned char *pk_data;
- uint16 pk_type;
+ SilcUInt16 pk_type;
SilcMPInt x;
- uint16 sign_len;
+ SilcUInt16 sign_len;
unsigned char *sign_data;
};
/* Returns human readable socket error message */
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len)
+ SilcUInt32 error_len)
{
char *err;
/* Converts the IP number string from numbers-and-dots notation to
binary form. */
-bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len)
+bool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len)
{
int ret = 0;
/* Calls normal select() system call. */
-int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout)
+int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count, struct timeval *timeout)
{
fd_set in, out;
int ret, i, max_fd = 0;
/* Returns human readable socket error message */
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len)
+ SilcUInt32 error_len)
{
/* XXX TODO */
return FALSE;
int silc_gettimeofday(struct timeval *tv)
{
FILETIME ft;
- __int64 msec;
+ __SilcInt64 msec;
GetSystemTimeAsFileTime(&ft);
- msec = (__int64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
+ msec = (__SilcInt64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
msec = (msec - FILETIME_1970) / 10;
tv->tv_sec = (long) (msec / 1000000);
tv->tv_usec = (long) (msec % 1000000);
the allocated data area. Following short description of the fields
of the buffer.
- uint32 truelen;
+ SilcUInt32 truelen;
True length of the buffer. This is set at the allocation of the
buffer and it should not be touched after that. This field should
be considered read-only.
- uint32 len;
+ SilcUInt32 len;
Length of the currently valid data area. Tells the length of the
data at the buffer. This is set to zero at the allocation of the
*/
typedef struct {
- uint32 truelen;
- uint32 len;
+ SilcUInt32 truelen;
+ SilcUInt32 len;
unsigned char *head;
unsigned char *data;
unsigned char *tail;
/* Inline functions */
static inline
-SilcBuffer silc_buffer_alloc(uint32 len)
+SilcBuffer silc_buffer_alloc(SilcUInt32 len)
{
SilcBuffer sb;
memory allocations. The `data' will not be copied to the buffer. */
static inline
-void silc_buffer_set(SilcBuffer sb, unsigned char *data, uint32 data_len)
+void silc_buffer_set(SilcBuffer sb, unsigned char *data, SilcUInt32 data_len)
{
sb->data = sb->head = data;
sb->tail = sb->end = data + data_len;
*/
static inline
-unsigned char *silc_buffer_pull(SilcBuffer sb, uint32 len)
+unsigned char *silc_buffer_pull(SilcBuffer sb, SilcUInt32 len)
{
unsigned char *old_data = sb->data;
#ifdef SILC_DEBUG
- assert(len <= (uint32)(sb->tail - sb->data));
+ assert(len <= (SilcUInt32)(sb->tail - sb->data));
#endif
sb->data += len;
*/
static inline
-unsigned char *silc_buffer_push(SilcBuffer sb, uint32 len)
+unsigned char *silc_buffer_push(SilcBuffer sb, SilcUInt32 len)
{
unsigned char *old_data = sb->data;
*/
static inline
-unsigned char *silc_buffer_pull_tail(SilcBuffer sb, uint32 len)
+unsigned char *silc_buffer_pull_tail(SilcBuffer sb, SilcUInt32 len)
{
unsigned char *old_tail = sb->tail;
#ifdef SILC_DEBUG
- assert((uint32)(sb->end - sb->tail) >= len);
+ assert((SilcUInt32)(sb->end - sb->tail) >= len);
#endif
sb->tail += len;
*/
static inline
-unsigned char *silc_buffer_push_tail(SilcBuffer sb, uint32 len)
+unsigned char *silc_buffer_push_tail(SilcBuffer sb, SilcUInt32 len)
{
unsigned char *old_tail = sb->tail;
static inline
unsigned char *silc_buffer_put_head(SilcBuffer sb,
const unsigned char *data,
- uint32 len)
+ SilcUInt32 len)
{
#ifdef SILC_DEBUG
- assert((uint32)(sb->data - sb->head) >= len);
+ assert((SilcUInt32)(sb->data - sb->head) >= len);
#endif
return (unsigned char *)memcpy(sb->head, data, len);
}
static inline
unsigned char *silc_buffer_put(SilcBuffer sb,
const unsigned char *data,
- uint32 len)
+ SilcUInt32 len)
{
#ifdef SILC_DEBUG
- assert((uint32)(sb->tail - sb->data) >= len);
+ assert((SilcUInt32)(sb->tail - sb->data) >= len);
#endif
return (unsigned char *)memcpy(sb->data, data, len);
}
static inline
unsigned char *silc_buffer_put_tail(SilcBuffer sb,
const unsigned char *data,
- uint32 len)
+ SilcUInt32 len)
{
#ifdef SILC_DEBUG
- assert((uint32)(sb->end - sb->tail) >= len);
+ assert((SilcUInt32)(sb->end - sb->tail) >= len);
#endif
return (unsigned char *)memcpy(sb->tail, data, len);
}
except that there is now more space at the end of buffer. */
static inline
-SilcBuffer silc_buffer_realloc(SilcBuffer sb, uint32 newsize)
+SilcBuffer silc_buffer_realloc(SilcBuffer sb, SilcUInt32 newsize)
{
SilcBuffer sb_new;
case SILC_BUFFER_PARAM_SI16_SHORT:
{
unsigned char xf[2];
- int16 x = (int16)va_arg(ap, int);
+ SilcInt16 x = (SilcInt16)va_arg(ap, int);
HAS_SPACE(dst, 2);
SILC_PUT16_MSB(x, xf);
silc_buffer_put(dst, xf, 2);
case SILC_BUFFER_PARAM_UI16_SHORT:
{
unsigned char xf[2];
- uint16 x = (uint16)va_arg(ap, int);
+ SilcUInt16 x = (SilcUInt16)va_arg(ap, int);
HAS_SPACE(dst, 2);
SILC_PUT16_MSB(x, xf);
silc_buffer_put(dst, xf, 2);
case SILC_BUFFER_PARAM_SI32_INT:
{
unsigned char xf[4];
- int32 x = va_arg(ap, int32);
+ SilcInt32 x = va_arg(ap, SilcInt32);
HAS_SPACE(dst, 4);
SILC_PUT32_MSB(x, xf);
silc_buffer_put(dst, xf, 4);
case SILC_BUFFER_PARAM_UI32_INT:
{
unsigned char xf[4];
- uint32 x = va_arg(ap, uint32);
+ SilcUInt32 x = va_arg(ap, SilcUInt32);
HAS_SPACE(dst, 4);
SILC_PUT32_MSB(x, xf);
silc_buffer_put(dst, xf, 4);
case SILC_BUFFER_PARAM_SI64_INT:
{
unsigned char xf[8];
- int64 x = va_arg(ap, int64);
+ SilcInt64 x = va_arg(ap, SilcInt64);
HAS_SPACE(dst, 8);
SILC_PUT64_MSB(x, xf);
silc_buffer_put(dst, xf, 8);
case SILC_BUFFER_PARAM_UI64_INT:
{
unsigned char xf[8];
- uint64 x = va_arg(ap, uint64);
+ SilcUInt64 x = va_arg(ap, SilcUInt64);
HAS_SPACE(dst, 8);
SILC_PUT64_MSB(x, xf);
silc_buffer_put(dst, xf, 8);
case SILC_BUFFER_PARAM_UI32_STRING_ALLOC:
{
unsigned char *x = va_arg(ap, unsigned char *);
- uint32 tmp_len = strlen(x);
+ SilcUInt32 tmp_len = strlen(x);
HAS_SPACE(dst, tmp_len);
silc_buffer_put(dst, x, tmp_len);
silc_buffer_pull(dst, tmp_len);
case SILC_BUFFER_PARAM_UI_XNSTRING_ALLOC:
{
unsigned char *x = va_arg(ap, unsigned char *);
- uint32 len = va_arg(ap, uint32);
+ SilcUInt32 len = va_arg(ap, SilcUInt32);
HAS_SPACE(dst, len);
silc_buffer_put(dst, x, len);
silc_buffer_pull(dst, len);
}
case SILC_BUFFER_PARAM_SI16_SHORT:
{
- int16 *x = va_arg(ap, int16 *);
+ SilcInt16 *x = va_arg(ap, SilcInt16 *);
HAS_SPACE(src, 2);
if (x)
SILC_GET16_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_UI16_SHORT:
{
- uint16 *x = va_arg(ap, uint16 *);
+ SilcUInt16 *x = va_arg(ap, SilcUInt16 *);
HAS_SPACE(src, 2);
if (x)
SILC_GET16_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_SI32_INT:
{
- int32 *x = va_arg(ap, int32 *);
+ SilcInt32 *x = va_arg(ap, SilcInt32 *);
HAS_SPACE(src, 4);
if (x)
SILC_GET32_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_UI32_INT:
{
- uint32 *x = va_arg(ap, uint32 *);
+ SilcUInt32 *x = va_arg(ap, SilcUInt32 *);
HAS_SPACE(src, 4);
if (x)
SILC_GET32_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_SI64_INT:
{
- int64 *x = va_arg(ap, int64 *);
+ SilcInt64 *x = va_arg(ap, SilcInt64 *);
HAS_SPACE(src, 8);
if (x)
SILC_GET64_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_UI64_INT:
{
- uint64 *x = va_arg(ap, uint64 *);
+ SilcUInt64 *x = va_arg(ap, SilcUInt64 *);
HAS_SPACE(src, 8);
if (x)
SILC_GET64_MSB(*x, src->data);
}
case SILC_BUFFER_PARAM_UI8_STRING:
{
- uint8 len2;
+ SilcUInt8 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 1);
- len2 = (uint8)src->data[0];
+ len2 = (SilcUInt8)src->data[0];
silc_buffer_pull(src, 1);
HAS_SPACE(src, len2);
if (x)
}
case SILC_BUFFER_PARAM_UI16_STRING:
{
- uint16 len2;
+ SilcUInt16 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 2);
SILC_GET16_MSB(len2, src->data);
}
case SILC_BUFFER_PARAM_UI8_STRING_ALLOC:
{
- uint8 len2;
+ SilcUInt8 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 1);
- len2 = (uint8)src->data[0];
+ len2 = (SilcUInt8)src->data[0];
silc_buffer_pull(src, 1);
HAS_SPACE(src, len2);
if (x && len2) {
}
case SILC_BUFFER_PARAM_UI16_STRING_ALLOC:
{
- uint16 len2;
+ SilcUInt16 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 2);
SILC_GET16_MSB(len2, src->data);
}
case SILC_BUFFER_PARAM_UI32_STRING:
{
- uint32 len2;
+ SilcUInt32 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 4);
SILC_GET32_MSB(len2, src->data);
}
case SILC_BUFFER_PARAM_UI32_STRING_ALLOC:
{
- uint32 len2;
+ SilcUInt32 len2;
unsigned char **x = va_arg(ap, unsigned char **);
HAS_SPACE(src, 4);
SILC_GET32_MSB(len2, src->data);
}
case SILC_BUFFER_PARAM_UI8_NSTRING:
{
- uint8 len2;
+ SilcUInt8 len2;
unsigned char **x = va_arg(ap, unsigned char **);
- uint8 *len = va_arg(ap, uint8 *);
+ SilcUInt8 *len = va_arg(ap, SilcUInt8 *);
HAS_SPACE(src, 1);
- len2 = (uint8)src->data[0];
+ len2 = (SilcUInt8)src->data[0];
silc_buffer_pull(src, 1);
HAS_SPACE(src, len2);
if (len)
}
case SILC_BUFFER_PARAM_UI16_NSTRING:
{
- uint16 len2;
+ SilcUInt16 len2;
unsigned char **x = va_arg(ap, unsigned char **);
- uint16 *len = va_arg(ap, uint16 *);
+ SilcUInt16 *len = va_arg(ap, SilcUInt16 *);
HAS_SPACE(src, 2);
SILC_GET16_MSB(len2, src->data);
silc_buffer_pull(src, 2);
}
case SILC_BUFFER_PARAM_UI8_NSTRING_ALLOC:
{
- uint8 len2;
+ SilcUInt8 len2;
unsigned char **x = va_arg(ap, unsigned char **);
- uint8 *len = va_arg(ap, uint8 *);
+ SilcUInt8 *len = va_arg(ap, SilcUInt8 *);
HAS_SPACE(src, 1);
- len2 = (uint8)src->data[0];
+ len2 = (SilcUInt8)src->data[0];
silc_buffer_pull(src, 1);
HAS_SPACE(src, len2);
if (len)
}
case SILC_BUFFER_PARAM_UI16_NSTRING_ALLOC:
{
- uint16 len2;
+ SilcUInt16 len2;
unsigned char **x = va_arg(ap, unsigned char **);
- uint16 *len = va_arg(ap, uint16 *);
+ SilcUInt16 *len = va_arg(ap, SilcUInt16 *);
HAS_SPACE(src, 2);
SILC_GET16_MSB(len2, src->data);
silc_buffer_pull(src, 2);
}
case SILC_BUFFER_PARAM_UI32_NSTRING:
{
- uint32 len2;
+ SilcUInt32 len2;
unsigned char **x = va_arg(ap, unsigned char **);
- uint32 *len = va_arg(ap, uint32 *);
+ SilcUInt32 *len = va_arg(ap, SilcUInt32 *);
HAS_SPACE(src, 4);
SILC_GET32_MSB(len2, src->data);
silc_buffer_pull(src, 4);
case SILC_BUFFER_PARAM_UI_XNSTRING:
{
unsigned char **x = va_arg(ap, unsigned char **);
- uint32 len = va_arg(ap, uint32);
+ SilcUInt32 len = va_arg(ap, SilcUInt32);
HAS_SPACE(src, len);
if (len && x)
*x = src->data;
case SILC_BUFFER_PARAM_UI_XNSTRING_ALLOC:
{
unsigned char **x = va_arg(ap, unsigned char **);
- uint32 len = va_arg(ap, uint32);
+ SilcUInt32 len = va_arg(ap, SilcUInt32);
HAS_SPACE(src, len);
if (len && x) {
*x = silc_calloc(len + 1, sizeof(unsigned char));
#define SILC_STR_SI_CHAR(x) SILC_BUFFER_PARAM_SI8_CHAR, (x)
#define SILC_STR_UI_CHAR(x) SILC_BUFFER_PARAM_UI8_CHAR, (x)
-/* Signed/uint16.
+/* Signed/SilcUInt16.
Formatting: SILC_STR_SI_SHORT(short)
- SILC_STR_UI_SHORT(uint16)
+ SILC_STR_UI_SHORT(SilcUInt16)
Unformatting: SILC_STR_SI_SHORT(short *)
- SILC_STR_UI_SHORT(uint16 *)
+ SILC_STR_UI_SHORT(SilcUInt16 *)
*/
#define SILC_STR_SI_SHORT(x) SILC_BUFFER_PARAM_SI16_SHORT, (x)
#define SILC_STR_UI_SHORT(x) SILC_BUFFER_PARAM_UI16_SHORT, (x)
-/* Signed/uint32.
+/* Signed/SilcUInt32.
Formatting: SILC_STR_SI_INT(int)
- SILC_STR_UI_INT(uint32)
+ SILC_STR_UI_INT(SilcUInt32)
Unformatting: SILC_STR_SI_INT(int *)
- SILC_STR_UI_INT(uint32 *)
+ SILC_STR_UI_INT(SilcUInt32 *)
*/
#define SILC_STR_SI_INT(x) SILC_BUFFER_PARAM_SI32_INT, (x)
#define SILC_STR_UI_INT(x) SILC_BUFFER_PARAM_UI32_INT, (x)
-/* Signed/uint64.
+/* Signed/SilcUInt64.
Formatting: SILC_STR_SI_INT64(int)
- SILC_STR_UI_INT64(uint32)
+ SILC_STR_UI_INT64(SilcUInt32)
Unformatting: SILC_STR_SI_INT64(int *)
- SILC_STR_UI_INT64(uint32 *)
+ SILC_STR_UI_INT64(SilcUInt32 *)
*/
#define SILC_STR_SI_INT64(x) SILC_BUFFER_PARAM_SI64_INT, (x)
/* Unsigned string. Second argument is the length of the string.
- Formatting: SILC_STR_UI32_NSTRING(unsigned char *, uint32)
- Unformatting: SILC_STR_UI32_NSTRING(unsigned char **, uint32 *)
+ Formatting: SILC_STR_UI32_NSTRING(unsigned char *, SilcUInt32)
+ Unformatting: SILC_STR_UI32_NSTRING(unsigned char **, SilcUInt32 *)
Unformatting procedure will check for length of the string from the
buffer before trying to get the string out. Thus, one *must* format the
the string.
Formatting: This is equal to using *_NSTRING
- Unformatting: SILC_STR_UI_XNSTRING(unsigned char **, uint32)
+ Unformatting: SILC_STR_UI_XNSTRING(unsigned char **, SilcUInt32)
This type can be used to take arbitrary length string from the buffer
by sending the requested amount of bytes as argument. This differs
int level; /* parsing level, how many nested silc_config_main we have */
char *base; /* this is a fixed pointer to the base location */
char *p; /* the Parser poitner */
- uint32 len; /* fixed length of the whole file */
- uint32 line; /* current parsing line, strictly linked to p */
+ SilcUInt32 len; /* fixed length of the whole file */
+ SilcUInt32 line; /* current parsing line, strictly linked to p */
bool included; /* wether this file is main or included */
};
int val_int;
bool val_bool;
char *val_tmp;
- uint32 val_size;
+ SilcUInt32 val_size;
switch (type) {
case SILC_CONFIG_ARG_TOGGLE:
*(int *)pt = val_int;
return pt;
case SILC_CONFIG_ARG_SIZE:
- val_size = (uint32) strtol(val, &val_tmp, 0);
+ val_size = (SilcUInt32) strtol(val, &val_tmp, 0);
if (val == val_tmp)
return NULL; /* really wrong, there must be at least one digit */
/* Search for a designator */
case '\0': /* None */
break;
case 'k': /* Kilobytes */
- val_size *= (uint32) 1024;
+ val_size *= (SilcUInt32) 1024;
break;
case 'm': /* Megabytes */
- val_size *= (uint32) (1024 * 1024);
+ val_size *= (SilcUInt32) (1024 * 1024);
break;
case 'g':
- val_size *= (uint32) (1024 * 1024 * 1024);
+ val_size *= (SilcUInt32) (1024 * 1024 * 1024);
break;
default:
return NULL;
if (val_tmp[1])
return NULL;
pt = silc_calloc(1, sizeof(val_size));
- *(uint32 *)pt = val_size;
+ *(SilcUInt32 *)pt = val_size;
return pt;
case SILC_CONFIG_ARG_STR: /* the only difference between STR and STRE is */
if (!val[0]) /* that STR cannot be empty, while STRE can. */
SilcConfigFile *silc_config_open(char *configfile)
{
char *buffer;
- uint32 filelen;
+ SilcUInt32 filelen;
SilcConfigFile *ret;
if (!(buffer = silc_file_readfile(configfile, &filelen)))
{
if (file) {
/* XXX FIXME: this check could probably be removed later */
- uint32 my_len = (uint32) (strchr(file->base, EOF) - file->base);
- SILC_CONFIG_DEBUG(("file=0x%x name=\"%s\" level=%d line=%lu", (uint32) file,
+ SilcUInt32 my_len = (SilcUInt32) (strchr(file->base, EOF) - file->base);
+ SILC_CONFIG_DEBUG(("file=0x%x name=\"%s\" level=%d line=%lu", (SilcUInt32) file,
file->filename, file->level, file->line));
if (my_len != file->len) {
fprintf(stderr, "FATAL ERROR: saved len and current len does not match!\n");
/* Returns the current line that file parsing arrived at */
-uint32 silc_config_get_line(SilcConfigFile *file)
+SilcUInt32 silc_config_get_line(SilcConfigFile *file)
{
if (file)
return file->line;
/* Returns a pointer to the beginning of the requested line. If the line
* was not found, NULL is returned */
-char *silc_config_read_line(SilcConfigFile *file, uint32 line)
+char *silc_config_read_line(SilcConfigFile *file, SilcUInt32 line)
{
register char *p;
int len;
{
SilcConfigOption *oldopt, *nextopt;
SILC_CONFIG_DEBUG(("Freeing config entity [ent=0x%x] [opts=0x%x]",
- (uint32) ent, (uint32) ent->opts));
+ (SilcUInt32) ent, (SilcUInt32) ent->opts));
for (oldopt = ent->opts; oldopt; oldopt = nextopt) {
nextopt = oldopt->next;
memset(oldopt->name, 'F', strlen(oldopt->name) + 1);
{
SilcConfigOption *newopt;
SILC_CONFIG_DEBUG(("Register new option=\"%s\" type=%u cb=0x%08x context=0x%08x",
- name, type, (uint32) cb, (uint32) context));
+ name, type, (SilcUInt32) cb, (SilcUInt32) context));
/* if we are registering a block, make sure there is a specified sub-table */
if (!ent || !name || ((type == SILC_CONFIG_ARG_BLOCK) && !subtable))
* SYNOPSIS
*
* typedef int (*SilcConfigCallback)(SilcConfigType type, const char *name,
- * uint32 line, void *val, void *context);
+ * SilcUInt32 line, void *val, void *context);
* DESCRIPTION
*
* This is the callback prototype for the options handler. The pointer
*
***/
typedef int (*SilcConfigCallback)(SilcConfigType type, const char *name,
- uint32 line, void *val, void *context);
+ SilcUInt32 line, void *val, void *context);
/****s* silcutil/SilcConfigAPI/SilcConfigTable
*
*/
#define SILC_CONFIG_CALLBACK(func) \
static int func(SilcConfigType type, const char *name, \
- uint32 line, void *val, void *context)
+ SilcUInt32 line, void *val, void *context)
/***/
/* Prototypes */
*
* SYNOPSIS
*
- * uint32 silc_config_get_line(SilcConfigFile *file);
+ * SilcUInt32 silc_config_get_line(SilcConfigFile *file);
*
* DESCRIPTION
*
* Returns the current line that file parsing arrived at.
*
***/
-uint32 silc_config_get_line(SilcConfigFile *file);
+SilcUInt32 silc_config_get_line(SilcConfigFile *file);
/****f* silcutil/SilcConfigAPI/silc_config_read_line
*
* SYNOPSIS
*
- * char *silc_config_read_line(SilcConfigFile *file, uint32 line);
+ * char *silc_config_read_line(SilcConfigFile *file, SilcUInt32 line);
*
* DESCRIPTION
*
* silc_config_read_current_line
*
***/
-char *silc_config_read_line(SilcConfigFile *file, uint32 line);
+char *silc_config_read_line(SilcConfigFile *file, SilcUInt32 line);
/****f* silcutil/SilcConfigAPI/silc_config_read_current_line
*
/* Reads data from file descriptor `fd' to `buf'. */
-int silc_file_read(int fd, unsigned char *buf, uint32 buf_len)
+int silc_file_read(int fd, unsigned char *buf, SilcUInt32 buf_len)
{
return read(fd, (void *)buf, buf_len);
}
/* Writes `buffer' of length of `len' to file descriptor `fd. */
-int silc_file_write(int fd, const char *buffer, uint32 len)
+int silc_file_write(int fd, const char *buffer, SilcUInt32 len)
{
return write(fd, (const void *)buffer, len);
}
/* Writes a buffer to the file. */
-int silc_file_writefile(const char *filename, const char *buffer, uint32 len)
+int silc_file_writefile(const char *filename, const char *buffer, SilcUInt32 len)
{
int fd;
set to the file. */
int silc_file_writefile_mode(const char *filename, const char *buffer,
- uint32 len, int mode)
+ SilcUInt32 len, int mode)
{
int fd;
/* Reads a file to a buffer. The allocated buffer is returned. Length of
the file read is returned to the return_len argument. */
-char *silc_file_readfile(const char *filename, uint32 *return_len)
+char *silc_file_readfile(const char *filename, SilcUInt32 *return_len)
{
int fd;
char *buffer;
/* Returns files size. Returns 0 on error. */
-uint64 silc_file_size(const char *filename)
+SilcUInt64 silc_file_size(const char *filename)
{
int ret;
struct stat stats;
if (ret < 0)
return 0;
- return (uint64)stats.st_size;
+ return (SilcUInt64)stats.st_size;
}
int silc_file_open(const char *filename, int flags);
int silc_file_open_mode(const char *filename, int flags, int mode);
-int silc_file_read(int fd, unsigned char *buf, uint32 buf_len);
-int silc_file_write(int fd, const char *buffer, uint32 len);
+int silc_file_read(int fd, unsigned char *buf, SilcUInt32 buf_len);
+int silc_file_write(int fd, const char *buffer, SilcUInt32 len);
int silc_file_close(int fd);
-char *silc_file_readfile(const char *filename, uint32 *return_len);
-int silc_file_writefile(const char *filename, const char *buffer, uint32 len);
+char *silc_file_readfile(const char *filename, SilcUInt32 *return_len);
+int silc_file_writefile(const char *filename, const char *buffer, SilcUInt32 len);
int silc_file_writefile_mode(const char *filename, const char *buffer,
- uint32 len, int mode);
-uint64 silc_file_size(const char *filename);
+ SilcUInt32 len, int mode);
+SilcUInt64 silc_file_size(const char *filename);
#endif /* SILCFILEUTIL_H */
/* Hash table. */
struct SilcHashTableStruct {
SilcHashTableEntry *table;
- uint32 table_size;
- uint32 entry_count;
+ SilcUInt32 table_size;
+ SilcUInt32 entry_count;
SilcHashFunction hash;
SilcHashCompare compare;
SilcHashDestructor destructor;
/* Prime sizes for the hash table. The size of the table will always
be one of these. */
-const uint32 primesize[42] =
+const SilcUInt32 primesize[42] =
{
1, 3, 5, 11, 17, 37, 67, 109, 131, 163, 257, 367, 521, 823, 1031,
1237, 2053, 2777, 4099, 6247, 8209, 14057, 16411, 21089, 32771, 47431,
/* Find appropriate size for the hash table. The size will be a prime. */
-static uint32 silc_hash_table_primesize(uint32 size, uint32 *index)
+static SilcUInt32 silc_hash_table_primesize(SilcUInt32 size, SilcUInt32 *index)
{
int i;
void *compare_user_context)
{
SilcHashTableEntry *entry, prev = NULL;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p", i, key));
void *compare_user_context)
{
SilcHashTableEntry *entry, prev = NULL;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p context %p", i, key, context));
void *compare_user_context)
{
SilcHashTableEntry *entry;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p", i, key));
{
SilcHashTableEntry *entry, *tmp;
bool auto_rehash;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p", i, key));
void *hash_user_context)
{
SilcHashTableEntry *entry;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p", i, key));
void *hash_user_context)
{
SilcHashTableEntry *entry;
- uint32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
+ SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
SILC_HT_DEBUG(("index %d key %p", i, key));
destructor function, respectively. The `hash' is mandatory, the others
are optional. */
-SilcHashTable silc_hash_table_alloc(uint32 table_size,
+SilcHashTable silc_hash_table_alloc(SilcUInt32 table_size,
SilcHashFunction hash,
void *hash_user_context,
SilcHashCompare compare,
bool auto_rehash)
{
SilcHashTable ht;
- uint32 size_index = SILC_HASH_TABLE_SIZE;
+ SilcUInt32 size_index = SILC_HASH_TABLE_SIZE;
if (!hash)
return NULL;
/* Returns the size of the hash table */
-uint32 silc_hash_table_size(SilcHashTable ht)
+SilcUInt32 silc_hash_table_size(SilcHashTable ht)
{
return primesize[ht->table_size];
}
entries in the table thatn the size of the hash table calling the
silc_hash_table_rehash is recommended. */
-uint32 silc_hash_table_count(SilcHashTable ht)
+SilcUInt32 silc_hash_table_count(SilcHashTable ht)
{
return ht->entry_count;
}
the new table of a suitable size. Note that this operation may be
very slow. */
-void silc_hash_table_rehash(SilcHashTable ht, uint32 new_size)
+void silc_hash_table_rehash(SilcHashTable ht, SilcUInt32 new_size)
{
int i;
SilcHashTableEntry *table, e, tmp;
- uint32 table_size, size_index;
+ SilcUInt32 table_size, size_index;
SILC_HT_DEBUG(("Start"));
/* Same as above but with specific hash function. */
-void silc_hash_table_rehash_ext(SilcHashTable ht, uint32 new_size,
+void silc_hash_table_rehash_ext(SilcHashTable ht, SilcUInt32 new_size,
SilcHashFunction hash,
void *hash_user_context)
{
int i;
SilcHashTableEntry *table, e, tmp;
- uint32 table_size, size_index;
+ SilcUInt32 table_size, size_index;
SILC_HT_DEBUG(("Start"));
struct SilcHashTableListStruct {
SilcHashTable ht;
void *entry;
- uint32 index;
+ SilcUInt32 index;
bool auto_rehash;
};
/***/
*
* SYNOPSIS
*
- * typedef uint32 (*SilcHashFunction)(void *key, void *user_context);
+ * typedef SilcUInt32 (*SilcHashFunction)(void *key, void *user_context);
*
* DESCRIPTION
*
* to the callback.
*
***/
-typedef uint32 (*SilcHashFunction)(void *key, void *user_context);
+typedef SilcUInt32 (*SilcHashFunction)(void *key, void *user_context);
/****f* silcutil/SilcHashTableAPI/SilcHashCompare
*
*
* SYNOPSIS
*
- * SilcHashTable silc_hash_table_alloc(uint32 table_size,
+ * SilcHashTable silc_hash_table_alloc(SilcUInt32 table_size,
* SilcHashFunction hash,
* void *hash_user_context,
* SilcHashCompare compare,
* are optional.
*
***/
-SilcHashTable silc_hash_table_alloc(uint32 table_size,
+SilcHashTable silc_hash_table_alloc(SilcUInt32 table_size,
SilcHashFunction hash,
void *hash_user_context,
SilcHashCompare compare,
*
* SYNOPSIS
*
- * uint32 silc_hash_table_size(SilcHashTable ht);
+ * SilcUInt32 silc_hash_table_size(SilcHashTable ht);
*
* DESCRIPTION
*
* hash table.
*
***/
-uint32 silc_hash_table_size(SilcHashTable ht);
+SilcUInt32 silc_hash_table_size(SilcHashTable ht);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_count
*
* SYNOPSIS
*
- * uint32 silc_hash_table_count(SilcHashTable ht);
+ * SilcUInt32 silc_hash_table_count(SilcHashTable ht);
*
* DESCRIPTION
*
* silc_hash_table_rehash is recommended.
*
***/
-uint32 silc_hash_table_count(SilcHashTable ht);
+SilcUInt32 silc_hash_table_count(SilcHashTable ht);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_add
*
*
* SYNOPSIS
*
- * void silc_hash_table_rehash(SilcHashTable ht, uint32 new_size);
+ * void silc_hash_table_rehash(SilcHashTable ht, SilcUInt32 new_size);
*
* DESCRIPTION
*
* very slow.
*
***/
-void silc_hash_table_rehash(SilcHashTable ht, uint32 new_size);
+void silc_hash_table_rehash(SilcHashTable ht, SilcUInt32 new_size);
/****f* silcutil/SilcHashTableAPI/silc_hash_table_list
*
*
* SYNOPSIS
*
- * void silc_hash_table_rehash_ext(SilcHashTable ht, uint32 new_size,
+ * void silc_hash_table_rehash_ext(SilcHashTable ht, SilcUInt32 new_size,
* SilcHashFunction hash,
* void *hash_user_context);
*
* function. If not provided the hash table's default is used.
*
***/
-void silc_hash_table_rehash_ext(SilcHashTable ht, uint32 new_size,
+void silc_hash_table_rehash_ext(SilcHashTable ht, SilcUInt32 new_size,
SilcHashFunction hash,
void *hash_user_context);
struct SilcLogStruct {
char *filename;
FILE *fp;
- uint32 maxsize;
+ SilcUInt32 maxsize;
char *typename;
SilcLogType type;
SilcLogCb cb;
}
/* Set and initialize the specified logging channel. See the API reference */
-bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
SilcSchedule scheduler)
{
FILE *fp = NULL;
void silc_log_output_hexdump(char *file, char *function,
int line, void *data_in,
- uint32 len, char *string)
+ SilcUInt32 len, char *string)
{
int i, k;
int off, pos, count;
* SYNOPSIS
*
* typedef bool (*SilcDebugHexdumpCb)(char *file, char *function, int line,
- * unsigned char *data, uint32 data_len,
+ * unsigned char *data, SilcUInt32 data_len,
* char *message, void *context;
*
* DESCRIPTION
*
***/
typedef bool (*SilcLogHexdumpCb)(char *file, char *function, int line,
- unsigned char *data, uint32 data_len,
+ unsigned char *data, SilcUInt32 data_len,
char *message, void *context);
/* Global Variables */
*
* SYNOPSIS
*
- * bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+ * bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
* SilcSchedule scheduler);
*
* DESCRIPTION
* buffered output and thus to save HD activity.
*
***/
-bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
SilcSchedule scheduler);
/****f* silcutil/SilcLogAPI/silc_log_set_callback
*
* void silc_log_output_hexdump(char *file, char *function,
* int line, void *data_in,
- * uint32 len, char *string);
+ * SilcUInt32 len, char *string);
*
* DESCRIPTION
*
***/
void silc_log_output_hexdump(char *file, char *function,
int line, void *data_in,
- uint32 len, char *string);
+ SilcUInt32 len, char *string);
/****f* silcutil/SilcLogAPI/silc_log_set_debug_callbacks
*
/* Resolves IP address for hostname. */
bool silc_net_gethostbyname(const char *name, bool prefer_ipv6, char *address,
- uint32 address_len)
+ SilcUInt32 address_len)
{
#ifdef HAVE_IPV6
struct addrinfo hints, *ai, *tmp, *ip4 = NULL, *ip6 = NULL;
/* Resolves hostname by IP address. */
-bool silc_net_gethostbyaddr(const char *addr, char *name, uint32 name_len)
+bool silc_net_gethostbyaddr(const char *addr, char *name, SilcUInt32 name_len)
{
#ifdef HAVE_IPV6
struct addrinfo req, *ai;
/* Return remote port by socket. */
-uint16 silc_net_get_remote_port(int sock)
+SilcUInt16 silc_net_get_remote_port(int sock)
{
#ifdef HAVE_IPV6
struct sockaddr_storage remote;
/* Return local port by socket. */
-uint16 silc_net_get_local_port(int sock)
+SilcUInt16 silc_net_get_local_port(int sock)
{
#ifdef HAVE_IPV6
struct sockaddr_storage local;
*
* SYNOPSIS
*
- * bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len);
+ * bool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len);
*
* DESCRIPTION
*
* IPv4 or IPv6 address.
*
***/
-bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len);
+bool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len);
/****f* silcutil/SilcNetAPI/SilcNetResolveCallback
*
* SYNOPSIS
*
* bool silc_net_gethostbyname(const char *name, bool prefer_ipv6,
- * char *address, uint32 address_len);
+ * char *address, SilcUInt32 address_len);
*
* DESCRIPTION
*
*
***/
bool silc_net_gethostbyname(const char *name, bool prefer_ipv6, char *address,
- uint32 address_len);
+ SilcUInt32 address_len);
/****f* silcutil/SilcNetAPI/silc_net_gethostbyname_async
*
* SYNOPSIS
*
* bool silc_net_gethostbyaddr(const char *addr, char *name,
- * uint32 name_len);
+ * SilcUInt32 name_len);
*
* DESCRIPTION
*
* This is synchronous function and will block the calling process.
*
***/
-bool silc_net_gethostbyaddr(const char *addr, char *name, uint32 name_len);
+bool silc_net_gethostbyaddr(const char *addr, char *name, SilcUInt32 name_len);
/****f* silcutil/SilcNetAPI/silc_net_gethostbyaddr_async
*
*
* SYNOPSIS
*
- * uint16 silc_net_get_remote_port(int sock);
+ * SilcUInt16 silc_net_get_remote_port(int sock);
*
* DESCRIPTION
*
* Return remote port by socket.
*
***/
-uint16 silc_net_get_remote_port(int sock);
+SilcUInt16 silc_net_get_remote_port(int sock);
/****f* silcutil/SilcNetAPI/silc_net_get_local_port
*
* SYNOPSIS
*
- * uint16 silc_net_get_local_port(int sock);
+ * SilcUInt16 silc_net_get_local_port(int sock);
*
* DESCRIPTION
*
* Return local port by socket.
*
***/
-uint16 silc_net_get_local_port(int sock);
+SilcUInt16 silc_net_get_local_port(int sock);
/****f* silcutil/SilcNetAPI/silc_net_localhost
*
/* System specific routines. Implemented under unix/ and win32/. */
/* System specific select(). Returns same values as normal select(). */
-int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout);
+int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count, struct timeval *timeout);
/* Initializes the wakeup of the scheduler. In multi-threaded environment
the scheduler needs to be wakenup when tasks are added or removed from
static void silc_task_queue_alloc(SilcTaskQueue *queue);
static void silc_task_queue_free(SilcTaskQueue queue);
-static SilcTask silc_task_find(SilcTaskQueue queue, uint32 fd);
+static SilcTask silc_task_find(SilcTaskQueue queue, SilcUInt32 fd);
static SilcTask silc_task_add(SilcTaskQueue queue, SilcTask newtask,
SilcTaskPriority priority);
static SilcTask silc_task_get_first(SilcTaskQueue queue, SilcTask first);
static void silc_task_del_by_context(SilcTaskQueue queue, void *context);
static void silc_task_del_by_callback(SilcTaskQueue queue,
SilcTaskCallback callback);
-static void silc_task_del_by_fd(SilcTaskQueue queue, uint32 fd);
+static void silc_task_del_by_fd(SilcTaskQueue queue, SilcUInt32 fd);
/* Returns the task queue by task type */
#define SILC_SCHEDULE_GET_QUEUE(type) \
/* SILC Task object. Represents one task in the scheduler. */
struct SilcTaskStruct {
- uint32 fd;
+ SilcUInt32 fd;
struct timeval timeout;
SilcTaskCallback callback;
void *context;
List of file descriptors the scheduler is supposed to be listenning.
This is updated internally.
- uint32 max_fd
- uint32 last_fd
+ SilcUInt32 max_fd
+ SilcUInt32 last_fd
Size of the fd_list list. There can be `max_fd' many tasks in
the scheduler at once. The `last_fd' is the last valid entry
SilcTaskQueue timeout_queue;
SilcTaskQueue generic_queue;
SilcScheduleFd fd_list;
- uint32 max_fd;
- uint32 last_fd;
+ SilcUInt32 max_fd;
+ SilcUInt32 last_fd;
struct timeval *timeout;
bool valid;
void *wakeup;
{
SilcTask task;
int i, last_fd = schedule->last_fd;
- uint32 fd;
+ SilcUInt32 fd;
for (i = 0; i <= last_fd; i++) {
if (schedule->fd_list[i].events == 0)
/* Add new task to the scheduler */
-SilcTask silc_schedule_task_add(SilcSchedule schedule, uint32 fd,
+SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
SilcTaskCallback callback, void *context,
long seconds, long useconds,
SilcTaskType type,
/* Remove task by fd */
-void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd)
+void silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd)
{
SILC_LOG_DEBUG(("Unregister task by fd %d", fd));
one file descriptor to set different iomasks. */
void silc_schedule_set_listen_fd(SilcSchedule schedule,
- uint32 fd, SilcTaskEvent iomask)
+ SilcUInt32 fd, SilcTaskEvent iomask)
{
int i;
bool found = FALSE;
/* Removes a file descriptor from listen list. */
-void silc_schedule_unset_listen_fd(SilcSchedule schedule, uint32 fd)
+void silc_schedule_unset_listen_fd(SilcSchedule schedule, SilcUInt32 fd)
{
int i;
/* Return task by its fd. */
-static SilcTask silc_task_find(SilcTaskQueue queue, uint32 fd)
+static SilcTask silc_task_find(SilcTaskQueue queue, SilcUInt32 fd)
{
SilcTask next;
return FALSE;
}
-static void silc_task_del_by_fd(SilcTaskQueue queue, uint32 fd)
+static void silc_task_del_by_fd(SilcTaskQueue queue, SilcUInt32 fd)
{
SilcTask next;
* SYNOPSIS
*
* typedef void (*SilcTaskCallback)(SilcSchedule schedule,
- * SilcTaskEvent type, uint32 fd,
+ * SilcTaskEvent type, SilcUInt32 fd,
* void *context);
*
* DESCRIPTION
*
***/
typedef void (*SilcTaskCallback)(SilcSchedule schedule, SilcTaskEvent type,
- uint32 fd, void *context);
+ SilcUInt32 fd, void *context);
/* Macros */
*/
#define SILC_TASK_CALLBACK(func) \
static void func(SilcSchedule schedule, SilcTaskEvent type, \
- uint32 fd, void *context)
+ SilcUInt32 fd, void *context)
/***/
/****d* silcutil/SilcScheduleAPI/SILC_TASK_CALLBACK_GLOBAL
*/
#define SILC_TASK_CALLBACK_GLOBAL(func) \
void func(SilcSchedule schedule, SilcTaskEvent type, \
- uint32 fd, void *context)
+ SilcUInt32 fd, void *context)
/***/
/* Prototypes */
*
* SYNOPSIS
*
- * SilcTask silc_schedule_task_add(SilcSchedule schedule, uint32 fd,
+ * SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
* SilcTaskCallback callback,
* void *context,
* long seconds, long useconds,
* in other threads as well.
*
***/
-SilcTask silc_schedule_task_add(SilcSchedule schedule, uint32 fd,
+SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
SilcTaskCallback callback, void *context,
long seconds, long useconds,
SilcTaskType type,
*
* SYNOPSIS
*
- * void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd);
+ * void silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd);
*
* DESCRIPTION
*
* since generic tasks does not match any specific fd.
*
***/
-void silc_schedule_task_del_by_fd(SilcSchedule schedule, uint32 fd);
+void silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd);
/****f* silcutil/SilcScheduleAPI/silc_schedule_task_del_by_callback
*
*
* SYNOPSIS
*
- * void silc_schedule_set_listen_fd(SilcSchedule schedule, uint32 fd,
+ * void silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
* SilcTaskEvent mask);
*
* DESCRIPTION
* times to change the events.
*
***/
-void silc_schedule_set_listen_fd(SilcSchedule schedule, uint32 fd,
+void silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
SilcTaskEvent mask);
/****f* silcutil/SilcScheduleAPI/silc_schedule_unset_listen_fd
*
* SYNOPSIS
*
- * void silc_schedule_unset_listen_fd(SilcSchedule schedule, uint32 fd);
+ * void silc_schedule_unset_listen_fd(SilcSchedule schedule, SilcUInt32 fd);
*
* DESCRIPTION
*
* after calling this function.
*
***/
-void silc_schedule_unset_listen_fd(SilcSchedule schedule, uint32 fd);
+void silc_schedule_unset_listen_fd(SilcSchedule schedule, SilcUInt32 fd);
#endif
/* Schedule FD structure. Includes the file descriptors that the scheduler
will listen. This is given as argument to the silc_select function. */
typedef struct {
- uint32 fd; /* The file descriptor (or handle on WIN32) */
- uint16 events; /* Mask of task events, if events is 0 then
+ SilcUInt32 fd; /* The file descriptor (or handle on WIN32) */
+ SilcUInt16 events; /* Mask of task events, if events is 0 then
the fd must be omitted. */
- uint16 revents; /* Returned events mask */
+ SilcUInt16 revents; /* Returned events mask */
} *SilcScheduleFd;
#endif
/* Heartbeat context */
struct SilcSocketConnectionHBStruct {
- uint32 heartbeat;
+ SilcUInt32 heartbeat;
SilcSocketConnectionHBCb hb_callback;
void *hb_context;
SilcSchedule schedule;
`schedule' is the application's scheduler. */
void silc_socket_set_heartbeat(SilcSocketConnection sock,
- uint32 heartbeat,
+ SilcUInt32 heartbeat,
void *hb_context,
SilcSocketConnectionHBCb hb_callback,
SilcSchedule schedule)
* Protocol object for the socket. Currently only one protocol can be
* executing at a time for a particular socket.
*
- * uint32 flags
+ * SilcUInt32 flags
*
* Socket flags that indicate the status of the socket. This can
* indicate several different status that can affect the use of the
*
* char *hostname
* char *ip
- * uint16 port
+ * SilcUInt16 port
*
* Resolved hostname, IP address and port of the connection who owns
* this object.
SilcSocketType type;
void *user_data;
SilcProtocol protocol;
- uint32 flags;
- uint8 sock_error;
+ SilcUInt32 flags;
+ SilcUInt8 sock_error;
int users;
char *hostname;
char *ip;
- uint16 port;
+ SilcUInt16 port;
SilcBuffer inbuf;
SilcBuffer outbuf;
* SYNOPSIS
*
* bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- * uint32 error_len);
+ * SilcUInt32 error_len);
*
* DESCRIPTION
*
*
***/
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len);
+ SilcUInt32 error_len);
/****f* silcutil/SilcSocketConnectionAPI/SilcSocketConnectionHBCb
*
* SYNOPSIS
*
* void silc_socket_set_heartbeat(SilcSocketConnection sock,
- * uint32 heartbeat,
+ * SilcUInt32 heartbeat,
* void *hb_context,
* SilcSocketConnectionHBCb hb_callback,
* SilcSchedule schedule);
*
***/
void silc_socket_set_heartbeat(SilcSocketConnection sock,
- uint32 heartbeat,
+ SilcUInt32 heartbeat,
void *hb_context,
SilcSocketConnectionHBCb hb_callback,
SilcSchedule schedule);
data string. Note: This is originally public domain code and is
still PD. */
-char *silc_encode_pem(unsigned char *data, uint32 len)
+char *silc_encode_pem(unsigned char *data, SilcUInt32 len)
{
int i, j;
- uint32 bits, c, char_count;
+ SilcUInt32 bits, c, char_count;
char *pem;
char_count = 0;
/* Same as above but puts newline ('\n') every 72 characters. */
-char *silc_encode_pem_file(unsigned char *data, uint32 data_len)
+char *silc_encode_pem_file(unsigned char *data, SilcUInt32 data_len)
{
int i, j;
- uint32 len, cols;
+ SilcUInt32 len, cols;
char *pem, *pem2;
pem = silc_encode_pem(data, data_len);
/* Decodes PEM into data. Returns the decoded data. Note: This is
originally public domain code and is still PD. */
-unsigned char *silc_decode_pem(unsigned char *pem, uint32 pem_len,
- uint32 *ret_len)
+unsigned char *silc_decode_pem(unsigned char *pem, SilcUInt32 pem_len,
+ SilcUInt32 *ret_len)
{
int i, j;
- uint32 len, c, char_count, bits;
+ SilcUInt32 len, c, char_count, bits;
unsigned char *data;
static char ialpha[256], decoder[256];
bool silc_parse_userfqdn(const char *string, char **left, char **right)
{
- uint32 tlen;
+ SilcUInt32 tlen;
if (!string)
return FALSE;
void silc_parse_command_line(unsigned char *buffer,
unsigned char ***parsed,
- uint32 **parsed_lens,
- uint32 **parsed_types,
- uint32 *parsed_num,
- uint32 max_args)
+ SilcUInt32 **parsed_lens,
+ SilcUInt32 **parsed_types,
+ SilcUInt32 *parsed_num,
+ SilcUInt32 max_args)
{
int i, len = 0;
int argc = 0;
static char rid[256];
-char *silc_id_render(void *id, uint16 type)
+char *silc_id_render(void *id, SilcUInt16 type)
{
char tmp[100];
unsigned char tmps[2];
this is used usually with nicknames, channel and server names to provide
case insensitive keys. */
-uint32 silc_hash_string(void *key, void *user_context)
+SilcUInt32 silc_hash_string(void *key, void *user_context)
{
char *s = (char *)key;
- uint32 h = 0, g;
+ SilcUInt32 h = 0, g;
while (*s != '\0') {
h = (h << 4) + tolower(*s);
/* Basic hash function to hash integers. May be used with the SilcHashTable. */
-uint32 silc_hash_uint(void *key, void *user_context)
+SilcUInt32 silc_hash_uint(void *key, void *user_context)
{
- return *(uint32 *)key;
+ return *(SilcUInt32 *)key;
}
/* Basic hash funtion to hash pointers. May be used with the SilcHashTable. */
-uint32 silc_hash_ptr(void *key, void *user_context)
+SilcUInt32 silc_hash_ptr(void *key, void *user_context)
{
- return (uint32)key;
+ return (SilcUInt32)key;
}
/* Hash a ID. The `user_context' is the ID type. */
-uint32 silc_hash_id(void *key, void *user_context)
+SilcUInt32 silc_hash_id(void *key, void *user_context)
{
- SilcIdType id_type = (SilcIdType)(uint32)user_context;
- uint32 h = 0;
+ SilcIdType id_type = (SilcIdType)(SilcUInt32)user_context;
+ SilcUInt32 h = 0;
int i;
switch (id_type) {
case SILC_ID_CLIENT:
{
SilcClientID *id = (SilcClientID *)key;
- uint32 g;
+ SilcUInt32 g;
/* The client ID is hashed by hashing the hash of the ID
(which is a truncated MD5 hash of the nickname) so that we
/* Hash binary data. The `user_context' is the data length. */
-uint32 silc_hash_data(void *key, void *user_context)
+SilcUInt32 silc_hash_data(void *key, void *user_context)
{
- uint32 len = (uint32)user_context, h = 0;
+ SilcUInt32 len = (SilcUInt32)user_context, h = 0;
unsigned char *data = (unsigned char *)key;
int i;
bool silc_hash_id_compare(void *key1, void *key2, void *user_context)
{
- SilcIdType id_type = (SilcIdType)(uint32)user_context;
+ SilcIdType id_type = (SilcIdType)(SilcUInt32)user_context;
return (id_type == SILC_ID_CLIENT ?
SILC_ID_COMPARE_HASH((SilcClientID *)key1, (SilcClientID *)key2) :
SILC_ID_COMPARE_TYPE(key1, key2, id_type));
bool silc_hash_data_compare(void *key1, void *key2, void *user_context)
{
- uint32 len = (uint32)user_context;
+ SilcUInt32 len = (SilcUInt32)user_context;
return !memcmp(key1, key2, len);
}
/* Parses mode mask and returns the mode as string. */
-char *silc_client_chmode(uint32 mode, const char *cipher, const char *hmac)
+char *silc_client_chmode(SilcUInt32 mode, const char *cipher, const char *hmac)
{
char string[100];
/* Parses channel user mode mask and returns te mode as string */
-char *silc_client_chumode(uint32 mode)
+char *silc_client_chumode(SilcUInt32 mode)
{
char string[4];
/* Parses channel user mode and returns it as special mode character. */
-char *silc_client_chumode_char(uint32 mode)
+char *silc_client_chumode_char(SilcUInt32 mode)
{
char string[4];
/* Creates fingerprint from data, usually used with SHA1 digests */
-char *silc_fingerprint(const unsigned char *data, uint32 data_len)
+char *silc_fingerprint(const unsigned char *data, SilcUInt32 data_len)
{
char fingerprint[64], *cp;
int i;
int silc_check_line(char *buf);
char *silc_get_time();
char *silc_to_upper(char *string);
-char *silc_encode_pem(unsigned char *data, uint32 len);
-char *silc_encode_pem_file(unsigned char *data, uint32 data_len);
-unsigned char *silc_decode_pem(unsigned char *pem, uint32 pem_len,
- uint32 *ret_len);
+char *silc_encode_pem(unsigned char *data, SilcUInt32 len);
+char *silc_encode_pem_file(unsigned char *data, SilcUInt32 data_len);
+unsigned char *silc_decode_pem(unsigned char *pem, SilcUInt32 pem_len,
+ SilcUInt32 *ret_len);
bool silc_parse_userfqdn(const char *string, char **left, char **right);
void silc_parse_command_line(unsigned char *buffer,
unsigned char ***parsed,
- uint32 **parsed_lens,
- uint32 **parsed_types,
- uint32 *parsed_num,
- uint32 max_args);
+ SilcUInt32 **parsed_lens,
+ SilcUInt32 **parsed_types,
+ SilcUInt32 *parsed_num,
+ SilcUInt32 max_args);
char *silc_format(char *fmt, ...);
-char *silc_id_render(void *id, uint16 type);
+char *silc_id_render(void *id, SilcUInt16 type);
int silc_string_compare(char *string1, char *string2);
char *silc_string_regexify(const char *string);
int silc_string_regex_match(const char *regex, const char *string);
int silc_string_match(const char *string1, const char *string2);
char *silc_get_username();
char *silc_get_real_name();
-uint32 silc_hash_string(void *key, void *user_context);
-uint32 silc_hash_uint(void *key, void *user_context);
-uint32 silc_hash_ptr(void *key, void *user_context);
-uint32 silc_hash_id(void *key, void *user_context);
-uint32 silc_hash_data(void *key, void *user_context);
+SilcUInt32 silc_hash_string(void *key, void *user_context);
+SilcUInt32 silc_hash_uint(void *key, void *user_context);
+SilcUInt32 silc_hash_ptr(void *key, void *user_context);
+SilcUInt32 silc_hash_id(void *key, void *user_context);
+SilcUInt32 silc_hash_data(void *key, void *user_context);
bool silc_hash_string_compare(void *key1, void *key2, void *user_context);
bool silc_hash_id_compare(void *key1, void *key2, void *user_context);
bool silc_hash_client_id_compare(void *key1, void *key2, void *user_context);
bool silc_hash_data_compare(void *key1, void *key2, void *user_context);
-char *silc_client_chmode(uint32 mode, const char *cipher, const char *hmac);
-char *silc_client_chumode(uint32 mode);
-char *silc_client_chumode_char(uint32 mode);
+char *silc_client_chmode(SilcUInt32 mode, const char *cipher, const char *hmac);
+char *silc_client_chumode(SilcUInt32 mode);
+char *silc_client_chumode_char(SilcUInt32 mode);
int silc_gettimeofday(struct timeval *p);
-char *silc_fingerprint(const unsigned char *data, uint32 data_len);
+char *silc_fingerprint(const unsigned char *data, SilcUInt32 data_len);
#endif
} while(0)
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len)
+ SilcUInt32 error_len)
{
if (sock->sock_error == KErrNone)
return FALSE;
/* Converts the IP number string from numbers-and-dots notation to
binary form. */
-bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len)
+bool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len)
{
int ret = 0;
/* Calls normal select() system call. */
-int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout)
+int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count, struct timeval *timeout)
{
fd_set in, out;
int ret, i, max_fd = 0;
/* Returns human readable socket error message */
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len)
+ SilcUInt32 error_len)
{
char *err;
/* Converts the IP number string from numbers-and-dots notation to
binary form. */
-bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len)
+bool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len)
{
unsigned long ret;
*/
-int silc_select(SilcScheduleFd fds, uint32 fds_count, struct timeval *timeout)
+int silc_select(SilcScheduleFd fds, SilcUInt32 fds_count, struct timeval *timeout)
{
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
DWORD ready, curtime, timeo;
/* Returns human readable socket error message */
bool silc_socket_get_error(SilcSocketConnection sock, char *error,
- uint32 error_len)
+ SilcUInt32 error_len)
{
/* XXX TODO */
return FALSE;
int silc_gettimeofday(struct timeval *tv)
{
FILETIME ft;
- __int64 msec;
+ __SilcInt64 msec;
GetSystemTimeAsFileTime(&ft);
- msec = (__int64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
+ msec = (__SilcInt64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
msec = (msec - FILETIME_1970) / 10;
tv->tv_sec = (long) (msec / 1000000);
tv->tv_usec = (long) (msec % 1000000);
-// testi2.cpp : Defines the entry point for the application.\r
-//\r
-\r
-#define FD_SETSIZE 5000\r
-#include "stdafx.h"\r
-#include "resource.h"\r
-#include <winsock2.h>\r
-#include <mswsock.h>\r
-extern "C"\r
-{\r
-#define FD_SETSIZE 5000\r
-#include "silcincludes.h"\r
-#include "clientlibincludes.h"\r
-}\r
-\r
-#define MAX_LOADSTRING 100\r
-\r
-// Global Variables:\r
-HINSTANCE hInst; // current instance\r
-TCHAR szTitle[MAX_LOADSTRING]; // The title bar text\r
-TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text\r
-\r
-// Foward declarations of functions included in this code module:\r
-ATOM MyRegisterClass(HINSTANCE hInstance);\r
-BOOL InitInstance(HINSTANCE, int);\r
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\r
-LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);\r
-\r
-void silc_op_say(SilcClient client, SilcClientConnection conn, \r
- SilcClientMessageType type, char *msg, ...)\r
-{\r
- va_list vp;\r
- char message[2048];\r
-\r
- memset(message, 0, sizeof(message));\r
- strncat(message, "\n*** ", 5);\r
-\r
- va_start(vp, msg);\r
- vsprintf(message + 5, msg, vp);\r
- va_end(vp);\r
-\r
- MessageBox( NULL, (char *)message, "say", MB_OK | MB_ICONINFORMATION );\r
-}\r
-\r
-void silc_notify(SilcClient client, SilcClientConnection conn, \r
- SilcNotifyType type, ...)\r
-{\r
-\r
-}\r
-\r
-void silc_connect(SilcClient client, SilcClientConnection conn, int success)\r
-{\r
-\r
-}\r
-\r
-int silc_auth_meth(SilcClient client, SilcClientConnection conn,\r
- char *hostname, uint16 port,\r
- SilcProtocolAuthMeth *auth_meth,\r
- unsigned char **auth_data,\r
- uint32 *auth_data_len)\r
-{\r
- *auth_meth = SILC_AUTH_NONE;\r
- return TRUE;\r
-}\r
-void silc_verify_public_key(SilcClient client, SilcClientConnection conn,\r
- SilcSocketType conn_type, unsigned char *pk, \r
- uint32 pk_len, SilcSKEPKType pk_type,\r
- SilcVerifyPublicKey completion, void *context)\r
-{\r
- completion(TRUE, context);\r
-}\r
-\r
-void silc_command_reply(SilcClient client, SilcClientConnection conn,\r
- SilcCommandPayload cmd_payload, int success,\r
- SilcCommand command, SilcCommandStatus status, ...)\r
-{\r
-\r
-}\r
-\r
-/* SILC client operations */\r
-SilcClientOperations ops = {\r
- silc_op_say,\r
- NULL,\r
- NULL,\r
- silc_notify,\r
- NULL,\r
- silc_command_reply,\r
- silc_connect,\r
- NULL,\r
- silc_auth_meth,\r
- silc_verify_public_key,\r
-};\r
-\r
-SILC_TASK_CALLBACK(connect_client)\r
-{\r
- SilcClient client = (SilcClient)context;\r
- silc_client_connect_to_server(client, 1334, "leevi.kuo.fi.ssh.com", NULL);\r
-}\r
-\r
-void silc_log(char *message)\r
-{\r
-}\r
-\r
-void silc_debugl(char *file, char *function, \r
- int line, char *message)\r
-{\r
- char m[5000];\r
- memcpy(m, message, strlen(message));\r
- m[strlen(message)] = '\n';\r
- m[strlen(message) + 1] = 0;\r
- OutputDebugString(m);\r
-}\r
-\r
-void silc_hexdumpl(char *file, char *function, \r
- int line, unsigned char *data_in,\r
- uint32 data_len, char *message)\r
-{\r
- int i, k;\r
- int off, pos, count;\r
- unsigned char *data = (unsigned char *)data_in;\r
- char m[10000], *cp;\r
- int len = data_len;\r
- \r
-// memset(m, 0, sizeof(m));\r
-\r
- cp = m;\r
- snprintf(cp, 10000, "%s:%d: %s\n", function, line, message);\r
- cp += strlen(cp);\r
-\r
- k = 0;\r
- off = len % 16;\r
- pos = 0;\r
- count = 16;\r
- while (1) {\r
-\r
- if (off) {\r
- if ((len - pos) < 16 && (len - pos <= len - off))\r
- count = off;\r
- } else {\r
- if (pos == len)\r
- count = 0;\r
- }\r
- if (off == len)\r
- count = len;\r
-\r
- if (count) {\r
- snprintf(cp, sizeof(m), "%08X ", k++ * 16);\r
- cp += strlen(cp);\r
- }\r
-\r
- for (i = 0; i < count; i++) {\r
- snprintf(cp, sizeof(m), "%02X ", data[pos + i]);\r
- cp += strlen(cp);\r
- \r
- if ((i + 1) % 4 == 0) {\r
- snprintf(cp, sizeof(m), " ");\r
- cp += strlen(cp);\r
- }\r
- }\r
-\r
- if (count && count < 16) {\r
- int j;\r
- \r
- for (j = 0; j < 16 - count; j++) {\r
- snprintf(cp, sizeof(m), " ");\r
- cp += strlen(cp);\r
- \r
- if ((j + count + 1) % 4 == 0) {\r
- snprintf(cp, sizeof(m), " ");\r
- cp += strlen(cp);\r
- }\r
- }\r
- }\r
- \r
- for (i = 0; i < count; i++) {\r
- char ch;\r
- \r
- if (data[pos] < 32 || data[pos] >= 127)\r
- ch = '.';\r
- else\r
- ch = data[pos];\r
-\r
- snprintf(cp, sizeof(m), "%c", ch);\r
- cp += strlen(cp);\r
- pos++;\r
- }\r
-\r
- if (count) {\r
- snprintf(cp, sizeof(m), "\n");\r
- cp += strlen(cp);\r
- }\r
-\r
- if (count < 16)\r
- break;\r
- }\r
- \r
- OutputDebugString(m);\r
- MessageBox( NULL, (char *)m, "hexdump", MB_OK | MB_ICONINFORMATION );\r
-}\r
-\r
-static int \r
-silc_create_key_pair(char *pkcs_name, int bits, char *path,\r
- char *identifier, \r
- SilcPublicKey *ret_pub_key,\r
- SilcPrivateKey *ret_prv_key)\r
-{\r
- SilcPKCS pkcs;\r
- SilcPublicKey pub_key;\r
- SilcPrivateKey prv_key;\r
- SilcRng rng;\r
- unsigned char *key;\r
- uint32 key_len;\r
- char pkfile[256], prvfile[256];\r
-\r
- if (!pkcs_name || !path)\r
- return FALSE;\r
-\r
- if (!bits)\r
- bits = 1024;\r
-\r
- rng = silc_rng_alloc();\r
- silc_rng_init(rng);\r
- silc_rng_global_init(rng);\r
-\r
- /* Generate keys */\r
- silc_pkcs_alloc((const unsigned char *)pkcs_name, &pkcs);\r
- pkcs->pkcs->init(pkcs->context, bits, rng);\r
-\r
- /* Save public key into file */\r
- key = silc_pkcs_get_public_key(pkcs, &key_len);\r
- pub_key = silc_pkcs_public_key_alloc(pkcs->pkcs->name, identifier,\r
- key, key_len);\r
- *ret_pub_key = pub_key;\r
-\r
- memset(key, 0, sizeof(key_len));\r
- silc_free(key);\r
-\r
- /* Save private key into file */\r
- key = silc_pkcs_get_private_key(pkcs, &key_len);\r
- prv_key = silc_pkcs_private_key_alloc(pkcs->pkcs->name, key, key_len);\r
- *ret_prv_key = prv_key;\r
-\r
- memset(key, 0, sizeof(key_len));\r
- silc_free(key);\r
-\r
- silc_rng_free(rng);\r
- silc_pkcs_free(pkcs);\r
-\r
- return TRUE;\r
-}\r
-\r
-\r
-int APIENTRY WinMain(HINSTANCE hInstance,\r
- HINSTANCE hPrevInstance,\r
- LPSTR lpCmdLine,\r
- int nCmdShow)\r
-{\r
- // TODO: Place code here.\r
- MSG msg;\r
- HACCEL hAccelTable;\r
- HANDLE h;\r
- HANDLE handles[100];\r
- SOCKET s;\r
- unsigned int k;\r
- WSAEVENT e, e2, e3;\r
- int ret;\r
- DWORD ready;\r
- HMODULE mod;\r
-\r
- // Initialize global strings\r
- LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);\r
- LoadString(hInstance, IDC_TESTI2, szWindowClass, MAX_LOADSTRING);\r
- MyRegisterClass(hInstance);\r
-\r
- // Perform application initialization:\r
- if (!InitInstance (hInstance, nCmdShow)) \r
- {\r
- return FALSE;\r
- }\r
-\r
- hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTI2);\r
-\r
- {\r
- SilcSchedule sched; \r
- SilcClient client;\r
-\r
- silc_net_win32_init();\r
- client = silc_client_alloc(&ops, NULL, NULL, "SILC-1.0-0.5.1");\r
- client->realname = "pekka riikonen";\r
- client->username = "priikone";\r
- client->hostname = "leevi.kuo.fi.ssh.com";\r
-\r
- silc_cipher_register_default();\r
- silc_pkcs_register_default();\r
- silc_hash_register_default();\r
- silc_hmac_register_default();\r
-\r
- silc_debug = TRUE;\r
- silc_log_set_debug_callbacks(silc_debugl, silc_hexdumpl);\r
-\r
- silc_create_key_pair("rsa", 1024, "kk", "UN=priikone, HN=pelle.kuo.fi.ssh.com", \r
- &client->public_key, &client->private_key);\r
-\r
- silc_client_init(client);\r
-\r
- silc_schedule_task_add(client->schedule, 0, connect_client, \r
- client, 0, 1, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL); \r
-\r
- silc_client_run(client); \r
- }\r
- \r
- return msg.wParam;\r
-}\r
-\r
-//\r
-// FUNCTION: MyRegisterClass()\r
-//\r
-// PURPOSE: Registers the window class.\r
-//\r
-// COMMENTS:\r
-//\r
-// This function and its usage is only necessary if you want this code\r
-// to be compatible with Win32 systems prior to the 'RegisterClassEx'\r
-// function that was added to Windows 95. It is important to call this function\r
-// so that the application will get 'well formed' small icons associated\r
-// with it.\r
-//\r
-ATOM MyRegisterClass(HINSTANCE hInstance)\r
-{\r
- WNDCLASSEX wcex;\r
-\r
- wcex.cbSize = sizeof(WNDCLASSEX); \r
-\r
- wcex.style = CS_HREDRAW | CS_VREDRAW;\r
- wcex.lpfnWndProc = (WNDPROC)WndProc;\r
- wcex.cbClsExtra = 0;\r
- wcex.cbWndExtra = 0;\r
- wcex.hInstance = hInstance;\r
- wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TESTI2);\r
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);\r
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);\r
- wcex.lpszMenuName = (LPCSTR)IDC_TESTI2;\r
- wcex.lpszClassName = szWindowClass;\r
- wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);\r
-\r
- return RegisterClassEx(&wcex);\r
-}\r
-\r
-//\r
-// FUNCTION: InitInstance(HANDLE, int)\r
-//\r
-// PURPOSE: Saves instance handle and creates main window\r
-//\r
-// COMMENTS:\r
-//\r
-// In this function, we save the instance handle in a global variable and\r
-// create and display the main program window.\r
-//\r
-BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)\r
-{\r
- HWND hWnd;\r
-\r
- hInst = hInstance; // Store instance handle in our global variable\r
-\r
- hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,\r
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);\r
-\r
- if (!hWnd)\r
- {\r
- LPVOID lpMsgBuf;\r
- FormatMessage( \r
- FORMAT_MESSAGE_ALLOCATE_BUFFER | \r
- FORMAT_MESSAGE_FROM_SYSTEM | \r
- FORMAT_MESSAGE_IGNORE_INSERTS,\r
- NULL,\r
- GetLastError(),\r
- 0, // Default language\r
- (LPTSTR) &lpMsgBuf,\r
- 0,\r
- NULL \r
- );\r
- // Process any inserts in lpMsgBuf.\r
- // ...\r
- // Display the string.\r
- MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );\r
- // Free the buffer.\r
- LocalFree( lpMsgBuf );\r
-\r
- return FALSE;\r
- }\r
-\r
- ShowWindow(hWnd, nCmdShow);\r
- UpdateWindow(hWnd);\r
-\r
- return TRUE;\r
-}\r
-\r
-//\r
-// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)\r
-//\r
-// PURPOSE: Processes messages for the main window.\r
-//\r
-// WM_COMMAND - process the application menu\r
-// WM_PAINT - Paint the main window\r
-// WM_DESTROY - post a quit message and return\r
-//\r
-//\r
-LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
-{\r
- int wmId, wmEvent;\r
- PAINTSTRUCT ps;\r
- HDC hdc;\r
- TCHAR szHello[MAX_LOADSTRING];\r
- LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);\r
-\r
- switch (message) \r
- {\r
- case WM_COMMAND:\r
- wmId = LOWORD(wParam); \r
- wmEvent = HIWORD(wParam); \r
- // Parse the menu selections:\r
- switch (wmId)\r
- {\r
- case IDM_ABOUT:\r
- DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);\r
- break;\r
- case IDM_EXIT:\r
- DestroyWindow(hWnd);\r
- break;\r
- default:\r
- return DefWindowProc(hWnd, message, wParam, lParam);\r
- }\r
- break;\r
- case WM_PAINT:\r
- hdc = BeginPaint(hWnd, &ps);\r
- // TODO: Add any drawing code here...\r
- RECT rt;\r
- GetClientRect(hWnd, &rt);\r
- DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);\r
- EndPaint(hWnd, &ps);\r
- break;\r
- case WM_DESTROY:\r
- PostQuitMessage(0);\r
- break;\r
- default:\r
- return DefWindowProc(hWnd, message, wParam, lParam);\r
- }\r
- return 0;\r
-}\r
-\r
-// Mesage handler for about box.\r
-LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
-{\r
- switch (message)\r
- {\r
- case WM_INITDIALOG:\r
- return TRUE;\r
-\r
- case WM_COMMAND:\r
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) \r
- {\r
- EndDialog(hDlg, LOWORD(wParam));\r
- return TRUE;\r
- }\r
- break;\r
- }\r
- return FALSE;\r
-}\r
+// testi2.cpp : Defines the entry point for the application.
+//
+
+#define FD_SETSIZE 5000
+#include "stdafx.h"
+#include "resource.h"
+#include <winsock2.h>
+#include <mswsock.h>
+extern "C"
+{
+#define FD_SETSIZE 5000
+#include "silcincludes.h"
+#include "clientlibincludes.h"
+}
+
+#define MAX_LOADSTRING 100
+
+// Global Variables:
+HINSTANCE hInst; // current instance
+TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
+TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
+
+// Foward declarations of functions included in this code module:
+ATOM MyRegisterClass(HINSTANCE hInstance);
+BOOL InitInstance(HINSTANCE, int);
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
+
+void silc_op_say(SilcClient client, SilcClientConnection conn,
+ SilcClientMessageType type, char *msg, ...)
+{
+ va_list vp;
+ char message[2048];
+
+ memset(message, 0, sizeof(message));
+ strncat(message, "\n*** ", 5);
+
+ va_start(vp, msg);
+ vsprintf(message + 5, msg, vp);
+ va_end(vp);
+
+ MessageBox( NULL, (char *)message, "say", MB_OK | MB_ICONINFORMATION );
+}
+
+void silc_notify(SilcClient client, SilcClientConnection conn,
+ SilcNotifyType type, ...)
+{
+
+}
+
+void silc_connect(SilcClient client, SilcClientConnection conn, int success)
+{
+
+}
+
+int silc_auth_meth(SilcClient client, SilcClientConnection conn,
+ char *hostname, SilcUInt16 port,
+ SilcProtocolAuthMeth *auth_meth,
+ unsigned char **auth_data,
+ SilcUInt32 *auth_data_len)
+{
+ *auth_meth = SILC_AUTH_NONE;
+ return TRUE;
+}
+void silc_verify_public_key(SilcClient client, SilcClientConnection conn,
+ SilcSocketType conn_type, unsigned char *pk,
+ SilcUInt32 pk_len, SilcSKEPKType pk_type,
+ SilcVerifyPublicKey completion, void *context)
+{
+ completion(TRUE, context);
+}
+
+void silc_command_reply(SilcClient client, SilcClientConnection conn,
+ SilcCommandPayload cmd_payload, int success,
+ SilcCommand command, SilcCommandStatus status, ...)
+{
+
+}
+
+/* SILC client operations */
+SilcClientOperations ops = {
+ silc_op_say,
+ NULL,
+ NULL,
+ silc_notify,
+ NULL,
+ silc_command_reply,
+ silc_connect,
+ NULL,
+ silc_auth_meth,
+ silc_verify_public_key,
+};
+
+SILC_TASK_CALLBACK(connect_client)
+{
+ SilcClient client = (SilcClient)context;
+ silc_client_connect_to_server(client, 1334, "leevi.kuo.fi.ssh.com", NULL);
+}
+
+void silc_log(char *message)
+{
+}
+
+void silc_debugl(char *file, char *function,
+ int line, char *message)
+{
+ char m[5000];
+ memcpy(m, message, strlen(message));
+ m[strlen(message)] = '\n';
+ m[strlen(message) + 1] = 0;
+ OutputDebugString(m);
+}
+
+void silc_hexdumpl(char *file, char *function,
+ int line, unsigned char *data_in,
+ SilcUInt32 data_len, char *message)
+{
+ int i, k;
+ int off, pos, count;
+ unsigned char *data = (unsigned char *)data_in;
+ char m[10000], *cp;
+ int len = data_len;
+
+// memset(m, 0, sizeof(m));
+
+ cp = m;
+ snprintf(cp, 10000, "%s:%d: %s\n", function, line, message);
+ cp += strlen(cp);
+
+ k = 0;
+ off = len % 16;
+ pos = 0;
+ count = 16;
+ while (1) {
+
+ if (off) {
+ if ((len - pos) < 16 && (len - pos <= len - off))
+ count = off;
+ } else {
+ if (pos == len)
+ count = 0;
+ }
+ if (off == len)
+ count = len;
+
+ if (count) {
+ snprintf(cp, sizeof(m), "%08X ", k++ * 16);
+ cp += strlen(cp);
+ }
+
+ for (i = 0; i < count; i++) {
+ snprintf(cp, sizeof(m), "%02X ", data[pos + i]);
+ cp += strlen(cp);
+
+ if ((i + 1) % 4 == 0) {
+ snprintf(cp, sizeof(m), " ");
+ cp += strlen(cp);
+ }
+ }
+
+ if (count && count < 16) {
+ int j;
+
+ for (j = 0; j < 16 - count; j++) {
+ snprintf(cp, sizeof(m), " ");
+ cp += strlen(cp);
+
+ if ((j + count + 1) % 4 == 0) {
+ snprintf(cp, sizeof(m), " ");
+ cp += strlen(cp);
+ }
+ }
+ }
+
+ for (i = 0; i < count; i++) {
+ char ch;
+
+ if (data[pos] < 32 || data[pos] >= 127)
+ ch = '.';
+ else
+ ch = data[pos];
+
+ snprintf(cp, sizeof(m), "%c", ch);
+ cp += strlen(cp);
+ pos++;
+ }
+
+ if (count) {
+ snprintf(cp, sizeof(m), "\n");
+ cp += strlen(cp);
+ }
+
+ if (count < 16)
+ break;
+ }
+
+ OutputDebugString(m);
+ MessageBox( NULL, (char *)m, "hexdump", MB_OK | MB_ICONINFORMATION );
+}
+
+static int
+silc_create_key_pair(char *pkcs_name, int bits, char *path,
+ char *identifier,
+ SilcPublicKey *ret_pub_key,
+ SilcPrivateKey *ret_prv_key)
+{
+ SilcPKCS pkcs;
+ SilcPublicKey pub_key;
+ SilcPrivateKey prv_key;
+ SilcRng rng;
+ unsigned char *key;
+ SilcUInt32 key_len;
+ char pkfile[256], prvfile[256];
+
+ if (!pkcs_name || !path)
+ return FALSE;
+
+ if (!bits)
+ bits = 1024;
+
+ rng = silc_rng_alloc();
+ silc_rng_init(rng);
+ silc_rng_global_init(rng);
+
+ /* Generate keys */
+ silc_pkcs_alloc((const unsigned char *)pkcs_name, &pkcs);
+ pkcs->pkcs->init(pkcs->context, bits, rng);
+
+ /* Save public key into file */
+ key = silc_pkcs_get_public_key(pkcs, &key_len);
+ pub_key = silc_pkcs_public_key_alloc(pkcs->pkcs->name, identifier,
+ key, key_len);
+ *ret_pub_key = pub_key;
+
+ memset(key, 0, sizeof(key_len));
+ silc_free(key);
+
+ /* Save private key into file */
+ key = silc_pkcs_get_private_key(pkcs, &key_len);
+ prv_key = silc_pkcs_private_key_alloc(pkcs->pkcs->name, key, key_len);
+ *ret_prv_key = prv_key;
+
+ memset(key, 0, sizeof(key_len));
+ silc_free(key);
+
+ silc_rng_free(rng);
+ silc_pkcs_free(pkcs);
+
+ return TRUE;
+}
+
+
+int APIENTRY WinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine,
+ int nCmdShow)
+{
+ // TODO: Place code here.
+ MSG msg;
+ HACCEL hAccelTable;
+ HANDLE h;
+ HANDLE handles[100];
+ SOCKET s;
+ unsigned int k;
+ WSAEVENT e, e2, e3;
+ int ret;
+ DWORD ready;
+ HMODULE mod;
+
+ // Initialize global strings
+ LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
+ LoadString(hInstance, IDC_TESTI2, szWindowClass, MAX_LOADSTRING);
+ MyRegisterClass(hInstance);
+
+ // Perform application initialization:
+ if (!InitInstance (hInstance, nCmdShow))
+ {
+ return FALSE;
+ }
+
+ hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_TESTI2);
+
+ {
+ SilcSchedule sched;
+ SilcClient client;
+
+ silc_net_win32_init();
+ client = silc_client_alloc(&ops, NULL, NULL, "SILC-1.0-0.5.1");
+ client->realname = "pekka riikonen";
+ client->username = "priikone";
+ client->hostname = "leevi.kuo.fi.ssh.com";
+
+ silc_cipher_register_default();
+ silc_pkcs_register_default();
+ silc_hash_register_default();
+ silc_hmac_register_default();
+
+ silc_debug = TRUE;
+ silc_log_set_debug_callbacks(silc_debugl, silc_hexdumpl);
+
+ silc_create_key_pair("rsa", 1024, "kk", "UN=priikone, HN=pelle.kuo.fi.ssh.com",
+ &client->public_key, &client->private_key);
+
+ silc_client_init(client);
+
+ silc_schedule_task_add(client->schedule, 0, connect_client,
+ client, 0, 1, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+
+ silc_client_run(client);
+ }
+
+ return msg.wParam;
+}
+
+//
+// FUNCTION: MyRegisterClass()
+//
+// PURPOSE: Registers the window class.
+//
+// COMMENTS:
+//
+// This function and its usage is only necessary if you want this code
+// to be compatible with Win32 systems prior to the 'RegisterClassEx'
+// function that was added to Windows 95. It is important to call this function
+// so that the application will get 'well formed' small icons associated
+// with it.
+//
+ATOM MyRegisterClass(HINSTANCE hInstance)
+{
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW;
+ wcex.lpfnWndProc = (WNDPROC)WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TESTI2);
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszMenuName = (LPCSTR)IDC_TESTI2;
+ wcex.lpszClassName = szWindowClass;
+ wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
+
+ return RegisterClassEx(&wcex);
+}
+
+//
+// FUNCTION: InitInstance(HANDLE, int)
+//
+// PURPOSE: Saves instance handle and creates main window
+//
+// COMMENTS:
+//
+// In this function, we save the instance handle in a global variable and
+// create and display the main program window.
+//
+BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+ HWND hWnd;
+
+ hInst = hInstance; // Store instance handle in our global variable
+
+ hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
+
+ if (!hWnd)
+ {
+ LPVOID lpMsgBuf;
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ 0, // Default language
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL
+ );
+ // Process any inserts in lpMsgBuf.
+ // ...
+ // Display the string.
+ MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
+ // Free the buffer.
+ LocalFree( lpMsgBuf );
+
+ return FALSE;
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+ UpdateWindow(hWnd);
+
+ return TRUE;
+}
+
+//
+// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
+//
+// PURPOSE: Processes messages for the main window.
+//
+// WM_COMMAND - process the application menu
+// WM_PAINT - Paint the main window
+// WM_DESTROY - post a quit message and return
+//
+//
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ int wmId, wmEvent;
+ PAINTSTRUCT ps;
+ HDC hdc;
+ TCHAR szHello[MAX_LOADSTRING];
+ LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
+
+ switch (message)
+ {
+ case WM_COMMAND:
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
+ // Parse the menu selections:
+ switch (wmId)
+ {
+ case IDM_ABOUT:
+ DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
+ break;
+ case IDM_EXIT:
+ DestroyWindow(hWnd);
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ break;
+ case WM_PAINT:
+ hdc = BeginPaint(hWnd, &ps);
+ // TODO: Add any drawing code here...
+ RECT rt;
+ GetClientRect(hWnd, &rt);
+ DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
+ EndPaint(hWnd, &ps);
+ break;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+// Mesage handler for about box.
+LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ return TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}