Initial Contribution
This commit is contained in:
91
media/libdrm/mobile1/include/parser/parser_dcf.h
Normal file
91
media/libdrm/mobile1/include/parser/parser_dcf.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PARSER_DCF_H__
|
||||
#define __PARSER_DCF_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <drm_common_types.h>
|
||||
|
||||
#define MAX_ENCRYPTION_METHOD_LEN 64
|
||||
#define MAX_RIGHTS_ISSUER_LEN 256
|
||||
#define MAX_CONTENT_NAME_LEN 64
|
||||
#define MAX_CONTENT_DESCRIPTION_LEN 256
|
||||
#define MAX_CONTENT_VENDOR_LEN 256
|
||||
#define MAX_ICON_URI_LEN 256
|
||||
#define MAX_CONTENT_TYPE_LEN 64
|
||||
#define MAX_CONTENT_URI_LEN 256
|
||||
|
||||
#define HEADER_ENCRYPTION_METHOD "Encryption-Method: "
|
||||
#define HEADER_RIGHTS_ISSUER "Rights-Issuer: "
|
||||
#define HEADER_CONTENT_NAME "Content-Name: "
|
||||
#define HEADER_CONTENT_DESCRIPTION "Content-Description: "
|
||||
#define HEADER_CONTENT_VENDOR "Content-Vendor: "
|
||||
#define HEADER_ICON_URI "Icon-Uri: "
|
||||
|
||||
#define HEADER_ENCRYPTION_METHOD_LEN 19
|
||||
#define HEADER_RIGHTS_ISSUER_LEN 15
|
||||
#define HEADER_CONTENT_NAME_LEN 14
|
||||
#define HEADER_CONTENT_DESCRIPTION_LEN 21
|
||||
#define HEADER_CONTENT_VENDOR_LEN 16
|
||||
#define HEADER_ICON_URI_LEN 10
|
||||
|
||||
#define UINT_VAR_FLAG 0x80
|
||||
#define UINT_VAR_DATA 0x7F
|
||||
#define MAX_UINT_VAR_BYTE 5
|
||||
#define DRM_UINT_VAR_ERR -1
|
||||
|
||||
typedef struct _T_DRM_DCF_Info {
|
||||
uint8_t Version;
|
||||
uint8_t ContentTypeLen; /**< Length of the ContentType field */
|
||||
uint8_t ContentURILen; /**< Length of the ContentURI field */
|
||||
uint8_t unUsed;
|
||||
uint8_t ContentType[MAX_CONTENT_TYPE_LEN]; /**< The MIME media type of the plaintext data */
|
||||
uint8_t ContentURI[MAX_CONTENT_URI_LEN]; /**< The unique identifier of this content object */
|
||||
int32_t HeadersLen; /**< Length of the Headers field */
|
||||
int32_t EncryptedDataLen; /**< Length of the encrypted data field */
|
||||
int32_t DecryptedDataLen; /**< Length of the decrypted data field */
|
||||
uint8_t Encryption_Method[MAX_ENCRYPTION_METHOD_LEN]; /**< Encryption method */
|
||||
uint8_t Rights_Issuer[MAX_RIGHTS_ISSUER_LEN]; /**< Rights issuer */
|
||||
uint8_t Content_Name[MAX_CONTENT_NAME_LEN]; /**< Content name */
|
||||
uint8_t ContentDescription[MAX_CONTENT_DESCRIPTION_LEN]; /**< Content description */
|
||||
uint8_t ContentVendor[MAX_CONTENT_VENDOR_LEN]; /**< Content vendor */
|
||||
uint8_t Icon_URI[MAX_ICON_URI_LEN]; /**< Icon URI */
|
||||
} T_DRM_DCF_Info;
|
||||
|
||||
/**
|
||||
* Parse the DRM content format data
|
||||
*
|
||||
* \param buffer (in)Input the DCF format data
|
||||
* \param bufferLen (in)The input buffer length
|
||||
* \param pDcfInfo (out)A structure pointer which contain information of DCF headers
|
||||
* \param ppEncryptedData (out)The location of encrypted data
|
||||
*
|
||||
* \return
|
||||
* -TRUE, when success
|
||||
* -FALSE, when failed
|
||||
*/
|
||||
int32_t drm_dcfParser(uint8_t *buffer, int32_t bufferLen, T_DRM_DCF_Info *pDcfInfo,
|
||||
uint8_t **ppEncryptedData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PARSER_DCF_H__ */
|
||||
101
media/libdrm/mobile1/include/parser/parser_dm.h
Normal file
101
media/libdrm/mobile1/include/parser/parser_dm.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PARSER_DM_H__
|
||||
#define __PARSER_DM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <drm_common_types.h>
|
||||
|
||||
#define MAX_CONTENT_TYPE_LEN 64
|
||||
#define MAX_CONTENT_ID 256
|
||||
#define MAX_CONTENT_BOUNDARY_LEN 256
|
||||
#define MAX_RIGHTS_ISSUER_LEN 256
|
||||
|
||||
#define DRM_MIME_TYPE_RIGHTS_XML "application/vnd.oma.drm.rights+xml"
|
||||
#define DRM_MIME_TYPE_CONTENT "application/vnd.oma.drm.content"
|
||||
|
||||
#define HEADERS_TRANSFER_CODING "Content-Transfer-Encoding:"
|
||||
#define HEADERS_CONTENT_TYPE "Content-Type:"
|
||||
#define HEADERS_CONTENT_ID "Content-ID:"
|
||||
|
||||
#define TRANSFER_CODING_TYPE_7BIT "7bit"
|
||||
#define TRANSFER_CODING_TYPE_8BIT "8bit"
|
||||
#define TRANSFER_CODING_TYPE_BINARY "binary"
|
||||
#define TRANSFER_CODING_TYPE_BASE64 "base64"
|
||||
|
||||
#define DRM_UID_TYPE_FORWORD_LOCK "forwardlock"
|
||||
#define DRM_NEW_LINE_CRLF "\r\n"
|
||||
|
||||
#define HEADERS_TRANSFER_CODING_LEN 26
|
||||
#define HEADERS_CONTENT_TYPE_LEN 13
|
||||
#define HEADERS_CONTENT_ID_LEN 11
|
||||
|
||||
#define DRM_MESSAGE_CODING_7BIT 0 /* default */
|
||||
#define DRM_MESSAGE_CODING_8BIT 1
|
||||
#define DRM_MESSAGE_CODING_BINARY 2
|
||||
#define DRM_MESSAGE_CODING_BASE64 3
|
||||
|
||||
#define DRM_B64_DEC_BLOCK 3
|
||||
#define DRM_B64_ENC_BLOCK 4
|
||||
|
||||
typedef struct _T_DRM_DM_Info {
|
||||
uint8_t contentType[MAX_CONTENT_TYPE_LEN]; /**< Content type */
|
||||
uint8_t contentID[MAX_CONTENT_ID]; /**< Content ID */
|
||||
uint8_t boundary[MAX_CONTENT_BOUNDARY_LEN]; /**< DRM message's boundary */
|
||||
uint8_t deliveryType; /**< The Delivery type */
|
||||
uint8_t transferEncoding; /**< Transfer encoding type */
|
||||
int32_t contentOffset; /**< The offset of the media content from the original DRM data */
|
||||
int32_t contentLen; /**< The length of the media content */
|
||||
int32_t rightsOffset; /**< The offset of the rights object in case of combined delivery */
|
||||
int32_t rightsLen; /**< The length of the rights object in case of combined delivery */
|
||||
uint8_t rightsIssuer[MAX_RIGHTS_ISSUER_LEN];/**< The rights issuer address in case of separate delivery */
|
||||
} T_DRM_DM_Info;
|
||||
|
||||
/**
|
||||
* Search the string in a limited length.
|
||||
*
|
||||
* \param str The original string
|
||||
* \param strSearch The sub-string to be searched
|
||||
* \param len The length limited
|
||||
*
|
||||
* \return
|
||||
* -NULL, when there is not the searched string in length
|
||||
* -The pointer of this sub-string
|
||||
*/
|
||||
const uint8_t* drm_strnstr(const uint8_t* str, const uint8_t* strSearch, int32_t len);
|
||||
|
||||
/**
|
||||
* Parse the DRM message format data.
|
||||
*
|
||||
* \param buffer (in)Input the DRM message format data
|
||||
* \param bufferLen (in)The input buffer length
|
||||
* \param pDmInfo (out)A structure pointer which contain information of DRM message headers
|
||||
*
|
||||
* \return
|
||||
* -TRUE, when success
|
||||
* -FALSE, when failed
|
||||
*/
|
||||
int32_t drm_parseDM(const uint8_t* buffer, int32_t bufferLen, T_DRM_DM_Info* pDmInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PARSER_DM_H__ */
|
||||
123
media/libdrm/mobile1/include/parser/parser_rel.h
Normal file
123
media/libdrm/mobile1/include/parser/parser_rel.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PARSER_REL_H__
|
||||
#define __PARSER_REL_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <drm_common_types.h>
|
||||
|
||||
#define WRITE_RO_FLAG(whoIsAble, boolValue, Indicator, RIGHTS) do{\
|
||||
whoIsAble = boolValue;\
|
||||
Indicator |= RIGHTS;\
|
||||
}while(0)
|
||||
|
||||
#define CHECK_VALIDITY(ret) do{\
|
||||
if(ret == NULL){\
|
||||
if(XML_ERROR_NO_SUCH_NODE != xml_errno)\
|
||||
return FALSE;\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
if(XML_ERROR_OK != xml_errno)\
|
||||
return FALSE;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define YMD_HMS_2_INT(year, mon, day, date, hour, min, sec, time) do{\
|
||||
date = year * 10000 + mon * 100 + day;\
|
||||
time = hour * 10000 + min * 100 + sec;\
|
||||
}while(0)
|
||||
|
||||
#define DRM_UID_LEN 256
|
||||
#define DRM_KEY_LEN 16
|
||||
|
||||
#define XML_DOM_PARSER
|
||||
|
||||
typedef struct _T_DRM_DATETIME {
|
||||
int32_t date; /**< year * 10000 + mon *100 + day */
|
||||
int32_t time; /**< hour * 10000 + min *100 + sec */
|
||||
} T_DRM_DATETIME;
|
||||
|
||||
typedef struct _T_DRM_Rights_Constraint {
|
||||
uint8_t Indicator; /**< Indicate which is constrainted, the first one indicate 0001, second one indicate 0010 */
|
||||
uint8_t unUsed[3];
|
||||
int32_t Count; /**< The times that can be used */
|
||||
T_DRM_DATETIME StartTime; /**< The starting time */
|
||||
T_DRM_DATETIME EndTime; /**< The ending time */
|
||||
T_DRM_DATETIME Interval; /**< The interval time */
|
||||
} T_DRM_Rights_Constraint;
|
||||
|
||||
typedef struct _T_DRM_Rights {
|
||||
uint8_t Version[8]; /**< Version number */
|
||||
uint8_t uid[256]; /**< record the rights object name */
|
||||
uint8_t KeyValue[16]; /**< Decode base64 */
|
||||
int32_t bIsPlayable; /**< Is playable */
|
||||
int32_t bIsDisplayable; /**< Is displayable */
|
||||
int32_t bIsExecuteable; /**< Is executeable */
|
||||
int32_t bIsPrintable; /**< Is printable */
|
||||
T_DRM_Rights_Constraint PlayConstraint; /**< Play constraint */
|
||||
T_DRM_Rights_Constraint DisplayConstraint; /**< Display constraint */
|
||||
T_DRM_Rights_Constraint ExecuteConstraint; /**< Execute constraint */
|
||||
T_DRM_Rights_Constraint PrintConstraint; /**< Print constraint */
|
||||
} T_DRM_Rights;
|
||||
|
||||
/**
|
||||
* Input year and month, return how many days that month have
|
||||
* \param year (in)Input the year
|
||||
* \param month (in)Input the month
|
||||
* \return
|
||||
* -A positive integer, which is how many days that month have
|
||||
* -When wrong input, return -1
|
||||
*/
|
||||
int32_t drm_monthDays(int32_t year, int32_t month);
|
||||
|
||||
/**
|
||||
* Check whether the date and time is valid.
|
||||
* \param year year of the date
|
||||
* \param month month of the date
|
||||
* \param day day of the date
|
||||
* \param hour hour of the time
|
||||
* \param min minute of the time
|
||||
* \param sec second of the time
|
||||
* \return
|
||||
* -when it is a valid time, return 0
|
||||
* -when it is a invalid time, return -1
|
||||
*/
|
||||
int32_t drm_checkDate(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t min, int32_t sec);
|
||||
|
||||
/**
|
||||
* Parse the rights object include xml format and wbxml format data
|
||||
*
|
||||
* \param buffer (in)Input the DRM rights object data
|
||||
* \param bufferLen (in)The buffer length
|
||||
* \param format (in)Which format, xml or wbxml
|
||||
* \param pRights (out)A structure pointer which save the rights information
|
||||
*
|
||||
* \return
|
||||
* -TRUE, when success
|
||||
* -FALSE, when failed
|
||||
*/
|
||||
int32_t drm_relParser(uint8_t* buffer, int32_t bufferLen, int32_t Format, T_DRM_Rights* pRights);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PARSER_REL_H__ */
|
||||
Reference in New Issue
Block a user