Added SILC_ID_GET_ID.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 29 Nov 2006 19:53:25 +0000 (19:53 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 29 Nov 2006 19:53:25 +0000 (19:53 +0000)
lib/silccore/silcid.h

index e6a595c62fc6056c75cd5f511eafabd6183e4f44..216e29a19ded46d68f65a4a74b3446d476fc9e39 100644 (file)
@@ -184,6 +184,26 @@ typedef struct {
 
 /* Macros */
 
+/****d* silccore/SilcIDAPI/SILC_ID_GET_ID
+ *
+ * NAME
+ *
+ *    #define SILC_ID_GET_ID ...
+ *
+ * DESCRIPTION
+ *
+ *    Returns the ID type specific pointer from the SilcID structure.  As
+ *    the SilcID is able to house all types of IDs this macro can be used
+ *    to get the specific ID from the structure by its type.
+ *
+ * SOURCE
+ */
+#define SILC_ID_GET_ID(id)                                             \
+  ((id).type == SILC_ID_CLIENT  ? (void *)&(id).u.client_id :          \
+   (id).type == SILC_ID_SERVER  ? (void *)&(id).u.server_id :          \
+   (void *)&(id).u.channel_id)
+/***/
+
 /****d* silccore/SilcIDAPI/SILC_ID_COMPARE
  *
  * NAME