[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libebics] branch master updated: Polish CAMT053 creation.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libebics] branch master updated: Polish CAMT053 creation. |
Date: |
Tue, 16 Oct 2018 14:29:02 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libebics.
The following commit(s) were added to refs/heads/master by this push:
new 559e6bf Polish CAMT053 creation.
559e6bf is described below
commit 559e6bff88ce1c6c0e4dc6813c83e1767019c252
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Oct 16 14:28:34 2018 +0200
Polish CAMT053 creation.
---
src/libebics.c | 26 ++++++++-------
src/libebics.h | 13 ++++----
src/tests.c | 39 ++++++++++++++++++++++
src/xmlmessages.c | 97 +++++++++++++++++++++++++++++++++++++------------------
src/xmlmessages.h | 13 ++++++--
src/xmlproto.c | 4 +--
src/xmlproto.h | 6 +++-
7 files changed, 143 insertions(+), 55 deletions(-)
diff --git a/src/libebics.c b/src/libebics.c
index 8560f38..18809ec 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -878,41 +878,45 @@ EBICS_generate_message_hpb (struct
EBICS_ARGS_build_header *header_args)
/**
* Generator of CAMT.053 messages.
*
- * @param header_args TODO
- * @param auth_args TODO
- * @param camt053_args TODO
+ * @param header_args basic values like partner and bank IDs.
+ * @param camt053_args dates range.
* @return pointer to a freshly allocated document, NULL upon errors.
*/
struct EBICS_genex_document *
-EBICS_generate_message_camt053 (struct EBICS_ARGS_build_header *header_args,
- struct EBICS_ARGS_build_auth *auth_args,
- struct EBICS_ARGS_build_content_camt053
*camt053_args)
+EBICS_generate_message_camt053
+ (struct EBICS_ARGS_build_header *header_args,
+ struct EBICS_ARGS_build_content_camt053 *camt053_args)
{
struct EBICS_genex_document *instance;
if (NULL == (instance = get_genex_instance
- (0))) //FIXME
+ (EBICS_CAMT053_UNIQUE_TEMPLATE)))
{
LOG (EBICS_ERROR,
"Could not allocate genex instance\n");
return NULL;
}
- struct EBICS_MSG_Spec foo[] = {
+ struct EBICS_MSG_Spec spec[] = {
EBICS_MSG_op_subcommand (EBICS_build_header_ebicsRequest,
header_args),
+
EBICS_MSG_op_subcommand (EBICS_build_content_camt053,
camt053_args),
+
EBICS_MSG_op_subcommand (EBICS_build_bankPubKeyDigest,
- auth_args),
+ /* Has bunch of dummy strings, for now */
+ NULL),
+
EBICS_MSG_op_subcommand (EBICS_build_auth_signature,
- auth_args),
+ /* Only needs the customer key */
+ NULL),
EBICS_MSG_op_clean (),
EBICS_MSG_op_end ()
};
- EBICS_MSG_parse_spec (foo,
+ EBICS_MSG_parse_spec (spec,
instance);
return instance;
}
diff --git a/src/libebics.h b/src/libebics.h
index ce88b6d..0d30e7f 100644
--- a/src/libebics.h
+++ b/src/libebics.h
@@ -46,6 +46,8 @@
#define EBICS_HIA_PAYLOAD_TEMPLATE 2
#define EBICS_HPB_UNIQUE_TEMPLATE 4
+#define EBICS_CAMT053_UNIQUE_TEMPLATE 0
+
/**
* This struct forces the system to assign the
* indices (in the global array of keys) to the
@@ -134,13 +136,12 @@ EBICS_generate_message_hpb (struct
EBICS_ARGS_build_header *header_args);
/**
* Generator of CAMT.053 messages.
*
- * @param header_args TODO
- * @param auth_args TODO
- * @param camt053_args TODO
+ * @param header_args basic values like partner and bank IDs.
+ * @param camt053_args dates range.
* @return pointer to a freshly allocated document, NULL upon errors.
*/
struct EBICS_genex_document *
-EBICS_generate_message_camt053 (struct EBICS_ARGS_build_header *header_args,
- struct EBICS_ARGS_build_auth *auth_args,
- struct EBICS_ARGS_build_content_camt053
*camt053_args);
+EBICS_generate_message_camt053
+ (struct EBICS_ARGS_build_header *header_args,
+ struct EBICS_ARGS_build_content_camt053 *camt053_args);
#endif
diff --git a/src/tests.c b/src/tests.c
index 4bc2300..a14e612 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -124,6 +124,45 @@ main (int argc,
util_dump_message (msg);
GNUNET_free (msg);
+ /**
+ * CAMT.053
+ */
+
+ struct EBICS_ARGS_build_content_camt053
+ camt053_args = {
+
+ .startdate = {
+ .year = 1999,
+ .month = 12,
+ .day = 31
+ },
+
+ .enddate = {
+ .year = 2000,
+ .month = 1,
+ .day = 1
+ },
+ };
+
+ struct EBICS_Date range_start = {
+
+ .year = 1999,
+ .month = 12,
+ .day = 31
+ };
+
+ if (NULL == (msg = EBICS_generate_message_camt053
+ (&header_args,
+ &camt053_args)))
+ {
+ LOG (EBICS_LOGLEVEL_ERROR,
+ "Failed to instantiate CAMT.053 message\n");
+ return EBICS_ERROR;
+ }
+
+ util_dump_message (msg);
+ GNUNET_free (msg);
+
EBICS_close_library ();
return EBICS_SUCCESS;
}
diff --git a/src/xmlmessages.c b/src/xmlmessages.c
index ed6d5ee..4654ea0 100644
--- a/src/xmlmessages.c
+++ b/src/xmlmessages.c
@@ -541,49 +541,82 @@ EBICS_build_content_hia (void *cls,
free (payload);
}
+
+/**
+ * Set dates range in the message.
+ */
void
-EBICS_build_content_camt053 (void *cls, struct EBICS_genex_document *document)
+EBICS_build_content_camt053 (void *cls,
+ struct EBICS_genex_document *document)
{
- struct EBICS_ARGS_build_content_camt053 *data = (struct
EBICS_ARGS_build_content_camt053*)cls;
+ struct EBICS_ARGS_build_content_camt053 *data = (
+ struct EBICS_ARGS_build_content_camt053*) cls;
+
struct EBICS_MSG_Spec request[] = {
- EBICS_MSG_op_unique_choice("//ebics:OrderDetails"),
- EBICS_MSG_op_set_string("//ebics:OrderDetails/ebics:OrderType", "C53"),
- EBICS_MSG_op_unique_choice("//ebics:StandardOrderParams"),
- EBICS_MSG_op_set_date("//ebics:StandardOrderParams//ebics:Start",
data->startdate),
- EBICS_MSG_op_set_date("//ebics:StandardOrderParams//ebics:End",
data->enddate),
- EBICS_MSG_op_del_node("//ebics:body/ds:X509Data"),
- EBICS_MSG_op_select_choice("//ebics:body/schema:CHOICES", 0),
- EBICS_MSG_op_end()
+
+ EBICS_MSG_op_unique_choice ("//ebics:OrderDetails"),
+ EBICS_MSG_op_set_string ("//ebics:OrderDetails/ebics:OrderType",
+ "C53"),
+ EBICS_MSG_op_unique_choice ("//ebics:StandardOrderParams"),
+ EBICS_MSG_op_set_date ("//ebics:StandardOrderParams//ebics:Start",
+ data->startdate),
+ EBICS_MSG_op_set_date("//ebics:StandardOrderParams//ebics:End",
+ data->enddate),
+ EBICS_MSG_op_del_node ("//ebics:body/ds:X509Data"),
+ EBICS_MSG_op_select_choice ("//ebics:body/schema:CHOICES",
+ 0),
+ EBICS_MSG_op_end ()
};
- EBICS_MSG_parse_spec(request, document);
+
+ EBICS_MSG_parse_spec (request,
+ document);
}
+
+
+/**
+ * Still unknown. Just setting dummy string for now.
+ */
void
-EBICS_build_bankPubKeyDigest (void *cls, struct EBICS_genex_document *document)
+EBICS_build_bankPubKeyDigest (void *cls,
+ struct EBICS_genex_document *document)
{
- struct EBICS_ARGS_build_auth *data = (struct EBICS_ARGS_build_auth*)cls;
struct EBICS_MSG_Spec auth[] = {
- EBICS_MSG_op_unique_choice("//ebics:BankPubKeyDigests"),
-
- /* Set bank authentication key */
-
EBICS_MSG_op_set_attribute("//ebics:BankPubKeyDigests/ebics:Authentication/@Version",
- "X002"),
-
EBICS_MSG_op_set_attribute("//ebics:BankPubKeyDigests/ebics:Authentication/@Algorithm","F1"),
- //
hash_mapping[data->bankAuthentication.publickey.algorithm]),
-
EBICS_MSG_op_set_string("//ebics:BankPubKeyDigests/ebics:Authentication","F2"),
- //(char*)data->bankAuthentication.publickey.data),
-
- /* Set bank encryption key */
-
EBICS_MSG_op_set_attribute("//ebics:BankPubKeyDigests/ebics:Encryption/@Version",
- "E002"),
-
EBICS_MSG_op_set_attribute("//ebics:BankPubKeyDigests/ebics:Encryption/@Algorithm","F3"),
-
//hash_mapping[data->bankEncryption.publickey.algorithm]),
- EBICS_MSG_op_set_string("//ebics:BankPubKeyDigests/ebics:Encryption","F4"),
- //(char*)data->bankEncryption.publickey.data),
- EBICS_MSG_op_end()
+
+ EBICS_MSG_op_unique_choice
+ ("//ebics:BankPubKeyDigests"),
+
+ EBICS_MSG_op_set_attribute
+ ("//ebics:BankPubKeyDigests/ebics:Authentication/@Version",
+ "X002"),
+
+ EBICS_MSG_op_set_attribute
+ ("//ebics:BankPubKeyDigests/ebics:Authentication/@Algorithm",
+ "F1"),
+
+ EBICS_MSG_op_set_string
+ ("//ebics:BankPubKeyDigests/ebics:Authentication",
+ "F2"),
+
+ EBICS_MSG_op_set_attribute
+ ("//ebics:BankPubKeyDigests/ebics:Encryption/@Version",
+ "E002"),
+
+ EBICS_MSG_op_set_attribute
+ ("//ebics:BankPubKeyDigests/ebics:Encryption/@Algorithm",
+ "F3"),
+
+ EBICS_MSG_op_set_string
+ ("//ebics:BankPubKeyDigests/ebics:Encryption",
+ "F4"),
+
+ EBICS_MSG_op_end ()
+
};
- EBICS_MSG_parse_spec(auth, document);
+
+ EBICS_MSG_parse_spec (auth,
+ document);
}
void
diff --git a/src/xmlmessages.h b/src/xmlmessages.h
index 23f9227..4d6efd0 100644
--- a/src/xmlmessages.h
+++ b/src/xmlmessages.h
@@ -80,12 +80,19 @@ struct EBICS_ARGS_build_header
uint8_t requestBankSignature;
};
-/* Struct for "camt053" request. */
+/**
+ * Struct for "camt053" request
+ */
struct EBICS_ARGS_build_content_camt053
{
- /* Starting date */
+ /**
+ * Starting date
+ */
const struct EBICS_Date startdate;
- /* End Date */
+
+ /**
+ * End Date
+ */
const struct EBICS_Date enddate;
};
diff --git a/src/xmlproto.c b/src/xmlproto.c
index 6ee1ead..b1effc9 100644
--- a/src/xmlproto.c
+++ b/src/xmlproto.c
@@ -132,14 +132,14 @@ EBICS_MSG_op_set_flag (const char *xpath, const bool
value)
};
/**
- * Set content of node to date.
* Set content of node to the utf-8 string representation of the given date.
*
* @param xpath XPath expression that specifies the node.
* @param value UTF-8 String to set content to.
*/
struct EBICS_MSG_Spec
-EBICS_MSG_op_set_date (const char *xpath, const struct EBICS_Date date)
+EBICS_MSG_op_set_date (const char *xpath,
+ const struct EBICS_Date date)
{
struct EBICS_MSG_Spec result =
{
diff --git a/src/xmlproto.h b/src/xmlproto.h
index f952499..df045a9 100644
--- a/src/xmlproto.h
+++ b/src/xmlproto.h
@@ -109,12 +109,16 @@ struct EBICS_KeyList
struct EBICS_Key *keys;
};
-/* TODO
+/**
+ * Date format in libebics.
*/
struct EBICS_Date
{
+
uint8_t day;
+
uint8_t month;
+
uint16_t year;
};
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libebics] branch master updated: Polish CAMT053 creation.,
gnunet <=