00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __PANA_SECURITY_ASSOC_H__
00035 #define __PANA_SECURITY_ASSOC_H__
00036
00037 #include "pana_exports.h"
00038 #include "pana_message.h"
00039
00040 class PANA_EXPORT PANA_MacKey
00041 {
00042 public:
00043 PANA_MacKey() { }
00044 PANA_MacKey(diameter_octetstring_t &msk,
00045 ACE_UINT32 ISN_pac,
00046 ACE_UINT32 ISN_paa) {
00047 MacKey(msk, ISN_pac, ISN_paa);
00048 }
00049 diameter_octetstring_t &MacKey(diameter_octetstring_t &msk,
00050 ACE_UINT32 ISN_pac,
00051 ACE_UINT32 ISN_paa);
00052 diameter_octetstring_t &MacKey() { return m_MacKey; }
00053
00054 protected:
00055 diameter_octetstring_t m_MacKey;
00056 };
00057
00058 class PANA_EXPORT PANA_SecurityAssociation : public PANA_MacKey
00059 {
00060 public:
00061 PANA_SecurityAssociation() : m_KeyId(ACE_OS::rand()) { }
00062 ACE_UINT32 KeyId() {
00063 return m_KeyId;
00064 }
00065 void KeyId(ACE_UINT32 id) {
00066 m_KeyId = id;
00067 }
00068 diameter_octetstring_t &MSK() {
00069 return m_MSK;
00070 }
00071 diameter_octetstring_t &MSK(diameter_octetstring_t &msk,
00072 ACE_UINT32 ISN_pac,
00073 ACE_UINT32 ISN_paa) {
00074 PANA_MacKey::MacKey(msk, ISN_pac, ISN_paa);
00075 m_MSK = msk;
00076 return (m_MSK);
00077 }
00078
00079 bool AddMacValue(PANA_Message &msg);
00080 bool ValidateMacValue(PANA_Message &msg);
00081
00082 protected:
00083 void GenerateMacValue(AAAMessageBlock *panaPDU,
00084 diameter_octetstring_t &macValue);
00085 private:
00086 diameter_octetstring_t m_MSK;
00087 ACE_UINT32 m_KeyId;
00088 };
00089
00090 #endif
00091