Browse Source

renaming PEPMessage to ASN1Message to avoid the name clash with p≡p Objective C adapter

master Release_3.2.0-RC2
Volker Birk 2 months ago
parent
commit
1b6d5d34a1
6 changed files with 63 additions and 63 deletions
  1. +3
    -3
      asn.1/Makefile
  2. +2
    -2
      asn.1/message.asn1
  3. +6
    -6
      src/map_asn1.c
  4. +11
    -11
      src/map_asn1.h
  5. +20
    -20
      src/message_codec.c
  6. +21
    -21
      src/message_codec.h

+ 3
- 3
asn.1/Makefile View File

@ -19,7 +19,7 @@ STORAGE_FILES = $(addsuffix .asn1, $(STORAGE))
.PHONY: all clean install uninstall
all: Sync.c Distribution.c Storage.c PEPMessage.c
all: Sync.c Distribution.c Storage.c ASN1Message.c
$(MAKE) libasn1.a
libasn1.a: $(ALL_OBJECTS)
@ -43,10 +43,10 @@ Storage.c: $(STORAGE_FILES) pEp.asn1
rm -f converter-sample.c
touch Storage.c
PEPMessage.c: message.asn1 pEp.asn1
ASN1Message.c: message.asn1 pEp.asn1
$(ASN1C) -gen-PER $(ASN1C_OPTIONS) $+
rm -f converter-sample.c
touch PEPMessage.c
touch ASN1Message.c
clean:
rm -f *.a *.o *.c *.h *.sample \


+ 2
- 2
asn.1/message.asn1 View File

