[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28014 - gnunet/src/identity
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28014 - gnunet/src/identity |
Date: |
Sun, 14 Jul 2013 20:53:34 +0200 |
Author: grothoff
Date: 2013-07-14 20:53:34 +0200 (Sun, 14 Jul 2013)
New Revision: 28014
Modified:
gnunet/src/identity/identity.h
gnunet/src/identity/identity_api.c
Log:
-identity IPC definitions
Modified: gnunet/src/identity/identity.h
===================================================================
--- gnunet/src/identity/identity.h 2013-07-14 18:22:47 UTC (rev 28013)
+++ gnunet/src/identity/identity.h 2013-07-14 18:53:34 UTC (rev 28014)
@@ -37,21 +37,203 @@
GNUNET_NETWORK_STRUCT_BEGIN
+
/**
- * Network size estimate sent from the service
- * to clients. Contains the current size estimate
- * (or 0 if none has been calculated) and the
- * standard deviation of known estimates.
- *
+ * Answer from service to client about last operation;
+ * GET_DEFAULT maybe answered with this message on failure;
+ * CREATE and RENAME will always be answered with this message.
*/
-struct GNUNET_IDENTITY_XXXMessage
+struct GNUNET_IDENTITY_ResultCodeMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_IDENTITY_XXX
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
*/
struct GNUNET_MessageHeader header;
+ /**
+ * Status code for the last operation, in NBO.
+ */
+ uint32_t result_code GNUNET_PACKED;
+
+ /* followed by 0-terminated error message (on error) */
+
};
+
+
+/**
+ * Service informs client about status of a pseudonym.
+ */
+struct GNUNET_IDENTITY_UpdateMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of bytes in identity name string including 0-termination, in NBO;
+ * 0 if the identity was deleted.
+ */
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Always zero.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /**
+ * Public key of the identity that we provide an update about.
+ */
+ struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
+
+ /* followed by 0-terminated identity name */
+
+};
+
+
+
+/**
+ * Client requests knowledge about default identity for
+ * a subsystem from identity service.
+ */
+struct GNUNET_IDENTITY_GetDefaultMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of bytes in service name string including 0-termination, in NBO.
+ */
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Always zero.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+
+ /* followed by 0-terminated service name */
+
+};
+
+
+/**
+ * Used from service to client as a result to the GET_DEFAULT
+ * message, used from client to service to SET_DEFAULT.
+ */
+struct GNUNET_IDENTITY_SetDefaultMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of bytes in service name string including 0-termination, in NBO.
+ */
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Always zero.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /**
+ * Public key of the identity to use.
+ */
+ struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
+
+ /* followed by 0-terminated service name */
+
+};
+
+
+/**
+ * Client requests creation of an identity. Service
+ * will respond with a result code.
+ */
+struct GNUNET_IDENTITY_CreateRequestMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of bytes in identity name string including 0-termination, in NBO.
+ */
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Always zero.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /**
+ * Public key of the identity to use.
+ */
+ struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private_key;
+
+ /* followed by 0-terminated identity name */
+
+};
+
+
+/**
+ * Client requests renaming of an identity. Service
+ * will respond with a result code.
+ */
+struct GNUNET_IDENTITY_RenameMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of characters in the old name including 0-termination, in NBO.
+ */
+ uint16_t old_name_len GNUNET_PACKED;
+
+ /**
+ * Number of characters in the new name including 0-termination, in NBO.
+ */
+ uint16_t new_name_len GNUNET_PACKED;
+
+ /* followed by 0-terminated old name */
+ /* followed by 0-terminated new name */
+};
+
+
+/**
+ * Client requests deletion of an identity. Service
+ * will respond with a result code.
+ */
+struct GNUNET_IDENTITY_DeleteMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Number of characters in the name including 0-termination, in NBO.
+ */
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Always zero.
+ */
+ uint16_t reserved GNUNET_PACKED;
+
+ /* followed by 0-terminated name */
+
+};
+
+
+
GNUNET_NETWORK_STRUCT_END
#endif
Modified: gnunet/src/identity/identity_api.c
===================================================================
--- gnunet/src/identity/identity_api.c 2013-07-14 18:22:47 UTC (rev 28013)
+++ gnunet/src/identity/identity_api.c 2013-07-14 18:53:34 UTC (rev 28014)
@@ -37,6 +37,14 @@
#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__)
+/**
+ * Handle for a pseudonym.
+ */
+struct GNUNET_IDENTITY_Pseudonym
+{
+};
+
+
/**
* Handle for the service.
*/
@@ -77,7 +85,8 @@
* @param tc scheduler context
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
@@ -88,7 +97,8 @@
* @param msg message received, NULL on timeout or fatal error
*/
static void
-message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
+message_handler (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_IDENTITY_Handle *h = cls;
const struct GNUNET_IDENTITY_ClientMessage *client_msg;
@@ -148,9 +158,11 @@
* @return number of bytes copied to buf
*/
static size_t
-send_start (void *cls, size_t size, void *buf)
+send_start (void *cls,
+ size_t size,
+ void *buf)
{
- return sizeof (struct GNUNET_MessageHeader);
+ return 0;
}
@@ -210,6 +222,133 @@
/**
+ * Obtain the ECC key associated with a pseudonym.
+ *
+ * @param pseudonym the pseudonym
+ * @return associated ECC key, valid as long as the pseudonym is valid
+ */
+const struct GNUNET_CRYPTO_EccPrivateKey *
+GNUNET_IDENTITY_pseudonym_get_key (struct GNUNET_IDENTITY_Pseudonym *pseudonym)
+{
+ return NULL;
+}
+
+
+/**
+ * Obtain the identity that is currently preferred/default
+ * for a service.
+ *
+ * @param id identity service to query
+ * @param service_name for which service is an identity wanted
+ * @param cb function to call with the result (will only be called once)
+ * @param cb_cls closure for cb
+ * @return handle to abort the operation
+ */
+struct GNUNET_IDENTITY_Operation *
+GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
+ const char *service_name,
+ GNUNET_IDENTITY_Callback cb,
+ void *cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Set the preferred/default identity for a service.
+ *
+ * @param id identity service to inform
+ * @param service_name for which service is an identity set
+ * @param pseu new default identity to be set for this service
+ * @param cont function to call once the operation finished
+ * @param cont_cls closure for cont
+ * @return handle to abort the operation
+ */
+struct GNUNET_IDENTITY_Operation *
+GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
+ const char *service_name,
+ struct GNUNET_IDENTITY_Pseudonym *pseu,
+ GNUNET_IDENTITY_Continuation cont,
+ void *cont_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Create a new identity with the given identifier.
+ *
+ * @param id identity service to use
+ * @param identifier desired identifier
+ * @param cb function to call with the result (will only be called once)
+ * @param cb_cls closure for cb
+ * @return handle to abort the operation
+ */
+struct GNUNET_IDENTITY_Operation *
+GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
+ const char *identifier,
+ GNUNET_IDENTITY_Callback cb,
+ void *cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Renames an existing identity.
+ *
+ * @param id identity service to use
+ * @param old_identifier old identifier
+ * @param new_identifier desired new identifier
+ * @param cb function to call with the result (will only be called once)
+ * @param cb_cls closure for cb
+ * @return handle to abort the operation
+ */
+struct GNUNET_IDENTITY_Operation *
+GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
+ const char *old_identifier,
+ const char *new_identifier,
+ GNUNET_IDENTITY_Continuation cb,
+ void *cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Delete an existing identity.
+ *
+ * @param id identity service to use
+ * @param identifier identifier of the identity to delete
+ * @param cb function to call with the result (will only be called once)
+ * @param cb_cls closure for cb
+ * @return handle to abort the operation
+ */
+struct GNUNET_IDENTITY_Operation *
+GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id,
+ const char *identifier,
+ GNUNET_IDENTITY_Continuation cb,
+ void *cb_cls)
+{
+ return NULL;
+}
+
+
+/**
+ * Cancel an identity operation. Note that the operation MAY still
+ * be executed; this merely cancels the continuation; if the request
+ * was already transmitted, the service may still choose to complete
+ * the operation.
+ *
+ * @param op operation to cancel
+ */
+void
+GNUNET_IDENITY_cancel (struct GNUNET_IDENTITY_Operation *op)
+{
+}
+
+
+/**
* Disconnect from identity service
*
* @param h handle to destroy
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28014 - gnunet/src/identity,
gnunet <=