diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-24 02:27:47 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-26 11:43:54 -0500 |
commit | 621d9e5c413e561293d7484b93882d985b3fe15f (patch) | |
tree | 638f3d75761c121d9a8fb50b52a12a6686c5ac5c /base/tps/src/msg | |
parent | 40d3643b8d91886bf210aa27f711731c81a11e49 (diff) | |
download | pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.gz pki-621d9e5c413e561293d7484b93882d985b3fe15f.tar.xz pki-621d9e5c413e561293d7484b93882d985b3fe15f.zip |
Removed unnecessary pki folder.
Previously the source code was located inside a pki folder.
This folder was created during svn migration and is no longer
needed. This folder has now been removed and the contents have
been moved up one level.
Ticket #131
Diffstat (limited to 'base/tps/src/msg')
-rw-r--r-- | base/tps/src/msg/RA_ASQ_Request_Msg.cpp | 70 | ||||
-rw-r--r-- | base/tps/src/msg/RA_ASQ_Response_Msg.cpp | 68 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Begin_Op_Msg.cpp | 72 | ||||
-rw-r--r-- | base/tps/src/msg/RA_End_Op_Msg.cpp | 73 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Extended_Login_Request_Msg.cpp | 114 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Extended_Login_Response_Msg.cpp | 65 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Login_Request_Msg.cpp | 71 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Login_Response_Msg.cpp | 85 | ||||
-rw-r--r-- | base/tps/src/msg/RA_New_Pin_Request_Msg.cpp | 70 | ||||
-rw-r--r-- | base/tps/src/msg/RA_New_Pin_Response_Msg.cpp | 68 | ||||
-rw-r--r-- | base/tps/src/msg/RA_SecureId_Request_Msg.cpp | 69 | ||||
-rw-r--r-- | base/tps/src/msg/RA_SecureId_Response_Msg.cpp | 83 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Status_Update_Request_Msg.cpp | 66 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Status_Update_Response_Msg.cpp | 56 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Token_PDU_Request_Msg.cpp | 63 | ||||
-rw-r--r-- | base/tps/src/msg/RA_Token_PDU_Response_Msg.cpp | 68 |
16 files changed, 1161 insertions, 0 deletions
diff --git a/base/tps/src/msg/RA_ASQ_Request_Msg.cpp b/base/tps/src/msg/RA_ASQ_Request_Msg.cpp new file mode 100644 index 000000000..112c42152 --- /dev/null +++ b/base/tps/src/msg/RA_ASQ_Request_Msg.cpp @@ -0,0 +1,70 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "main/Base.h" +#include "msg/RA_ASQ_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs A Security Question (ASQ) request message. + */ +TPS_PUBLIC RA_ASQ_Request_Msg::RA_ASQ_Request_Msg (char *question) +{ + if (question == NULL) + m_question = NULL; + else + m_question = PL_strdup(question); +} + + +/** + * Destructs a ASQ request message. + */ +TPS_PUBLIC RA_ASQ_Request_Msg::~RA_ASQ_Request_Msg () +{ + if( m_question != NULL ) { + PL_strfree( m_question ); + m_question = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_ASQ_Request_Msg::GetType () +{ + return MSG_ASQ_REQUEST; +} + +/** + * Retrieves the security question for + * the end user. + */ +TPS_PUBLIC char *RA_ASQ_Request_Msg::GetQuestion() +{ + return m_question; +} diff --git a/base/tps/src/msg/RA_ASQ_Response_Msg.cpp b/base/tps/src/msg/RA_ASQ_Response_Msg.cpp new file mode 100644 index 000000000..5e480c1f1 --- /dev/null +++ b/base/tps/src/msg/RA_ASQ_Response_Msg.cpp @@ -0,0 +1,68 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "msg/RA_ASQ_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs A Security Question (ASQ) response. + */ +TPS_PUBLIC RA_ASQ_Response_Msg::RA_ASQ_Response_Msg (char *answer) +{ + if (answer == NULL) + m_answer = NULL; + else + m_answer = PL_strdup(answer); +} + +/** + * Destructs a ASQ response. + */ +TPS_PUBLIC RA_ASQ_Response_Msg::~RA_ASQ_Response_Msg () +{ + if( m_answer != NULL ) { + PL_strfree( m_answer ); + m_answer = NULL; + } +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_ASQ_Response_Msg::GetType () +{ + return MSG_ASQ_RESPONSE; +} + +/** + * Retrieves the answer to the security question + * from the end user. + */ +TPS_PUBLIC char *RA_ASQ_Response_Msg::GetAnswer() +{ + return m_answer; +} diff --git a/base/tps/src/msg/RA_Begin_Op_Msg.cpp b/base/tps/src/msg/RA_Begin_Op_Msg.cpp new file mode 100644 index 000000000..44d568bd9 --- /dev/null +++ b/base/tps/src/msg/RA_Begin_Op_Msg.cpp @@ -0,0 +1,72 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_Begin_Op_Msg.h" +#include "main/Memory.h" +#include "main/NameValueSet.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a begin op message. Each operation + * transaction (i.e. enrollment, reset pin) + * starts with a Begin Op message. + */ +TPS_PUBLIC RA_Begin_Op_Msg::RA_Begin_Op_Msg (RA_Op_Type op, NameValueSet *exts) +{ + m_op = op; + m_exts = exts; +} + +/** + * Destructs a begin op message. + */ +TPS_PUBLIC RA_Begin_Op_Msg::~RA_Begin_Op_Msg () +{ + if( m_exts != NULL ) { + delete m_exts; + m_exts = NULL; + } +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Begin_Op_Msg::GetType () +{ + return MSG_BEGIN_OP; +} + +TPS_PUBLIC NameValueSet *RA_Begin_Op_Msg::GetExtensions() +{ + return m_exts; +} + +/** + * Retrieves operation type. + */ +TPS_PUBLIC RA_Op_Type RA_Begin_Op_Msg::GetOpType() +{ + return m_op; +} diff --git a/base/tps/src/msg/RA_End_Op_Msg.cpp b/base/tps/src/msg/RA_End_Op_Msg.cpp new file mode 100644 index 000000000..232122d49 --- /dev/null +++ b/base/tps/src/msg/RA_End_Op_Msg.cpp @@ -0,0 +1,73 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_End_Op_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a begin op message. Each operation + * transaction (i.e. enrollment, reset pin) + * starts with a Begin Op message. + */ +TPS_PUBLIC RA_End_Op_Msg::RA_End_Op_Msg (RA_Op_Type op, int result, int msg) +{ + m_op = op; + m_result = result; + m_msg = msg; +} + +/** + * Destructs a begin op message. + */ +TPS_PUBLIC RA_End_Op_Msg::~RA_End_Op_Msg () +{ +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_End_Op_Msg::GetType () +{ + return MSG_END_OP; +} + +/** + * Retrieves operation type. + */ +TPS_PUBLIC RA_Op_Type RA_End_Op_Msg::GetOpType() +{ + return m_op; +} + +TPS_PUBLIC int RA_End_Op_Msg::GetResult() +{ + return m_result; +} + +TPS_PUBLIC int RA_End_Op_Msg::GetMsg() +{ + return m_msg; +} diff --git a/base/tps/src/msg/RA_Extended_Login_Request_Msg.cpp b/base/tps/src/msg/RA_Extended_Login_Request_Msg.cpp new file mode 100644 index 000000000..9da2f6d8f --- /dev/null +++ b/base/tps/src/msg/RA_Extended_Login_Request_Msg.cpp @@ -0,0 +1,114 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + + +#include "plstr.h" +#include "main/Base.h" +#include "msg/RA_Extended_Login_Request_Msg.h" +#include "engine/RA.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a login request message that requests + * user id and password from the end user. + */ +TPS_PUBLIC RA_Extended_Login_Request_Msg::RA_Extended_Login_Request_Msg (int invalid_pw, int blocked, char **parameters, int len, char *title, char *description) +{ + m_invalid_pw = invalid_pw; + m_blocked = blocked; + m_title = PL_strdup(title); + m_description = PL_strdup(description); + if (parameters != NULL) { + if (len > 0) { + m_parameters = (char **) PR_Malloc (len); + for (int i = 0; i < len; i++) { + m_parameters[i] = PL_strdup(parameters[i]); + } + } else { + m_parameters = NULL; + } + } + m_len = len; +} + +/** + * Destructs a login request message. + */ +TPS_PUBLIC RA_Extended_Login_Request_Msg::~RA_Extended_Login_Request_Msg () +{ + for (int i = 0; i < m_len; i++) { + PL_strfree(m_parameters[i]); + } + if (m_parameters != NULL) { + PR_Free(m_parameters); + } +} + +TPS_PUBLIC int RA_Extended_Login_Request_Msg::GetLen () +{ + return m_len; +} + +TPS_PUBLIC char *RA_Extended_Login_Request_Msg::GetTitle() +{ + return m_title; +} + +TPS_PUBLIC char *RA_Extended_Login_Request_Msg::GetDescription() +{ + return m_description; +} + +TPS_PUBLIC char *RA_Extended_Login_Request_Msg::GetParam (int i) +{ + return m_parameters[i]; +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Extended_Login_Request_Msg::GetType () +{ + return MSG_EXTENDED_LOGIN_REQUEST; +} + +/** + * Is the password invalid in the previous login + * request. + */ +TPS_PUBLIC int RA_Extended_Login_Request_Msg::IsInvalidPassword() +{ + return m_invalid_pw; +} + +/** + * Should the client block due to the previous + * invalid login. + */ +TPS_PUBLIC int RA_Extended_Login_Request_Msg::IsBlocked() +{ + return m_blocked; +} diff --git a/base/tps/src/msg/RA_Extended_Login_Response_Msg.cpp b/base/tps/src/msg/RA_Extended_Login_Response_Msg.cpp new file mode 100644 index 000000000..f1d66b558 --- /dev/null +++ b/base/tps/src/msg/RA_Extended_Login_Response_Msg.cpp @@ -0,0 +1,65 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "msg/RA_Extended_Login_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a login response message. + */ +TPS_PUBLIC RA_Extended_Login_Response_Msg::RA_Extended_Login_Response_Msg (AuthParams *params) +{ + m_params = params; +} + +/** + * Destructs a login response message. + */ +TPS_PUBLIC RA_Extended_Login_Response_Msg::~RA_Extended_Login_Response_Msg () +{ + if( m_params != NULL ) { + delete m_params; + m_params = NULL; + } +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Extended_Login_Response_Msg::GetType () +{ + return MSG_EXTENDED_LOGIN_RESPONSE; +} + +/** + * Retrieves null-pointer terminated + * user ID given by the end user. + */ +TPS_PUBLIC AuthParams *RA_Extended_Login_Response_Msg::GetAuthParams() +{ + return m_params; +} diff --git a/base/tps/src/msg/RA_Login_Request_Msg.cpp b/base/tps/src/msg/RA_Login_Request_Msg.cpp new file mode 100644 index 000000000..7bad331d7 --- /dev/null +++ b/base/tps/src/msg/RA_Login_Request_Msg.cpp @@ -0,0 +1,71 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_Login_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a login request message that requests + * user id and password from the end user. + */ +TPS_PUBLIC RA_Login_Request_Msg::RA_Login_Request_Msg (int invalid_pw, int blocked) +{ + m_invalid_pw = invalid_pw; + m_blocked = blocked; +} + +/** + * Destructs a login request message. + */ +TPS_PUBLIC RA_Login_Request_Msg::~RA_Login_Request_Msg () +{ +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Login_Request_Msg::GetType () +{ + return MSG_LOGIN_REQUEST; +} + +/** + * Is the password invalid in the previous login + * request. + */ +TPS_PUBLIC int RA_Login_Request_Msg::IsInvalidPassword() +{ + return m_invalid_pw; +} + +/** + * Should the client block due to the previous + * invalid login. + */ +TPS_PUBLIC int RA_Login_Request_Msg::IsBlocked() +{ + return m_blocked; +} diff --git a/base/tps/src/msg/RA_Login_Response_Msg.cpp b/base/tps/src/msg/RA_Login_Response_Msg.cpp new file mode 100644 index 000000000..67d796e6e --- /dev/null +++ b/base/tps/src/msg/RA_Login_Response_Msg.cpp @@ -0,0 +1,85 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "msg/RA_Login_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a login response message. + */ +TPS_PUBLIC RA_Login_Response_Msg::RA_Login_Response_Msg (char *uid, char *password) +{ + if (uid == NULL) + m_uid = NULL; + else + m_uid = PL_strdup(uid); + if (password == NULL) + m_password = NULL; + else + m_password = PL_strdup(password); +} + +/** + * Destructs a login response message. + */ +TPS_PUBLIC RA_Login_Response_Msg::~RA_Login_Response_Msg () +{ + if( m_uid != NULL ) { + PL_strfree( m_uid ); + m_uid = NULL; + } + if( m_password != NULL ) { + PL_strfree( m_password ); + m_password = NULL; + } +} + +/** + * Retrieves message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Login_Response_Msg::GetType () +{ + return MSG_LOGIN_RESPONSE; +} + +/** + * Retrieves null-pointer terminated + * user ID given by the end user. + */ +TPS_PUBLIC char *RA_Login_Response_Msg::GetUID() +{ + return m_uid; +} + +/** + * Retrieves null-pointer terminated password + * given by the end user. + */ +TPS_PUBLIC char *RA_Login_Response_Msg::GetPassword() +{ + return m_password; +} diff --git a/base/tps/src/msg/RA_New_Pin_Request_Msg.cpp b/base/tps/src/msg/RA_New_Pin_Request_Msg.cpp new file mode 100644 index 000000000..71889359e --- /dev/null +++ b/base/tps/src/msg/RA_New_Pin_Request_Msg.cpp @@ -0,0 +1,70 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_New_Pin_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a new pin request for the token. + */ +TPS_PUBLIC RA_New_Pin_Request_Msg::RA_New_Pin_Request_Msg (int min_len, int max_len) +{ + m_min_len = min_len; + m_max_len = max_len; +} + + +/** + * Destructs a new pin request. + */ +TPS_PUBLIC RA_New_Pin_Request_Msg::~RA_New_Pin_Request_Msg () +{ +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_New_Pin_Request_Msg::GetType () +{ + return MSG_NEW_PIN_REQUEST; +} + +/** + * Retrieves the minimium length required for the new password. + */ +TPS_PUBLIC int RA_New_Pin_Request_Msg::GetMinLen() +{ + return m_min_len; +} + + +/** + * Retrieves the maximium length required for the new password. + */ +TPS_PUBLIC int RA_New_Pin_Request_Msg::GetMaxLen() +{ + return m_max_len; +} diff --git a/base/tps/src/msg/RA_New_Pin_Response_Msg.cpp b/base/tps/src/msg/RA_New_Pin_Response_Msg.cpp new file mode 100644 index 000000000..69b63f934 --- /dev/null +++ b/base/tps/src/msg/RA_New_Pin_Response_Msg.cpp @@ -0,0 +1,68 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "msg/RA_New_Pin_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a new pin response. + */ +TPS_PUBLIC RA_New_Pin_Response_Msg::RA_New_Pin_Response_Msg (char *new_pin) +{ + if (new_pin == NULL) + m_new_pin = NULL; + else + m_new_pin = PL_strdup(new_pin); +} + +/** + * Destructs a new pin response. + */ +TPS_PUBLIC RA_New_Pin_Response_Msg::~RA_New_Pin_Response_Msg () +{ + if( m_new_pin != NULL ) { + PL_strfree( m_new_pin ); + m_new_pin = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_New_Pin_Response_Msg::GetType () +{ + return MSG_NEW_PIN_RESPONSE; +} + +/** + * Retrieves the null-pointer terminated new pin + * from the end user. + */ +TPS_PUBLIC char *RA_New_Pin_Response_Msg::GetNewPIN() +{ + return m_new_pin; +} diff --git a/base/tps/src/msg/RA_SecureId_Request_Msg.cpp b/base/tps/src/msg/RA_SecureId_Request_Msg.cpp new file mode 100644 index 000000000..064461225 --- /dev/null +++ b/base/tps/src/msg/RA_SecureId_Request_Msg.cpp @@ -0,0 +1,69 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_SecureId_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Secure ID request message for requesting + * Secure ID input from the end user. + */ +TPS_PUBLIC RA_SecureId_Request_Msg::RA_SecureId_Request_Msg (int pin_required, int next_value) +{ + m_pin_required = pin_required; + m_next_value = next_value; +} + +/** + * Destructs a Secure ID request. + */ +TPS_PUBLIC RA_SecureId_Request_Msg::~RA_SecureId_Request_Msg () +{ +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_SecureId_Request_Msg::GetType () +{ + return MSG_SECUREID_REQUEST; +} + +/** + * Is PIN required? + */ +TPS_PUBLIC int RA_SecureId_Request_Msg::IsPinRequired() +{ + return m_pin_required; +} + +/** + * Is next value required? + */ +TPS_PUBLIC int RA_SecureId_Request_Msg::IsNextValue() +{ + return m_next_value; +} diff --git a/base/tps/src/msg/RA_SecureId_Response_Msg.cpp b/base/tps/src/msg/RA_SecureId_Response_Msg.cpp new file mode 100644 index 000000000..ff4191a61 --- /dev/null +++ b/base/tps/src/msg/RA_SecureId_Response_Msg.cpp @@ -0,0 +1,83 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "plstr.h" +#include "msg/RA_SecureId_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Secure ID response. + */ +TPS_PUBLIC RA_SecureId_Response_Msg::RA_SecureId_Response_Msg (char *value, char *pin) +{ + if (value == NULL) + m_value = NULL; + else + m_value = PL_strdup(value); + if (pin == NULL) + m_pin = NULL; + else + m_pin = PL_strdup(pin); +} + +/** + * Destructs a Secure ID response. + */ +TPS_PUBLIC RA_SecureId_Response_Msg::~RA_SecureId_Response_Msg () +{ + if( m_value != NULL ) { + PL_strfree( m_value ); + m_value = NULL; + } + if( m_pin != NULL ) { + PL_strfree( m_pin ); + m_pin = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_SecureId_Response_Msg::GetType () +{ + return MSG_SECUREID_RESPONSE; +} + +/** + * Retrieves the value. + */ +TPS_PUBLIC char *RA_SecureId_Response_Msg::GetValue() +{ + return m_value; +} + +/** + * Retrieves the PIN. + */ +TPS_PUBLIC char *RA_SecureId_Response_Msg::GetPIN() +{ + return m_pin; +} diff --git a/base/tps/src/msg/RA_Status_Update_Request_Msg.cpp b/base/tps/src/msg/RA_Status_Update_Request_Msg.cpp new file mode 100644 index 000000000..7bb0baefc --- /dev/null +++ b/base/tps/src/msg/RA_Status_Update_Request_Msg.cpp @@ -0,0 +1,66 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_Status_Update_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Token PDU request. + */ +TPS_PUBLIC RA_Status_Update_Request_Msg::RA_Status_Update_Request_Msg (int status, const char *info) +{ + m_status = status; + m_info = PL_strdup((char *) info); +} + +/** + * Destructs a Token PDU request. + */ +TPS_PUBLIC RA_Status_Update_Request_Msg::~RA_Status_Update_Request_Msg () +{ + if( m_info != NULL ) { + PL_strfree( m_info ); + m_info = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Status_Update_Request_Msg::GetType () +{ + return MSG_STATUS_UPDATE_REQUEST; +} + +TPS_PUBLIC int RA_Status_Update_Request_Msg::GetStatus() +{ + return m_status; +} + +TPS_PUBLIC char *RA_Status_Update_Request_Msg::GetInfo() +{ + return m_info; +} diff --git a/base/tps/src/msg/RA_Status_Update_Response_Msg.cpp b/base/tps/src/msg/RA_Status_Update_Response_Msg.cpp new file mode 100644 index 000000000..6053c9af6 --- /dev/null +++ b/base/tps/src/msg/RA_Status_Update_Response_Msg.cpp @@ -0,0 +1,56 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_Status_Update_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Token PDU request. + */ +TPS_PUBLIC RA_Status_Update_Response_Msg::RA_Status_Update_Response_Msg (int status) +{ + m_status = status; +} + +/** + * Destructs a Token PDU request. + */ +TPS_PUBLIC RA_Status_Update_Response_Msg::~RA_Status_Update_Response_Msg () +{ +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Status_Update_Response_Msg::GetType () +{ + return MSG_STATUS_UPDATE_RESPONSE; +} + +TPS_PUBLIC int RA_Status_Update_Response_Msg::GetStatus() +{ + return m_status; +} diff --git a/base/tps/src/msg/RA_Token_PDU_Request_Msg.cpp b/base/tps/src/msg/RA_Token_PDU_Request_Msg.cpp new file mode 100644 index 000000000..34b3d584b --- /dev/null +++ b/base/tps/src/msg/RA_Token_PDU_Request_Msg.cpp @@ -0,0 +1,63 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "msg/RA_Token_PDU_Request_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Token PDU request. + */ +TPS_PUBLIC RA_Token_PDU_Request_Msg::RA_Token_PDU_Request_Msg (APDU *apdu) +{ + m_apdu = apdu; +} + +/** + * Destructs a Token PDU request. + */ +TPS_PUBLIC RA_Token_PDU_Request_Msg::~RA_Token_PDU_Request_Msg () +{ + if( m_apdu != NULL ) { + delete m_apdu; + m_apdu = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Token_PDU_Request_Msg::GetType () +{ + return MSG_TOKEN_PDU_REQUEST; +} + +/** + * Retrieves the APDU that is targeted for the token. + */ +TPS_PUBLIC APDU *RA_Token_PDU_Request_Msg::GetAPDU() +{ + return m_apdu; +} diff --git a/base/tps/src/msg/RA_Token_PDU_Response_Msg.cpp b/base/tps/src/msg/RA_Token_PDU_Response_Msg.cpp new file mode 100644 index 000000000..41b11388c --- /dev/null +++ b/base/tps/src/msg/RA_Token_PDU_Response_Msg.cpp @@ -0,0 +1,68 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// Copyright (C) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +#include "apdu/APDU_Response.h" +#include "msg/RA_Token_PDU_Response_Msg.h" +#include "main/Memory.h" + +#ifdef XP_WIN32 +#define TPS_PUBLIC __declspec(dllexport) +#else /* !XP_WIN32 */ +#define TPS_PUBLIC +#endif /* !XP_WIN32 */ + +/** + * Constructs a Token PDU response. + */ +TPS_PUBLIC RA_Token_PDU_Response_Msg::RA_Token_PDU_Response_Msg (APDU_Response *response) +{ + m_response = response; +} + +/** + * Destructs a Token PDU response. + */ +TPS_PUBLIC RA_Token_PDU_Response_Msg::~RA_Token_PDU_Response_Msg () +{ + if( m_response != NULL ) { + delete m_response; + m_response = NULL; + } +} + +/** + * Retrieves the message type. + */ +TPS_PUBLIC RA_Msg_Type RA_Token_PDU_Response_Msg::GetType () +{ + return MSG_TOKEN_PDU_RESPONSE; +} + +/** + * Retrieves the response from the token. + * This response does not follow the standard + * APDU format. It is just a sequence of data + * with 2 bytes, at the end, that indicates + * the status. + */ +TPS_PUBLIC APDU_Response *RA_Token_PDU_Response_Msg::GetResponse() +{ + return m_response; +} |