This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-unsigned char *silc_id_id2str(const void *id, SilcIdType type)
+unsigned char *silc_id_id2str(const void *id, SilcIdType type,
+ SilcUInt32 *ret_id_len)
SilcChannelID *channel_id;
SilcUInt32 id_len = silc_id_get_len(id, type);
SilcChannelID *channel_id;
SilcUInt32 id_len = silc_id_get_len(id, type);
return NULL;
memcpy(ret_id, client_id->ip.data, client_id->ip.data_len);
ret_id[client_id->ip.data_len] = client_id->rnd;
return NULL;
memcpy(ret_id, client_id->ip.data, client_id->ip.data_len);
ret_id[client_id->ip.data_len] = client_id->rnd;
-void *silc_id_str2id(const unsigned char *id, SilcUInt32 id_len,
- SilcIdType type)
+bool silc_id_str2id(const unsigned char *id, SilcUInt32 id_len,
+ SilcIdType type, void *ret_id)
memcpy(server_id->ip.data, id, (id_len > ID_SERVER_LEN_PART + 4 ?
16 : 4));
server_id->ip.data_len = (id_len > ID_SERVER_LEN_PART + 4 ? 16 : 4);
SILC_GET16_MSB(server_id->port, &id[server_id->ip.data_len]);
SILC_GET16_MSB(server_id->rnd, &id[server_id->ip.data_len + 2]);
memcpy(server_id->ip.data, id, (id_len > ID_SERVER_LEN_PART + 4 ?
16 : 4));
server_id->ip.data_len = (id_len > ID_SERVER_LEN_PART + 4 ? 16 : 4);
SILC_GET16_MSB(server_id->port, &id[server_id->ip.data_len]);
SILC_GET16_MSB(server_id->rnd, &id[server_id->ip.data_len + 2]);
memcpy(client_id->ip.data, id, (id_len > ID_CLIENT_LEN_PART + 4 ?
16 : 4));
client_id->ip.data_len = (id_len > ID_CLIENT_LEN_PART + 4 ? 16 : 4);
client_id->rnd = id[client_id->ip.data_len];
memcpy(client_id->ip.data, id, (id_len > ID_CLIENT_LEN_PART + 4 ?
16 : 4));
client_id->ip.data_len = (id_len > ID_CLIENT_LEN_PART + 4 ? 16 : 4);
client_id->rnd = id[client_id->ip.data_len];
memcpy(channel_id->ip.data, id, (id_len > ID_CHANNEL_LEN_PART + 4 ?
16 : 4));
channel_id->ip.data_len = (id_len > ID_CHANNEL_LEN_PART + 4 ? 16 : 4);
SILC_GET16_MSB(channel_id->port, &id[channel_id->ip.data_len]);
SILC_GET16_MSB(channel_id->rnd, &id[channel_id->ip.data_len + 2]);
memcpy(channel_id->ip.data, id, (id_len > ID_CHANNEL_LEN_PART + 4 ?
16 : 4));
channel_id->ip.data_len = (id_len > ID_CHANNEL_LEN_PART + 4 ? 16 : 4);
SILC_GET16_MSB(channel_id->port, &id[channel_id->ip.data_len]);
SILC_GET16_MSB(channel_id->rnd, &id[channel_id->ip.data_len + 2]);