updates. New data types.
[silc.git] / lib / silccore / id.h
index 56551c4ae02e2e236eb94209f536be183d76dc7c..8fe79ad377deead9d10100c9cd302ce4f68570af 100644 (file)
@@ -42,7 +42,7 @@
 #define SILC_ID_CHANNEL 3
 
 /* Type definition for the ID types. */
-typedef unsigned char SilcIdType;
+typedef uint16 SilcIdType;
 
 /* 
    64 bit SilcServerID structure:
@@ -53,8 +53,8 @@ typedef unsigned char SilcIdType;
 */
 typedef struct {
   struct in_addr ip;                           /* 32 bit IP */
-  unsigned short port;                         /* 16 bit port */
-  unsigned short rnd;                          /* 16 bit random number */
+  uint16 port;                         /* 16 bit port */
+  uint16 rnd;                          /* 16 bit random number */
 } SilcServerID;
 
 /* 
@@ -79,8 +79,8 @@ typedef struct {
 */
 typedef struct {
   struct in_addr ip;                           /* 32 bit IP */
-  unsigned short port;                         /* 16 bit port */
-  unsigned short rnd;                          /* 16 bit random number */
+  uint16 port;                         /* 16 bit port */
+  uint16 rnd;                          /* 16 bit random number */
 } SilcChannelID;
 
 /* Macros */
@@ -100,17 +100,22 @@ typedef struct {
 #define SILC_ID_SERVER_COMPARE(id1, id2) \
   SILC_ID_COMPARE(id1, id2, SILC_ID_SERVER_LEN)
 
+/* Compares Channel ID's */
+#define SILC_ID_CHANNEL_COMPARE(id1, id2) \
+  SILC_ID_COMPARE(id1, id2, SILC_ID_CHANNEL_LEN)
+
 /* Compares IP addresses from the ID's. */
 #define SILC_ID_COMPARE_IP(id1, id2) \
   SILC_ID_COMPARE(id1, id2, 4)
 
 /* Compare nickname hash from Client ID */
-#define SILC_ID_COMPARE_HASH(id, hash) \
-  memcmp(id->hash, hash, CLIENTID_HASH_LEN)
+#define SILC_ID_COMPARE_HASH(id, _hash) \
+  memcmp(id->hash, _hash, CLIENTID_HASH_LEN)
 
 /* Prototypes */
 unsigned char *silc_id_id2str(void *id, SilcIdType type);
-void *silc_id_str2id(unsigned char *id, SilcIdType type);
-unsigned int silc_id_get_len(SilcIdType type);
+void *silc_id_str2id(unsigned char *id, uint32 id_len, SilcIdType type);
+uint32 silc_id_get_len(SilcIdType type);
+void *silc_id_dup(void *id, SilcIdType type);
 
 #endif