@ -14,7 +14,7 @@ DEFINITIONS
AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
BEGIN
EXPORTS PEPMessage;
EXPORTS ASN1Message;
IMPORTS
PString, PStringList, Identity, IdentityList, StringPairList, Hash
@ -52,7 +52,7 @@ BlobList ::= SEQUENCE OF Blob
Timestamp ::= GeneralizedTime
PEPMessage ::= SEQUENCE {
ASN1Message ::= SEQUENCE {
direction MessageDirection OPTIONAL, -- used only in "inner" messages
id PString OPTIONAL, -- UTF-8 string of message ID
sent Timestamp OPTIONAL, -- when the message is sent


+ 6
- 6
src/map_asn1.c View File

@ -618,9 +618,9 @@ enomem:
return NULL;
}
PEPMessage_t *PEPMessage_from_message(
ASN1Message_t *ASN1Message_from_message(
message *msg,
PEPMessage_t *result,
ASN1Message_t *result,
bool copy,
size_t max_blob_size
)
@ -634,7 +634,7 @@ PEPMessage_t *PEPMessage_from_message(
return NULL;
if (allocated) {
result = (PEPMessage_t *) calloc(1, sizeof(PEPMessage_t));
result = (ASN1Message_t *) calloc(1, sizeof(ASN1Message_t));
assert(result);
if (!result)
return NULL;
@ -855,12 +855,12 @@ PEPMessage_t *PEPMessage_from_message(
enomem:
if (allocated)
ASN_STRUCT_FREE(asn_DEF_PEPMessage, result);
ASN_STRUCT_FREE(asn_DEF_ASN1Message, result);
return NULL;
}
message *PEPMessage_to_message(
PEPMessage_t *msg,
message *ASN1Message_to_message(
ASN1Message_t *msg,
message *result,
bool copy,
size_t max_blob_size


+ 11
- 11
src/map_asn1.h View File

@ -8,7 +8,7 @@
#define MAP_ASN1_H
#include "message.h"
#include "../asn.1/PEPMessage.h"
#include "../asn.1/ASN1Message.h"
#ifdef __cplusplus
extern "C" {
@ -249,12 +249,12 @@ bloblist_t *BlobList_to_bloblist(
/**
* <!-- PEPMessage_from_message() -->
* <!-- ASN1Message_from_message() -->
*
* @brief Convert message into ASN.1 PEPMessage_t
* @brief Convert message into ASN.1 ASN1Message_t
*
* @param msg[in] message to convert
* @param result[inout] PEPMessage_t to update or NULL to alloc a new one
* @param result[inout] ASN1Message_t to update or NULL to alloc a new one
* @param copy copy data if true, move data otherwise
* @param max_blob_size reject if sum(blob.size) > max_blob_size
* to disable set to 0
@ -265,20 +265,20 @@ bloblist_t *BlobList_to_bloblist(
*
*/
PEPMessage_t *PEPMessage_from_message(
ASN1Message_t *ASN1Message_from_message(
message *msg,
PEPMessage_t *result,
ASN1Message_t *result,
bool copy,
size_t max_blob_size
);
/**
* <!-- PEPMessage_to_message() -->
* <!-- ASN1Message_to_message() -->
*
* @brief Convert ASN.1 PEPMessage_t to message
* @brief Convert ASN.1 ASN1Message_t to message
*
* @param msg[in] ASN.1 PEPMessage_t to convert
* @param msg[in] ASN.1 ASN1Message_t to convert
* @param result[inout] message to update or NULL to alloc a new one
* @param copy copy data if true, move data otherwise
* @param max_blob_size reject if sum(blob.size) > max_blob_size
@ -290,8 +290,8 @@ PEPMessage_t *PEPMessage_from_message(
*
*/
message *PEPMessage_to_message(
PEPMessage_t *msg,
message *ASN1Message_to_message(
ASN1Message_t *msg,
message *result,
bool copy,
size_t max_blob_size


+ 20
- 20
src/message_codec.c View File

@ -1,6 +1,6 @@
/**
* @file PEPMessage_codec.c
* @brief Implementation for PEPMessage encode and decode functions which transform message payloads to
* @file ASN1Message_codec.c
* @brief Implementation for ASN1Message encode and decode functions which transform message payloads to
* and from PER-encoded data, and XER text to and from PER
*
* @see https://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx
@ -11,14 +11,14 @@
#include "platform.h"
#include "distribution_codec.h"
#include "../asn.1/PEPMessage.h"
#include "../asn.1/ASN1Message.h"
#include "pEp_internal.h"
#include "growing_buf.h"
DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
DYNAMIC_API PEP_STATUS decode_ASN1Message_message(
const char *data,
size_t size,
PEPMessage_t **msg
ASN1Message_t **msg
)
{
assert(data && msg);
@ -26,8 +26,8 @@ DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
return PEP_ILLEGAL_VALUE;
*msg = NULL;
PEPMessage_t *_msg = NULL;
uper_decode_complete(NULL, &asn_DEF_PEPMessage, (void **) &_msg, data, size);
ASN1Message_t *_msg = NULL;
uper_decode_complete(NULL, &asn_DEF_ASN1Message, (void **) &_msg, data, size);
if (!_msg)
return PEP_PEPMESSAGE_ILLEGAL_MESSAGE;
@ -35,8 +35,8 @@ DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
return PEP_STATUS_OK;
}
PEP_STATUS encode_PEPMessage_message(
PEPMessage_t *msg,
PEP_STATUS encode_ASN1Message_message(
ASN1Message_t *msg,
char **data,
size_t *size
)
@ -49,7 +49,7 @@ PEP_STATUS encode_PEPMessage_message(
*size = 0;
char *_data = NULL;
ssize_t _size = uper_encode_to_new_buffer(&asn_DEF_PEPMessage, NULL, msg,
ssize_t _size = uper_encode_to_new_buffer(&asn_DEF_ASN1Message, NULL, msg,
(void **) &_data);
if (_size == -1)
return PEP_CANNOT_ENCODE;
@ -60,7 +60,7 @@ PEP_STATUS encode_PEPMessage_message(
return PEP_STATUS_OK;
}
PEP_STATUS PER_to_XER_PEPMessage_msg(
PEP_STATUS PER_to_XER_ASN1Message_msg(
const char *data,
size_t size,
char **text
@ -75,8 +75,8 @@ PEP_STATUS PER_to_XER_PEPMessage_msg(
*text = NULL;
PEPMessage_t *msg = NULL;
status = decode_PEPMessage_message(data, size, &msg);
ASN1Message_t *msg = NULL;
status = decode_ASN1Message_message(data, size, &msg);
if (status)
goto the_end;
@ -86,7 +86,7 @@ PEP_STATUS PER_to_XER_PEPMessage_msg(
goto the_end;
}
asn_enc_rval_t er = xer_encode(&asn_DEF_PEPMessage, msg, XER_F_BASIC,
asn_enc_rval_t er = xer_encode(&asn_DEF_ASN1Message, msg, XER_F_BASIC,
(asn_app_consume_bytes_f *) growing_buf_consume, (void *) dst);
if (er.encoded == -1) {
status = PEP_CANNOT_ENCODE;
@ -98,11 +98,11 @@ PEP_STATUS PER_to_XER_PEPMessage_msg(
the_end:
free_growing_buf(dst);
ASN_STRUCT_FREE(asn_DEF_PEPMessage, msg);
ASN_STRUCT_FREE(asn_DEF_ASN1Message, msg);
return status;
}
PEP_STATUS XER_to_PER_PEPMessage_msg(
PEP_STATUS XER_to_PER_ASN1Message_msg(
const char *text,
char **data,
size_t *size
@ -117,8 +117,8 @@ PEP_STATUS XER_to_PER_PEPMessage_msg(
*data = NULL;
*size = 0;
PEPMessage_t *msg = NULL;
asn_dec_rval_t dr = xer_decode(NULL, &asn_DEF_PEPMessage, (void **) &msg,
ASN1Message_t *msg = NULL;
asn_dec_rval_t dr = xer_decode(NULL, &asn_DEF_ASN1Message, (void **) &msg,
(const void *) text, strlen(text));
if (dr.code != RC_OK) {
status = PEP_PEPMESSAGE_ILLEGAL_MESSAGE;
@ -127,7 +127,7 @@ PEP_STATUS XER_to_PER_PEPMessage_msg(
char *_data = NULL;
size_t _size = 0;
status = encode_PEPMessage_message(msg, &_data, &_size);
status = encode_ASN1Message_message(msg, &_data, &_size);
if (status)
goto the_end;
@ -135,7 +135,7 @@ PEP_STATUS XER_to_PER_PEPMessage_msg(
*size = (size_t) _size;
the_end:
ASN_STRUCT_FREE(asn_DEF_PEPMessage, msg);
ASN_STRUCT_FREE(asn_DEF_ASN1Message, msg);
return status;
}

+ 21
- 21
src/message_codec.h View File

@ -1,6 +1,6 @@
/**
* @file PEPMessage_codec.h
* @brief Definitions for PEPMessage encode and decode functions which transform message payloads to
* @file ASN1Message_codec.h
* @brief Definitions for ASN1Message encode and decode functions which transform message payloads to
* and from PER-encoded data, and XER text to and from PER
*
* @see https://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx
@ -20,33 +20,33 @@ extern "C" {
#endif
struct PEPMessage;
struct ASN1Message;
/**
* <!-- decode_PEPMessage_message() -->
* <!-- decode_ASN1Message_message() -->
*
* @brief decode PER encoded PEPMessage message
* @brief decode PER encoded ASN1Message message
*
* @param[in] data PER encoded data
* @param[in] size size of PER encoded data
* @param[out] msg decoded PEPMessage message
* @param[out] msg decoded ASN1Message message
*
* @retval status
*
* @ownership msg goes into the ownership of the caller
*/
DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
DYNAMIC_API PEP_STATUS decode_ASN1Message_message(
const char *data,
size_t size,
struct PEPMessage **msg
struct ASN1Message **msg
);
/**
* <!-- encode_PEPMessage_message() -->
* <!-- encode_ASN1Message_message() -->
*
* @brief decode PER encoded PEPMessage message
* @brief decode PER encoded ASN1Message message
*
* @param[in] msg PEPMessage message to encode
* @param[in] msg ASN1Message message to encode
* @param[out] data PER encoded data
* @param[out] size size of PER encoded data
*
@ -54,42 +54,42 @@ DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
*
* @ownership msg goes into the ownership of the caller
*/
DYNAMIC_API PEP_STATUS encode_PEPMessage_message(
struct PEPMessage *msg,
DYNAMIC_API PEP_STATUS encode_ASN1Message_message(
struct ASN1Message *msg,
char **data,
size_t *size
);
/**
* <!-- PER_to_XER_PEPMessage_msg() -->
* <!-- PER_to_XER_ASN1Message_msg() -->
*
* @brief decode PEPMessage message from PER into XER
* @brief decode ASN1Message message from PER into XER
*
* @param[in] data PER encoded data
* @param[in] size size of PER encoded data
* @param[out] text XER text of the same PEPMessage message
* @param[out] text XER text of the same ASN1Message message
*
* @retval status
*/
DYNAMIC_API PEP_STATUS PER_to_XER_PEPMessage_msg(
DYNAMIC_API PEP_STATUS PER_to_XER_ASN1Message_msg(
const char *data,
size_t size,
char **text
);
/**
* <!-- XER_to_PER_PEPMessage_msg() -->
* <!-- XER_to_PER_ASN1Message_msg() -->
*
* @brief encode PEPMessage message from XER into PER
* @brief encode ASN1Message message from XER into PER
*
* @param[in] text string text with XER text of the PEPMessage message
* @param[in] text string text with XER text of the ASN1Message message
* @param[out] data PER encoded data
* @param[out] size size of PER encoded data
*
* @retval status
*/
DYNAMIC_API PEP_STATUS XER_to_PER_PEPMessage_msg(
DYNAMIC_API PEP_STATUS XER_to_PER_ASN1Message_msg(
const char *text,
char **data,
size_t *size


Loading…
Cancel
Save