Protocol version 1.2 integrations
[silc.git] / lib / silccore / silcattrs.h
index deb8a026b898a8738a0daa2b6a09a442424ac7a6..afcc019405b55bd3dac9492718a921c380ad1ed4 100644 (file)
@@ -66,24 +66,27 @@ typedef SilcUInt8 SilcAttribute;
 /* All defined attributes.  See the specs for detailed information.  The
    comment is the structure or data type that must be used with the
    silc_attribute_get_object function to fetch parsed attribute. */
-#define SILC_ATTRIBUTE_NONE                     0
-#define SILC_ATTRIBUTE_USER_INFO                1
-#define SILC_ATTRIBUTE_SERVICE                  2 /* SilcAttributeObjService */
-#define SILC_ATTRIBUTE_STATUS_MOOD              3 /* SilcAttributeMood */
-#define SILC_ATTRIBUTE_STATUS_FREETEXT          4 /* char * (UTF-8 string) */
-#define SILC_ATTRIBUTE_STATUS_MESSAGE           5 /* SilcAttributeObjMime */
-#define SILC_ATTRIBUTE_PREFERRED_LANGUAGE       6 /* char * (UTF-8 string) */
-#define SILC_ATTRIBUTE_PREFERRED_CONTACT        7 /* SilcAttributeContact */
-#define SILC_ATTRIBUTE_TIMEZONE                 8 /* char * (UTF-8 string) */
-#define SILC_ATTRIBUTE_GEOLOCATION              9 /* SilcAttributeObjGeo */
-#define SILC_ATTRIBUTE_DEVICE_INFO              10 /* SilcAttributeObjDevice */
-#define SILC_ATTRIBUTE_EXTENSION                11 /* SilcAttributeObjMime */
-#define SILC_ATTRIBUTE_USER_PUBLIC_KEY          12 /* SilcAttributeObjPk */
-#define SILC_ATTRIBUTE_SERVER_PUBLIC_KEY        13 /* SilcAttributeObjPk */
-#define SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE   14 /* SilcAttributeObjPk */
+#define SILC_ATTRIBUTE_NONE                   0
+#define SILC_ATTRIBUTE_USER_INFO              1 /* SilcVCard */
+#define SILC_ATTRIBUTE_SERVICE                2 /* SilcAttributeObjService */
+#define SILC_ATTRIBUTE_STATUS_MOOD            3 /* SilcAttributeMood */
+#define SILC_ATTRIBUTE_STATUS_FREETEXT        4 /* char * (UTF-8 string) */
+#define SILC_ATTRIBUTE_STATUS_MESSAGE         5 /* SilcAttributeObjMime */
+#define SILC_ATTRIBUTE_PREFERRED_LANGUAGE     6 /* char * (UTF-8 string) */
+#define SILC_ATTRIBUTE_PREFERRED_CONTACT      7 /* SilcAttributeContact */
+#define SILC_ATTRIBUTE_TIMEZONE               8 /* char * (UTF-8 string) */
+#define SILC_ATTRIBUTE_GEOLOCATION            9 /* SilcAttributeObjGeo */
+#define SILC_ATTRIBUTE_DEVICE_INFO            10 /* SilcAttributeObjDevice */
+#define SILC_ATTRIBUTE_EXTENSION              11 /* SilcAttributeObjMime */
+#define SILC_ATTRIBUTE_USER_PUBLIC_KEY        12 /* SilcAttributeObjPk */
+#define SILC_ATTRIBUTE_SERVER_PUBLIC_KEY      13 /* SilcAttributeObjPk */
+#define SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE 14 /* SilcAttributeObjPk */
 #define SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE 15 /* SilcAttributeObjPk */
 /***/
 
