diff options
author | Slava Barinov <v.barinov@samsung.com> | 2016-04-07 18:40:19 +0300 |
---|---|---|
committer | Slava Barinov <v.barinov@samsung.com> | 2016-04-07 18:40:19 +0300 |
commit | c2aac52acd13af24dbb90a777a26faec22ae4575 (patch) | |
tree | 3570af0887130a9885432341a8ec894c5e35218a | |
parent | a9ea7d5bf4351ad849029782c78c2d3d8b05e869 (diff) | |
download | smartcard-service-sandbox/vbarinov/vis.tar.gz smartcard-service-sandbox/vbarinov/vis.tar.bz2 smartcard-service-sandbox/vbarinov/vis.zip |
lto+vissandbox/vbarinov/vis
55 files changed, 393 insertions, 122 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 712ef15..1978e38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,9 @@ ENDIF() # make string from entire content of byte array ADD_DEFINITIONS("-DTO_STRING_ALL") ADD_DEFINITIONS("-DUSE_CYNARA") +ADD_DEFINITIONS("-DLIBSCL_EXPORT_API=__attribute__((visibility(\"default\")))") -SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections -flto") +SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections -flto -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GC_SECTIONS_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_SECTIONS_FLAGS}") diff --git a/client/include/ClientChannel.h b/client/include/ClientChannel.h index a4e75ee..05414f5 100644 --- a/client/include/ClientChannel.h +++ b/client/include/ClientChannel.h @@ -30,9 +30,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class ClientChannel: public Channel + class LIBSCL_EXPORT_API ClientChannel: public Channel { private: void *context; @@ -74,24 +79,24 @@ extern "C" { #endif /* __cplusplus */ -int channel_is_basic_channel(channel_h handle, bool* is_basic_channel); -int channel_is_closed(channel_h handle, bool* is_closed ); -int channel_get_session(channel_h handle, int *session_handle); -int channel_close_sync(channel_h handle); -int channel_transmit_sync(channel_h handle, unsigned char *command, +LIBSCL_EXPORT_API int channel_is_basic_channel(channel_h handle, bool* is_basic_channel); +LIBSCL_EXPORT_API int channel_is_closed(channel_h handle, bool* is_closed ); +LIBSCL_EXPORT_API int channel_get_session(channel_h handle, int *session_handle); +LIBSCL_EXPORT_API int channel_close_sync(channel_h handle); +LIBSCL_EXPORT_API int channel_transmit_sync(channel_h handle, unsigned char *command, unsigned int cmd_len, unsigned char **response, unsigned int *resp_len); -int channel_get_select_response(channel_h handle, +LIBSCL_EXPORT_API int channel_get_select_response(channel_h handle, unsigned char **buffer, size_t* length); -int channel_get_transmit_response(channel_h handle, +LIBSCL_EXPORT_API int channel_get_transmit_response(channel_h handle, unsigned char **buffer, size_t* length); -int channel_select_next(channel_h hChannel, bool *pSuccess); +LIBSCL_EXPORT_API int channel_select_next(channel_h hChannel, bool *pSuccess); //// -int channel_close(channel_h handle, channel_close_cb callback, void *userParam); -int channel_transmit(channel_h handle, unsigned char *command, +LIBSCL_EXPORT_API int channel_close(channel_h handle, channel_close_cb callback, void *userParam); +LIBSCL_EXPORT_API int channel_transmit(channel_h handle, unsigned char *command, unsigned int length, channel_transmit_cb callback, void *userParam); -unsigned int channel_get_select_response_length(channel_h handle); -void channel_destroy_instance(channel_h handle) __attribute__((deprecated)); +LIBSCL_EXPORT_API unsigned int channel_get_select_response_length(channel_h handle); +LIBSCL_EXPORT_API void channel_destroy_instance(channel_h handle) __attribute__((deprecated)); #ifdef __cplusplus diff --git a/client/include/ClientGDBus.h b/client/include/ClientGDBus.h index c111874..909c085 100644 --- a/client/include/ClientGDBus.h +++ b/client/include/ClientGDBus.h @@ -26,9 +26,14 @@ #include "GDBusHelper.h" #include "smartcard-service-gdbus.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ClientGDBus + class LIBSCL_EXPORT_API ClientGDBus { }; } /* namespace smartcard_service_api */ diff --git a/client/include/Reader.h b/client/include/Reader.h index 876d0b8..e4cbc3d 100644 --- a/client/include/Reader.h +++ b/client/include/Reader.h @@ -31,9 +31,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class Reader: public ReaderHelper + class LIBSCL_EXPORT_API Reader: public ReaderHelper { private: void *context; @@ -69,16 +74,16 @@ extern "C" { #endif /* __cplusplus */ -int reader_get_name(reader_h handle, char** reader_name); -int reader_is_secure_element_present(reader_h handle, bool* is_present); -int reader_open_session_sync(reader_h handle, int *session_handle); -int reader_close_sessions(reader_h handle); +LIBSCL_EXPORT_API int reader_get_name(reader_h handle, char** reader_name); +LIBSCL_EXPORT_API int reader_is_secure_element_present(reader_h handle, bool* is_present); +LIBSCL_EXPORT_API int reader_open_session_sync(reader_h handle, int *session_handle); +LIBSCL_EXPORT_API int reader_close_sessions(reader_h handle); /// -int reader_open_session(reader_h handle, reader_open_session_cb callback, +LIBSCL_EXPORT_API int reader_open_session(reader_h handle, reader_open_session_cb callback, void *userData); -se_service_h reader_get_se_service(reader_h handle); -__attribute__((deprecated)) void reader_destroy_instance(reader_h handle); +LIBSCL_EXPORT_API se_service_h reader_get_se_service(reader_h handle); +LIBSCL_EXPORT_API __attribute__((deprecated)) void reader_destroy_instance(reader_h handle); #ifdef __cplusplus } diff --git a/client/include/SEService.h b/client/include/SEService.h index cb7672d..9ecfa85 100644 --- a/client/include/SEService.h +++ b/client/include/SEService.h @@ -31,13 +31,18 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + using namespace std; namespace smartcard_service_api { typedef void (*serviceConnected)(SEServiceHelper *service, void *context); - class SEService : public SEServiceHelper + class LIBSCL_EXPORT_API SEService : public SEServiceHelper { private: unsigned int handle; @@ -102,20 +107,20 @@ extern "C" { #endif /* __cplusplus */ -se_service_h se_service_create_instance(void *user_data, +LIBSCL_EXPORT_API se_service_h se_service_create_instance(void *user_data, se_service_connected_cb callback); -se_service_h se_service_create_instance_with_event_callback(void *user_data, +LIBSCL_EXPORT_API se_service_h se_service_create_instance_with_event_callback(void *user_data, se_service_connected_cb connected, se_service_event_cb event, se_sesrvice_error_cb error); -se_service_h se_service_create_instance_sync(void *user_data, int* result); -int se_service_get_version(se_service_h handle, char **version_str); -int se_service_get_readers_count(se_service_h handle); -int se_service_get_readers(se_service_h handle, int **readers, int *count); +LIBSCL_EXPORT_API se_service_h se_service_create_instance_sync(void *user_data, int* result); +LIBSCL_EXPORT_API int se_service_get_version(se_service_h handle, char **version_str); +LIBSCL_EXPORT_API int se_service_get_readers_count(se_service_h handle); +LIBSCL_EXPORT_API int se_service_get_readers(se_service_h handle, int **readers, int *count); -bool se_service_is_connected(se_service_h handle); -void se_service_shutdown(se_service_h handle); -int se_service_destroy_instance(se_service_h handle); +LIBSCL_EXPORT_API bool se_service_is_connected(se_service_h handle); +LIBSCL_EXPORT_API void se_service_shutdown(se_service_h handle); +LIBSCL_EXPORT_API int se_service_destroy_instance(se_service_h handle); #ifdef __cplusplus diff --git a/client/include/SEServiceListener.h b/client/include/SEServiceListener.h index 9cfc01b..21a9f65 100644 --- a/client/include/SEServiceListener.h +++ b/client/include/SEServiceListener.h @@ -17,6 +17,11 @@ #ifndef SESERVICELISTENER_H_ #define SESERVICELISTENER_H_ +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + /* standard library header */ /* SLP library header */ @@ -27,7 +32,7 @@ namespace smartcard_service_api { class SEServiceHelper; - class SEServiceListener + class LIBSCL_EXPORT_API SEServiceListener { public: virtual void serviceConnected(SEServiceHelper *service, diff --git a/client/include/Session.h b/client/include/Session.h index 7d530e3..b560232 100644 --- a/client/include/Session.h +++ b/client/include/Session.h @@ -29,11 +29,16 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { class Reader; - class Session : public SessionHelper + class LIBSCL_EXPORT_API Session : public SessionHelper { private: void *context; @@ -126,27 +131,27 @@ extern "C" { #endif /* __cplusplus */ -int session_get_reader(session_h handle, int* reader_handle); -int session_is_closed(session_h handle, bool* is_closed); -int session_close_channels(session_h handle); -int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length); -int session_close_sync(session_h handle); -int session_open_basic_channel_sync(session_h handle, unsigned char *aid, +LIBSCL_EXPORT_API int session_get_reader(session_h handle, int* reader_handle); +LIBSCL_EXPORT_API int session_is_closed(session_h handle, bool* is_closed); +LIBSCL_EXPORT_API int session_close_channels(session_h handle); +LIBSCL_EXPORT_API int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length); +LIBSCL_EXPORT_API int session_close_sync(session_h handle); +LIBSCL_EXPORT_API int session_open_basic_channel_sync(session_h handle, unsigned char *aid, unsigned int length, unsigned char P2, int* channel_handle); -int session_open_logical_channel_sync(session_h handle, unsigned char *aid, +LIBSCL_EXPORT_API int session_open_logical_channel_sync(session_h handle, unsigned char *aid, unsigned int length, unsigned char P2, int* channel_handle); /// -int session_get_atr(session_h handle, session_get_atr_cb callback, +LIBSCL_EXPORT_API int session_get_atr(session_h handle, session_get_atr_cb callback, void *userData); -int session_close(session_h handle, session_close_session_cb callback, +LIBSCL_EXPORT_API int session_close(session_h handle, session_close_session_cb callback, void *userData); -int session_open_basic_channel(session_h handle, unsigned char *aid, +LIBSCL_EXPORT_API int session_open_basic_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData); -int session_open_logical_channel(session_h handle, unsigned char *aid, +LIBSCL_EXPORT_API int session_open_logical_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData); -size_t session_get_channel_count(session_h handle); -__attribute__((deprecated)) void session_destroy_instance(session_h handle); +LIBSCL_EXPORT_API size_t session_get_channel_count(session_h handle); +LIBSCL_EXPORT_API __attribute__((deprecated)) void session_destroy_instance(session_h handle); diff --git a/common/include/APDUHelper.h b/common/include/APDUHelper.h index 8b44a71..970883a 100644 --- a/common/include/APDUHelper.h +++ b/common/include/APDUHelper.h @@ -24,9 +24,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ResponseHelper + class LIBSCL_EXPORT_API ResponseHelper { private: ByteArray response; @@ -75,7 +80,7 @@ namespace smartcard_service_api // static char *getErrorString(); }; - class APDUCommand + class LIBSCL_EXPORT_API APDUCommand { private: typedef struct _command_header_t @@ -172,7 +177,7 @@ namespace smartcard_service_api bool getBuffer(ByteArray &array) const; }; - class APDUHelper + class LIBSCL_EXPORT_API APDUHelper { public: static const int COMMAND_OPEN_LOGICAL_CHANNEL = 1; diff --git a/common/include/AccessCondition.h b/common/include/AccessCondition.h index 6f33cca..cf5383f 100644 --- a/common/include/AccessCondition.h +++ b/common/include/AccessCondition.h @@ -26,11 +26,16 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class AccessRule + class LIBSCL_EXPORT_API AccessRule { private : bool apduRule; @@ -58,7 +63,7 @@ namespace smartcard_service_api friend class AccessCondition; }; - class AccessCondition + class LIBSCL_EXPORT_API AccessCondition { private : ByteArray aid; diff --git a/common/include/AccessControlList.h b/common/include/AccessControlList.h index 77a90ba..214b827 100644 --- a/common/include/AccessControlList.h +++ b/common/include/AccessControlList.h @@ -28,11 +28,16 @@ #include "Channel.h" #include "AccessCondition.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class AccessControlList + class LIBSCL_EXPORT_API AccessControlList { protected: map<ByteArray, AccessCondition> mapConditions; diff --git a/common/include/ByteArray.h b/common/include/ByteArray.h index 84a8c8f..24888e6 100644 --- a/common/include/ByteArray.h +++ b/common/include/ByteArray.h @@ -29,11 +29,16 @@ #define ARRAY_AND_SIZE(x) (uint8_t *)(&x), sizeof(x) +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class ByteArray //: public Serializable + class LIBSCL_EXPORT_API ByteArray //: public Serializable { protected: uint8_t *buffer; diff --git a/common/include/Channel.h b/common/include/Channel.h index 8358142..a7298f2 100644 --- a/common/include/Channel.h +++ b/common/include/Channel.h @@ -26,6 +26,11 @@ #include "ByteArray.h" #include "Exception.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { class SessionHelper; /* explicit declaration */ @@ -34,7 +39,7 @@ namespace smartcard_service_api unsigned int length, int error, void *userParam); typedef void (*closeChannelCallback)(int error, void *userParam); - class Channel : public Synchronous + class LIBSCL_EXPORT_API Channel : public Synchronous { protected : ByteArray selectResponse; diff --git a/common/include/EFDIR.h b/common/include/EFDIR.h index c19eec9..7013ef8 100644 --- a/common/include/EFDIR.h +++ b/common/include/EFDIR.h @@ -25,11 +25,16 @@ /* local header */ #include "FileObject.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class EFDIR : public FileObject + class LIBSCL_EXPORT_API EFDIR : public FileObject { private: const ByteArray parseRecord(const Record &record, const ByteArray &aid); diff --git a/common/include/Exception.h b/common/include/Exception.h index cb59d1d..f7b27d9 100644 --- a/common/include/Exception.h +++ b/common/include/Exception.h @@ -63,10 +63,15 @@ break; \ } \ } + + #ifndef LIBSCL_EXPORT_API + #define LIBSCL_EXPORT_API + #endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class ExceptionBase : public std::exception + class LIBSCL_EXPORT_API ExceptionBase : public std::exception { protected : int errorCode; @@ -83,7 +88,7 @@ namespace smartcard_service_api } }; - class ErrorIO : public ExceptionBase + class LIBSCL_EXPORT_API ErrorIO : public ExceptionBase { private : unsigned char sw[2]; @@ -130,7 +135,7 @@ namespace smartcard_service_api } }; - class ErrorSecurity : public ExceptionBase + class LIBSCL_EXPORT_API ErrorSecurity : public ExceptionBase { public : ErrorSecurity(int errorCode) throw() @@ -156,7 +161,7 @@ namespace smartcard_service_api } }; - class ErrorIllegalState : public ExceptionBase + class LIBSCL_EXPORT_API ErrorIllegalState : public ExceptionBase { public : ErrorIllegalState(int errorCode) throw() @@ -190,7 +195,7 @@ namespace smartcard_service_api } }; - class ErrorIllegalParameter : public ExceptionBase + class LIBSCL_EXPORT_API ErrorIllegalParameter : public ExceptionBase { public : ErrorIllegalParameter(int errorCode) throw() @@ -216,7 +221,7 @@ namespace smartcard_service_api } }; - class ThrowError + class LIBSCL_EXPORT_API ThrowError { public : static void throwError(int errorCode) diff --git a/common/include/FCI.h b/common/include/FCI.h index 1b303e5..29516da 100644 --- a/common/include/FCI.h +++ b/common/include/FCI.h @@ -25,9 +25,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class FCP + class LIBSCL_EXPORT_API FCP { private: ByteArray fcpBuffer; @@ -66,7 +71,7 @@ namespace smartcard_service_api const string toString() const; }; - class FCM + class LIBSCL_EXPORT_API FCM { private: ByteArray fcmBuffer; @@ -76,7 +81,7 @@ namespace smartcard_service_api virtual ~FCM(); }; - class FCI + class LIBSCL_EXPORT_API FCI { private: ByteArray fciBuffer; diff --git a/common/include/FileObject.h b/common/include/FileObject.h index c377dbf..bc17c6b 100644 --- a/common/include/FileObject.h +++ b/common/include/FileObject.h @@ -28,11 +28,16 @@ #include "FCI.h" #include "Record.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class FileObject : public ProviderHelper + class LIBSCL_EXPORT_API FileObject : public ProviderHelper { private: FCI fci; diff --git a/common/include/GDBusHelper.h b/common/include/GDBusHelper.h index a32c269..0b347c8 100644 --- a/common/include/GDBusHelper.h +++ b/common/include/GDBusHelper.h @@ -21,9 +21,14 @@ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class CallbackParam + class LIBSCL_EXPORT_API CallbackParam { public : void *instance; @@ -31,7 +36,7 @@ namespace smartcard_service_api void *user_param; }; - class GDBusHelper + class LIBSCL_EXPORT_API GDBusHelper { public : static void convertVariantToByteArray(GVariant *var, diff --git a/common/include/GPACE.h b/common/include/GPACE.h index 5300dfd..20fed0c 100644 --- a/common/include/GPACE.h +++ b/common/include/GPACE.h @@ -28,9 +28,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class GPACE : public AccessControlList + class LIBSCL_EXPORT_API GPACE : public AccessControlList { private : AccessControlList *acl; diff --git a/common/include/GPARAACL.h b/common/include/GPARAACL.h index 4038b41..6d0cb78 100644 --- a/common/include/GPARAACL.h +++ b/common/include/GPARAACL.h @@ -29,9 +29,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class GPARAACL : public AccessControlList + class LIBSCL_EXPORT_API GPARAACL : public AccessControlList { private: ByteArray refreshTag; diff --git a/common/include/GPARAM.h b/common/include/GPARAM.h index d4b3116..f9c5ca0 100644 --- a/common/include/GPARAM.h +++ b/common/include/GPARAM.h @@ -25,11 +25,16 @@ /* local header */ #include "FileObject.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class GPARAM : public FileObject + class LIBSCL_EXPORT_API GPARAM : public FileObject { public: GPARAM(Channel *channel); diff --git a/common/include/GPARFACL.h b/common/include/GPARFACL.h index 396adbe..90de4d1 100644 --- a/common/include/GPARFACL.h +++ b/common/include/GPARFACL.h @@ -29,9 +29,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class GPARFACL : public AccessControlList + class LIBSCL_EXPORT_API GPARFACL : public AccessControlList { private: ByteArray refreshTag; diff --git a/common/include/ISO7816BERTLV.h b/common/include/ISO7816BERTLV.h index d5a0cd7..637695d 100644 --- a/common/include/ISO7816BERTLV.h +++ b/common/include/ISO7816BERTLV.h @@ -25,9 +25,14 @@ #include "ByteArray.h" #include "TLVHelper.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ISO7816BERTLV : public TLVHelper + class LIBSCL_EXPORT_API ISO7816BERTLV : public TLVHelper { private: unsigned char firstByte; diff --git a/common/include/Lock.h b/common/include/Lock.h index 6328016..b03e714 100644 --- a/common/include/Lock.h +++ b/common/include/Lock.h @@ -24,9 +24,14 @@ /* local header */ #include "pthread.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class Lock + class LIBSCL_EXPORT_API Lock { public: virtual ~Lock() {}; @@ -34,7 +39,7 @@ namespace smartcard_service_api virtual void unlock() = 0; }; - class PMutex : public Lock + class LIBSCL_EXPORT_API PMutex : public Lock { private: pthread_mutex_t mutex; @@ -51,7 +56,7 @@ namespace smartcard_service_api #define SCOPE_LOCK(X) \ if (AutoLockHelper TOKENPASTE2(lock_, __LINE__) = makeAutoLock(X)) - class AutoLockHelper + class LIBSCL_EXPORT_API AutoLockHelper { public: inline operator bool() const @@ -61,7 +66,7 @@ namespace smartcard_service_api }; template<typename T> - class AutoLock : public AutoLockHelper + class LIBSCL_EXPORT_API AutoLock : public AutoLockHelper { private: T *lock; @@ -73,7 +78,7 @@ namespace smartcard_service_api }; template<typename T> - inline AutoLock<T> makeAutoLock(T& lock) + LIBSCL_EXPORT_API inline AutoLock<T> makeAutoLock(T& lock) { return AutoLock<T>(lock); } diff --git a/common/include/NumberStream.h b/common/include/NumberStream.h index 74b1f8b..baf8a40 100644 --- a/common/include/NumberStream.h +++ b/common/include/NumberStream.h @@ -24,9 +24,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class NumberStream : public ByteArray + class LIBSCL_EXPORT_API NumberStream : public ByteArray { public: NumberStream(const ByteArray &T); diff --git a/common/include/OpensslHelper.h b/common/include/OpensslHelper.h index 05cd2c2..3d24127 100644 --- a/common/include/OpensslHelper.h +++ b/common/include/OpensslHelper.h @@ -25,9 +25,14 @@ #ifndef OPENSSLHELPER_H_ #define OPENSSLHELPER_H_ +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class OpensslHelper + class LIBSCL_EXPORT_API OpensslHelper { public: /* base64 method */ diff --git a/common/include/PKCS15.h b/common/include/PKCS15.h index 568036e..0bb580c 100644 --- a/common/include/PKCS15.h +++ b/common/include/PKCS15.h @@ -26,11 +26,16 @@ #include "PKCS15Object.h" #include "PKCS15ODF.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class PKCS15: public PKCS15Object + class LIBSCL_EXPORT_API PKCS15: public PKCS15Object { private: map<unsigned int, ByteArray> recordElement; diff --git a/common/include/PKCS15CDF.h b/common/include/PKCS15CDF.h index aa9e336..31cacbd 100644 --- a/common/include/PKCS15CDF.h +++ b/common/include/PKCS15CDF.h @@ -25,9 +25,14 @@ #include "PKCS15Object.h" #include "PKCS15OID.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class CertificateType + class LIBSCL_EXPORT_API CertificateType { public : /* Common Object Attributes */ @@ -45,7 +50,7 @@ namespace smartcard_service_api ByteArray certificate; }; - class PKCS15CDF : public PKCS15Object + class LIBSCL_EXPORT_API PKCS15CDF : public PKCS15Object { private: vector<CertificateType *> listCertType; diff --git a/common/include/PKCS15DODF.h b/common/include/PKCS15DODF.h index 9364245..0552cf2 100644 --- a/common/include/PKCS15DODF.h +++ b/common/include/PKCS15DODF.h @@ -25,9 +25,14 @@ #include "PKCS15Object.h" #include "PKCS15OID.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class PKCS15DODF : public PKCS15Object + class LIBSCL_EXPORT_API PKCS15DODF : public PKCS15Object { private: map<ByteArray, PKCS15OID> mapOID; diff --git a/common/include/PKCS15ODF.h b/common/include/PKCS15ODF.h index a886f33..a75fc46 100644 --- a/common/include/PKCS15ODF.h +++ b/common/include/PKCS15ODF.h @@ -27,11 +27,16 @@ #include "PKCS15CDF.h" #include "PKCS15DODF.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class PKCS15ODF : public PKCS15Object + class LIBSCL_EXPORT_API PKCS15ODF : public PKCS15Object { private: PKCS15CDF *cdf; diff --git a/common/include/PKCS15OID.h b/common/include/PKCS15OID.h index 248150b..85bd9ab 100644 --- a/common/include/PKCS15OID.h +++ b/common/include/PKCS15OID.h @@ -24,9 +24,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class PKCS15OID + class LIBSCL_EXPORT_API PKCS15OID { private: ByteArray oid; diff --git a/common/include/PKCS15Object.h b/common/include/PKCS15Object.h index df76f72..3586069 100644 --- a/common/include/PKCS15Object.h +++ b/common/include/PKCS15Object.h @@ -27,11 +27,16 @@ #include "FileObject.h" #include "PKCS15Path.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class PKCS15Object : public FileObject + class LIBSCL_EXPORT_API PKCS15Object : public FileObject { protected: map<unsigned int, ByteArray> dataList; diff --git a/common/include/PKCS15Path.h b/common/include/PKCS15Path.h index 52f3894..4448e2e 100644 --- a/common/include/PKCS15Path.h +++ b/common/include/PKCS15Path.h @@ -24,9 +24,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class PKCS15Path + class LIBSCL_EXPORT_API PKCS15Path { private : ByteArray path; diff --git a/common/include/PKCS15TokenInfo.h b/common/include/PKCS15TokenInfo.h index 9f3ff80..cb7304e 100644 --- a/common/include/PKCS15TokenInfo.h +++ b/common/include/PKCS15TokenInfo.h @@ -24,9 +24,14 @@ /* local header */ #include "PKCS15Object.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class PKCS15TokenInfo : public PKCS15Object + class LIBSCL_EXPORT_API PKCS15TokenInfo : public PKCS15Object { public: PKCS15TokenInfo(Channel *channel); diff --git a/common/include/ProviderHelper.h b/common/include/ProviderHelper.h index 7418b6c..a522587 100644 --- a/common/include/ProviderHelper.h +++ b/common/include/ProviderHelper.h @@ -24,9 +24,14 @@ /* local header */ #include "Channel.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ProviderHelper + class LIBSCL_EXPORT_API ProviderHelper { protected: Channel *channel; diff --git a/common/include/ReaderHelper.h b/common/include/ReaderHelper.h index 259044a..f2aace7 100644 --- a/common/include/ReaderHelper.h +++ b/common/include/ReaderHelper.h @@ -27,6 +27,11 @@ #include "Synchronous.h" #include "SessionHelper.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api @@ -36,7 +41,7 @@ namespace smartcard_service_api typedef void (*openSessionCallback)(SessionHelper *session, int error, void *userData); - class ReaderHelper : public Synchronous + class LIBSCL_EXPORT_API ReaderHelper : public Synchronous { protected: SEServiceHelper *seService; diff --git a/common/include/Record.h b/common/include/Record.h index c1aca80..7e2a349 100644 --- a/common/include/Record.h +++ b/common/include/Record.h @@ -19,9 +19,14 @@ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class Record + class LIBSCL_EXPORT_API Record { private: unsigned int id; diff --git a/common/include/SEServiceHelper.h b/common/include/SEServiceHelper.h index 4afbfcb..c213a2d 100644 --- a/common/include/SEServiceHelper.h +++ b/common/include/SEServiceHelper.h @@ -26,11 +26,16 @@ #include "Synchronous.h" #include "ReaderHelper.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class SEServiceHelper : public Synchronous + class LIBSCL_EXPORT_API SEServiceHelper : public Synchronous { protected: vector<ReaderHelper *> readers; diff --git a/common/include/Serializable.h b/common/include/Serializable.h index a138cd6..63b7052 100644 --- a/common/include/Serializable.h +++ b/common/include/Serializable.h @@ -19,9 +19,14 @@ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class Serializable + class LIBSCL_EXPORT_API Serializable { virtual const ByteArray serialize() const = 0; virtual void deserialize(const ByteArray &buffer) = 0; diff --git a/common/include/SessionHelper.h b/common/include/SessionHelper.h index 3e220e6..e2d2f2f 100644 --- a/common/include/SessionHelper.h +++ b/common/include/SessionHelper.h @@ -27,6 +27,11 @@ #include "ByteArray.h" #include "Channel.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api @@ -38,7 +43,7 @@ namespace smartcard_service_api typedef void (*closeSessionCallback)(int error, void *userData); typedef void (*getChannelCountCallback)(unsigned count, int error, void *userData); - class SessionHelper : public Synchronous + class LIBSCL_EXPORT_API SessionHelper : public Synchronous { protected: ReaderHelper *reader; diff --git a/common/include/SignatureHelper.h b/common/include/SignatureHelper.h index f65844c..b2f7084 100644 --- a/common/include/SignatureHelper.h +++ b/common/include/SignatureHelper.h @@ -31,11 +31,16 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + using namespace std; namespace smartcard_service_api { - class SignatureHelper + class LIBSCL_EXPORT_API SignatureHelper { public: static int getPackageName(int pid, char *package, size_t length); @@ -54,7 +59,7 @@ extern "C" { #endif /* __cplusplus */ -typedef struct _certiHash +typedef struct LIBSCL_EXPORT_API _certiHash { uint8_t *value; uint32_t length; @@ -63,8 +68,8 @@ typedef struct _certiHash typedef void (*signature_helper_get_certificate_hashes_cb)(void *user_param, uint8_t *hash, uint32_t length); -int signature_helper_get_certificate_hashes(const char *packageName, certiHash **hash); -int signature_helper_get_certificate_hashes_by_pid(int pid, certiHash **hash); +LIBSCL_EXPORT_API int signature_helper_get_certificate_hashes(const char *packageName, certiHash **hash); +LIBSCL_EXPORT_API int signature_helper_get_certificate_hashes_by_pid(int pid, certiHash **hash); #ifdef __cplusplus } diff --git a/common/include/SimpleTLV.h b/common/include/SimpleTLV.h index d3311b4..20088f3 100644 --- a/common/include/SimpleTLV.h +++ b/common/include/SimpleTLV.h @@ -25,9 +25,14 @@ #include "ByteArray.h" #include "TLVHelper.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class SimpleTLV : public TLVHelper + class LIBSCL_EXPORT_API SimpleTLV : public TLVHelper { private: SimpleTLV(TLVHelper *parent); diff --git a/common/include/Synchronous.h b/common/include/Synchronous.h index 479b902..204c5b4 100644 --- a/common/include/Synchronous.h +++ b/common/include/Synchronous.h @@ -20,13 +20,18 @@ /* standard library header */ #include <pthread.h> +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + /* SLP library header */ /* local header */ namespace smartcard_service_api { - class Synchronous + class LIBSCL_EXPORT_API Synchronous { protected: pthread_mutex_t syncMutex; diff --git a/common/include/TLVHelper.h b/common/include/TLVHelper.h index 04c6694..c7fb35c 100644 --- a/common/include/TLVHelper.h +++ b/common/include/TLVHelper.h @@ -25,9 +25,14 @@ /* local header */ #include "ByteArray.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class TLVHelper + class LIBSCL_EXPORT_API TLVHelper { protected: TLVHelper *currentTLV; diff --git a/common/include/Terminal.h b/common/include/Terminal.h index c26003a..9999b0a 100644 --- a/common/include/Terminal.h +++ b/common/include/Terminal.h @@ -25,6 +25,11 @@ #include "ByteArray.h" #include "Synchronous.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { typedef void (*terminalNotificationCallback)(const void *terminal, int event, int error, void *user_param); @@ -32,7 +37,7 @@ namespace smartcard_service_api typedef void (*terminalTransmitCallback)(const unsigned char *buffer, unsigned int length, int error, void *userParam); typedef void (*terminalGetATRCallback)(const unsigned char *buffer, unsigned int length, int error, void *userParam); - class Terminal : public Synchronous + class LIBSCL_EXPORT_API Terminal : public Synchronous { protected: terminalNotificationCallback statusCallback; diff --git a/server/include/ClientInstance.h b/server/include/ClientInstance.h index 25a0bfc..7d63956 100644 --- a/server/include/ClientInstance.h +++ b/server/include/ClientInstance.h @@ -27,9 +27,14 @@ /* local header */ #include "ServiceInstance.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ClientInstance + class LIBSCL_EXPORT_API ClientInstance { private : string name; diff --git a/server/include/ServerChannel.h b/server/include/ServerChannel.h index 1df1576..706d818 100644 --- a/server/include/ServerChannel.h +++ b/server/include/ServerChannel.h @@ -26,9 +26,14 @@ #include "Terminal.h" #include "ServerSession.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { - class ServerChannel: public Channel + class LIBSCL_EXPORT_API ServerChannel: public Channel { private: Terminal *terminal; diff --git a/server/include/ServerGDBus.h b/server/include/ServerGDBus.h index 9a29246..ac361fd 100644 --- a/server/include/ServerGDBus.h +++ b/server/include/ServerGDBus.h @@ -29,13 +29,18 @@ #include "GDBusHelper.h" #include "smartcard-service-gdbus.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { typedef void (*dispatcher_cb_t)(vector<void *> ¶ms); - class GDBusDispatcher : public Synchronous + class LIBSCL_EXPORT_API GDBusDispatcher : public Synchronous { public : static GDBusDispatcher &getInstance(); @@ -53,7 +58,7 @@ namespace smartcard_service_api static gboolean dispatch(gpointer user_data); }; - class ServerGDBus + class LIBSCL_EXPORT_API ServerGDBus { public : GDBusProxy *dbus_proxy; diff --git a/server/include/ServerReader.h b/server/include/ServerReader.h index 063410b..5057810 100644 --- a/server/include/ServerReader.h +++ b/server/include/ServerReader.h @@ -29,13 +29,18 @@ #include "ServerChannel.h" #include "AccessControlList.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { class ServerSEService; - class ServerReader : public ReaderHelper + class LIBSCL_EXPORT_API ServerReader : public ReaderHelper { private: Terminal *terminal; diff --git a/server/include/ServerResource.h b/server/include/ServerResource.h index 35b5de2..9c19d5e 100644 --- a/server/include/ServerResource.h +++ b/server/include/ServerResource.h @@ -34,11 +34,16 @@ #include "ClientInstance.h" #include "ServiceInstance.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class IntegerHandle + class LIBSCL_EXPORT_API IntegerHandle { private: static unsigned int newHandle; @@ -52,7 +57,7 @@ namespace smartcard_service_api static void releaseHandle(unsigned int); }; - class ServerResource + class LIBSCL_EXPORT_API ServerResource { private: /* non-static member */ @@ -137,7 +142,7 @@ namespace smartcard_service_api ServerChannel *createInternalChannel(Terminal *terminal, int channelType); - friend void terminalCallback(void *terminal, int event, int error, void *user_param); + LIBSCL_EXPORT_API friend void terminalCallback(void *terminal, int event, int error, void *user_param); }; } /* namespace smartcard_service_api */ diff --git a/server/include/ServerSEService.h b/server/include/ServerSEService.h index b5c8d5e..4801962 100644 --- a/server/include/ServerSEService.h +++ b/server/include/ServerSEService.h @@ -27,11 +27,16 @@ #include "Terminal.h" #include "ServerReader.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { - class ServerSEService : public SEServiceHelper + class LIBSCL_EXPORT_API ServerSEService : public SEServiceHelper { private: vector<void *> libraries; @@ -59,8 +64,8 @@ namespace smartcard_service_api void shutdown() {} void shutdownSync() {} - friend void terminalCallback(const void *name, int event, int error, void *user_param); - friend bool dispatcherCallback(void *message, int socket); + LIBSCL_EXPORT_API friend void terminalCallback(const void *name, int event, int error, void *user_param); + LIBSCL_EXPORT_API friend bool dispatcherCallback(void *message, int socket); friend class ServerDispatcher; }; diff --git a/server/include/ServerSession.h b/server/include/ServerSession.h index 4f9ec46..ecb7036 100644 --- a/server/include/ServerSession.h +++ b/server/include/ServerSession.h @@ -29,13 +29,18 @@ #include "Terminal.h" #include "SessionHelper.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + using namespace std; namespace smartcard_service_api { class ServerReader; - class ServerSession : public SessionHelper + class LIBSCL_EXPORT_API ServerSession : public SessionHelper { private: Terminal *terminal; diff --git a/server/include/ServiceInstance.h b/server/include/ServiceInstance.h index a1acaea..4f64750 100644 --- a/server/include/ServiceInstance.h +++ b/server/include/ServiceInstance.h @@ -27,11 +27,16 @@ #include "ServerChannel.h" #include "ServerSession.h" +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + namespace smartcard_service_api { class ClientInstance; - class ServiceInstance + class LIBSCL_EXPORT_API ServiceInstance { private: unsigned int handle; diff --git a/server/include/SmartcardDbus.h b/server/include/SmartcardDbus.h index e9154f6..101b3dd 100644 --- a/server/include/SmartcardDbus.h +++ b/server/include/SmartcardDbus.h @@ -20,6 +20,11 @@ /* standard library header */ #include <glib-object.h> +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + /* SLP library header */ /* local header */ @@ -30,7 +35,7 @@ typedef struct _Smartcard_ServiceClass Smartcard_ServiceClass; #define SMARTCARD_SERVICE_NAME "org.tizen.SmartcardService" #define SMARTCARD_SERVICE_PATH "/org/tizen/SmartcardService" -GType smartcard_service_get_type(void); +LIBSCL_EXPORT_API GType smartcard_service_get_type(void); struct _Smartcard_Service { @@ -55,12 +60,12 @@ typedef enum SMARTCARD_SERVICE_ERROR_INVALID_PRAM } Smartcard_Service_Error; -GQuark smartcard_service_error_quark(void); +LIBSCL_EXPORT_API GQuark smartcard_service_error_quark(void); #define SMARTCARD_SERVICE_ERROR smartcard_service_error_quark () /** * launch the nfc-manager */ -gboolean smartcard_service_launch(Smartcard_Service *smartcard_service, guint *result_val, GError **error); +LIBSCL_EXPORT_API gboolean smartcard_service_launch(Smartcard_Service *smartcard_service, guint *result_val, GError **error); #endif /* SMARTCARDDBUS_H_ */ diff --git a/server/include/smartcard-daemon.h b/server/include/smartcard-daemon.h index 17cc583..ec3e736 100644 --- a/server/include/smartcard-daemon.h +++ b/server/include/smartcard-daemon.h @@ -17,6 +17,11 @@ #ifndef SMARTCARD_DAEMON_H_ #define SMARTCARD_DAEMON_H_ -void smartcard_daemon_exit(); +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + + +LIBSCL_EXPORT_API void smartcard_daemon_exit(); #endif /* SMARTCARD_DAEMON_H_ */ diff --git a/server/private/PKCS15CDFACL.h b/server/private/PKCS15CDFACL.h index 93c18b9..040f32f 100644 --- a/server/private/PKCS15CDFACL.h +++ b/server/private/PKCS15CDFACL.h @@ -29,9 +29,14 @@ #endif /* __cplusplus */ #ifdef __cplusplus + +#ifndef LIBSCL_EXPORT_API +#define LIBSCL_EXPORT_API +#endif // LIBSCL_EXPORT_API + namespace smartcard_service_api { - class PKCS15CDFACL : public AccessControlList + class LIBSCL_EXPORT_API PKCS15CDFACL : public AccessControlList { private: int loadRules(Channel *channel, PKCS15CDF *cdf); |