Skip to content

Commit

Permalink
Ready for MSVC DLL build
Browse files Browse the repository at this point in the history
  • Loading branch information
khevessy committed Oct 31, 2024
1 parent 3c7b587 commit 2eb876c
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 12 deletions.
10 changes: 9 additions & 1 deletion vanetza/asn1/security/Certificate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ extern "C" {
/* Vanetza_Security_Certificate */
typedef Vanetza_Security_CertificateBase_t Vanetza_Security_Certificate_t;

/* asn1_security/Certificate.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Certificate; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Certificate;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_Certificate_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Certificate;
// extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Certificate;
asn_struct_free_f Vanetza_Security_Certificate_free;
asn_struct_print_f Vanetza_Security_Certificate_print;
asn_constr_check_f Vanetza_Security_Certificate_constraint;
Expand Down
11 changes: 10 additions & 1 deletion vanetza/asn1/security/EtsiTs103097Certificate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@ extern "C" {
/* Vanetza_Security_EtsiTs103097Certificate */
typedef Vanetza_Security_ExplicitCertificate_t Vanetza_Security_EtsiTs103097Certificate_t;

/* asn1_security/EtsiTs103097Certificate.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Certificate; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Certificate;

/* Implementation */
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_EtsiTs103097Certificate_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Certificate;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Certificate;
asn_struct_free_f Vanetza_Security_EtsiTs103097Certificate_free;
asn_struct_print_f Vanetza_Security_EtsiTs103097Certificate_print;
asn_constr_check_f Vanetza_Security_EtsiTs103097Certificate_constraint;
Expand Down
10 changes: 9 additions & 1 deletion vanetza/asn1/security/EtsiTs103097Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ extern "C" {
/* Vanetza_Security_EtsiTs103097Data */
typedef Vanetza_Security_Ieee1609Dot2Data_t Vanetza_Security_EtsiTs103097Data_t;

/* asn1_security/EtsTs103097Data.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Data to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Data;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_EtsiTs103097Data_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Data;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_EtsiTs103097Data;
asn_struct_free_f Vanetza_Security_EtsiTs103097Data_free;
asn_struct_print_f Vanetza_Security_EtsiTs103097Data_print;
asn_constr_check_f Vanetza_Security_EtsiTs103097Data_constraint;
Expand Down
10 changes: 9 additions & 1 deletion vanetza/asn1/security/HashedId3.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ extern "C" {
/* Vanetza_Security_HashedId3 */
typedef OCTET_STRING_t Vanetza_Security_HashedId3_t;

/* asn1_security/HashedId3.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_HashedId3; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_HashedId3;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_HashedId3_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_HashedId3;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_HashedId3;
asn_struct_free_f Vanetza_Security_HashedId3_free;
asn_struct_print_f Vanetza_Security_HashedId3_print;
asn_constr_check_f Vanetza_Security_HashedId3_constraint;
Expand Down
11 changes: 10 additions & 1 deletion vanetza/asn1/security/SequenceOfHashedId3.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ typedef struct Vanetza_Security_SequenceOfHashedId3 {
asn_struct_ctx_t _asn_ctx;
} Vanetza_Security_SequenceOfHashedId3_t;

/* asn1_security/SequenceOfHashedId3.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SequenceOfHashedId3; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
/* Implementation */
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SequenceOfHashedId3;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SequenceOfHashedId3;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SequenceOfHashedId3;
extern asn_SET_OF_specifics_t asn_SPC_Vanetza_Security_SequenceOfHashedId3_specs_1;
extern asn_TYPE_member_t asn_MBR_Vanetza_Security_SequenceOfHashedId3_1[1];

Expand Down
11 changes: 10 additions & 1 deletion vanetza/asn1/security/Signature.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ typedef struct Vanetza_Security_Signature {
asn_struct_ctx_t _asn_ctx;
} Vanetza_Security_Signature_t;

/* asn1_security/Signature.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Signature; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
/* Implementation */
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Signature;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Signature;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_Signature;
extern asn_CHOICE_specifics_t asn_SPC_Vanetza_Security_Signature_specs_1;
extern asn_TYPE_member_t asn_MBR_Vanetza_Security_Signature_1[3];
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_Signature_constr_1;
Expand Down
11 changes: 10 additions & 1 deletion vanetza/asn1/security/SignerIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ typedef struct Vanetza_Security_SignerIdentifier {
asn_struct_ctx_t _asn_ctx;
} Vanetza_Security_SignerIdentifier_t;

/* asn1_security/SignerIdentifier.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SignerIdentifier; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
/* Implementation */
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SignerIdentifier;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SignerIdentifier;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_SignerIdentifier;
extern asn_CHOICE_specifics_t asn_SPC_Vanetza_Security_SignerIdentifier_specs_1;
extern asn_TYPE_member_t asn_MBR_Vanetza_Security_SignerIdentifier_1[3];
extern asn_per_constraints_t asn_PER_type_Vanetza_Security_SignerIdentifier_constr_1;
Expand Down
11 changes: 10 additions & 1 deletion vanetza/asn1/security/ToBeSignedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ typedef struct Vanetza_Security_ToBeSignedData {
asn_struct_ctx_t _asn_ctx;
} Vanetza_Security_ToBeSignedData_t;

/* asn1_security/ToBeSignedData.h */
/* change extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_ToBeSignedData; to */
#ifdef asn1_security_EXPORTS
#define ASN1_SECURITY_EXPORT __declspec(dllexport)
#else
#define ASN1_SECURITY_EXPORT __declspec(dllimport)
#endif
/* Implementation */
ASN1_SECURITY_EXPORT asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_ToBeSignedData;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_ToBeSignedData;
//extern asn_TYPE_descriptor_t asn_DEF_Vanetza_Security_ToBeSignedData;
extern asn_SEQUENCE_specifics_t asn_SPC_Vanetza_Security_ToBeSignedData_specs_1;
extern asn_TYPE_member_t asn_MBR_Vanetza_Security_ToBeSignedData_1[2];

Expand Down
22 changes: 22 additions & 0 deletions vanetza/asn1/support/GeneralizedTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@

#include <errno.h>

#if defined(_WIN32)
// This is a second possibility
//#undef GMTOFF
//#define GMTOFF(tm) (_get_timezone)
#undef GMTOFF
static long GMTOFF(struct tm a){
struct tm *lt;
time_t local_time, gmt_time;
long zone;

tzset();
gmt_time = time (NULL);

lt = gmtime(&gmt_time);

local_time = mktime(lt);
return (gmt_time - local_time);
}
#define timegm _mkgmtime
#define HAVE_TIMEGM
#endif

#if defined(_WIN32)
#pragma message( "PLEASE STOP AND READ!")
#pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.")
Expand Down
2 changes: 1 addition & 1 deletion vanetza/asn1/support/RELATIVE-OID_xer.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static enum xer_pbd_rval
RELATIVE_OID__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
const void *chunk_buf, size_t chunk_size) {
RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr;
const char *chunk_end __attribute__((unused)) = (const char *)chunk_buf + chunk_size;
const char *chunk_end = (const char *)chunk_buf + chunk_size;
const char *endptr;
asn_oid_arc_t s_arcs[6];
asn_oid_arc_t *arcs = s_arcs;
Expand Down
2 changes: 1 addition & 1 deletion vanetza/asn1/support/constr_CHOICE_jer.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CHOICE_decode_jer(const asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t tmprval;
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
unsigned old_present __attribute__((unused));
unsigned old_present ;

elm = &td->elements[edx];

Expand Down
2 changes: 1 addition & 1 deletion vanetza/asn1/support/constr_CHOICE_xer.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CHOICE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t tmprval;
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
unsigned old_present __attribute__((unused));
unsigned old_present ;

elm = &td->elements[edx];

Expand Down
9 changes: 8 additions & 1 deletion vanetza/net/mac_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ class MacAddress : public boost::totally_ordered<MacAddress>
std::array<uint8_t, length_bytes> octets;
};

extern const MacAddress cBroadcastMacAddress;
#undef NET_EXPORT
#ifdef net_EXPORTS
#define NET_EXPORT __declspec(dllexport)
#else
#define NET_EXPORT __declspec(dllimport)
#endif
NET_EXPORT extern const MacAddress cBroadcastMacAddress;
//extern const MacAddress cBroadcastMacAddress;
bool operator==(const MacAddress& lhs, const MacAddress& rhs);
bool operator<(const MacAddress& lhs, const MacAddress& rhs);
std::ostream& operator<<(std::ostream& os, const MacAddress&);
Expand Down

0 comments on commit 2eb876c

Please sign in to comment.