+/* Maximum length of attribute request packet */
+#define SILC_ATTRIBUTE_MAX_REQUEST_LEN (4 * 255)
+
 /****d* silccore/SilcAttributesAPI/SilcAttributeFlags
  *
  * NAME
@@ -347,13 +350,37 @@ SilcAttributeFlags silc_attribute_get_flags(SilcAttributePayload payload);
 const unsigned char *silc_attribute_get_data(SilcAttributePayload payload,
                                             SilcUInt32 *data_len);
 
+/****f* silccore/SilcAttributesAPI/silc_attribute_get_verify_data
+ *
+ * SYNOPSIS
+ *
+ *    unsigned char *
+ *    silc_attribute_get_verify_data(SilcDList attrs,
+ *                                   bool server_verification,
+ *                                   SilcUInt32 *data_len);
+ *
+ * DESCRIPTION
+ *
+ *    Constructs the data to be verified with the sender's digital
+ *    signature and sender's public key.  This allocates the data from
+ *    the list of attribute payloads and returns the buffer.  The caller
+ *    must free it.  If `server_verification' is FALSE then data is
+ *    constructed for user's digital signature verification, if it is
+ *    TRUE then it is constructed for server's digital signature
+ *    verification.
+ *
+ ***/
+unsigned char *silc_attribute_get_verify_data(SilcDList attrs,
+                                             bool server_verification,
+                                             SilcUInt32 *data_len);
+
 /* Object structures */
 
-/****s* silccore/SilcAttributesAPI/SilcAttributesObjService
+/****s* silccore/SilcAttributesAPI/SilcAttributeObjService
  *
  * NAME
  * 
- *    typedef struct { ... } SilcAttributesObjService;
+ *    typedef struct { ... } SilcAttributeObjService;
  *
  * DESCRIPTION
  *
@@ -363,16 +390,18 @@ const unsigned char *silc_attribute_get_data(SilcAttributePayload payload,
  */
 typedef struct {
   SilcUInt32 port;             /* IANA specified service port */
+  SilcUInt32 idle;             /* Idle time in the service */
+  char signon[64];             /* Signon date and time (UTC) */
   char address[256];           /* service address */
   bool status;                 /* online status (TRUE present in service) */
 } SilcAttributeObjService;
 /***/
 
-/****s* silccore/SilcAttributesAPI/SilcAttributesObjMime
+/****s* silccore/SilcAttributesAPI/SilcAttributeObjMime
  *
  * NAME
  * 
- *    typedef struct { ... } SilcAttributesObjMime;
+ *    typedef struct { ... } SilcAttributeObjMime;
  *
  * DESCRIPTION
  *
@@ -387,11 +416,11 @@ typedef struct {
 } SilcAttributeObjMime;
 /***/
 
-/****s* silccore/SilcAttributesAPI/SilcAttributesObjGeo
+/****s* silccore/SilcAttributesAPI/SilcAttributeObjGeo
  *
  * NAME
  * 
- *    typedef struct { ... } SilcAttributesObjGeo;
+ *    typedef struct { ... } SilcAttributeObjGeo;
  *
  * DESCRIPTION
  *
@@ -408,11 +437,11 @@ typedef struct {
 } SilcAttributeObjGeo;
 /***/
 
-/****s* silccore/SilcAttributesAPI/SilcAttributesObjDevice
+/****s* silccore/SilcAttributesAPI/SilcAttributeObjDevice
  *
  * NAME
  * 
- *    typedef struct { ... } SilcAttributesObjDevice;
+ *    typedef struct { ... } SilcAttributeObjDevice;
  *
  * DESCRIPTION
  *
@@ -430,11 +459,11 @@ typedef struct {
 } SilcAttributeObjDevice;
 /***/
 
-/****s* silccore/SilcAttributesAPI/SilcAttributesObjPk
+/****s* silccore/SilcAttributesAPI/SilcAttributeObjPk
  *
  * NAME
  * 
- *    typedef struct { ... } SilcAttributesObjPk;
+ *    typedef struct { ... } SilcAttributeObjPk;
  *
  * DESCRIPTION
  *
@@ -457,7 +486,7 @@ typedef struct {
  * SYNOPSIS
  *
  *    bool silc_attribute_get_object(SilcAttributePayload payload,
- *                                   void **object,
+ *                                   void *object,
  *                                   SilcUInt32 object_size);
  *
  * DESCRIPTION
@@ -475,6 +504,6 @@ typedef struct {
  *
  ***/
 bool silc_attribute_get_object(SilcAttributePayload payload,
-                              void **object, SilcUInt32 object_size);
+                              void *object, SilcUInt32 object_size);
 
 #endif /* SILCATTRS_H */