RDK Documentation (Open Sourced RDK Components)
AampSharedMemorySystem.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2020 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #ifndef AAMPSHAREDMEMORYSYSTEM_H
21 #define AAMPSHAREDMEMORYSYSTEM_H
22 
23 /**
24  * @file AampSharedMemorySystem.h
25  * @brief Handles the functionalities for shared memory communication
26  */
27 
28 #include "AampMemorySystem.h"
29 
30 #include <fcntl.h>
31 #include <string>
32 
33 
34 /**
35  * @struct AampSharedMemoryInterchangeBuffer
36  * @brief Holds the Shared memory details
37  */
39 #ifdef AAMP_SHMEM_USE_SIZE_AND_INSTANCE
40  uint32_t size; /**< The size of this buffer, for testing */
41  uint32_t instanceNo; /**< The value appended to the SM file, 0 means no number, currently unused */
42 #endif
43  uint32_t dataSize; /**< The size of data stored in the shared memory */
44 };
45 
46 /**
47  * @class AampSharedMemorySystem
48  * @brief Handles the shared Memory operations
49  */
51 public:
53  virtual ~AampSharedMemorySystem();
54 
55  /**
56  * @fn encode
57  * @param dataIn pointer to the data to encode
58  * @param dataInSz the size to encode
59  * @param[out] dataOut the data to send
60  * @return true if data is encoded
61  */
62  virtual bool encode(const uint8_t *dataIn, uint32_t dataInSz, std::vector<uint8_t>& dataOut);
63  /**
64  * @fn decode
65  * @param dataIn pointer to the data to decode
66  * @param dataInSz the size to decode
67  * @param[out] dataOut the data to recover
68  * @param[in] dataOutSz the size of the space for data to recover
69  */
70  virtual bool decode(const uint8_t* dataIn, uint32_t dataInSz, uint8_t *dataOut, uint32_t dataOutSz);
71 private:
72  const std::string AAMP_SHARED_MEMORY_NAME{"/aamp_drm"};
73  const int AAMP_SHARED_MEMORY_CREATE_OFLAGS{O_RDWR | O_CREAT};
74  const int AAMP_SHARED_MEMORY_READ_OFLAGS{O_RDONLY};
75  const mode_t AAMP_SHARED_MEMORY_MODE{ S_IRWXU | S_IRWXG | S_IRWXO };
76 
77 };
78 
79 
80 #endif /* AAMPSHAREDMEMORYSYSTEM_H */
81 
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
AampSharedMemorySystem
Handles the shared Memory operations.
Definition: AampSharedMemorySystem.h:50
AampMemorySystem.h
Memory handler for Aamp DRM process.
AampSharedMemorySystem::encode
virtual bool encode(const uint8_t *dataIn, uint32_t dataInSz, std::vector< uint8_t > &dataOut)
Encode a block of data to send over the divide.
Definition: AampSharedMemorySystem.cpp:49
AampSharedMemoryInterchangeBuffer::dataSize
uint32_t dataSize
Definition: AampSharedMemorySystem.h:43
AampSharedMemorySystem::AampSharedMemorySystem
AampSharedMemorySystem(AampLogManager *logObj)
AampSharedMemorySystem constructor.
Definition: AampSharedMemorySystem.cpp:37
AampSharedMemorySystem::~AampSharedMemorySystem
virtual ~AampSharedMemorySystem()
AampSharedMemorySystem Destructor.
Definition: AampSharedMemorySystem.cpp:43
AampSharedMemoryInterchangeBuffer
Holds the Shared memory details.
Definition: AampSharedMemorySystem.h:38
AAMPMemorySystem
Handles the operations for AAMP memory managemnts.
Definition: AampMemorySystem.h:37
AampSharedMemorySystem::decode
virtual bool decode(const uint8_t *dataIn, uint32_t dataInSz, uint8_t *dataOut, uint32_t dataOutSz)
Decode from getting back.
Definition: AampSharedMemorySystem.cpp:102