source: svn/newcon3bcm2_21bu/nexus/lib/dtcp_ip/include/b_dtcp_stream.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 11.3 KB
Line 
1/********************************************************************************************
2*     (c)2004-2011 Broadcom Corporation                                                     *
3*                                                                                           *
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,   *
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and      *
6*  conditions of a separate, written license agreement executed between you and Broadcom    *
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants*
8*  no license (express or implied), right to use, or waiver of any kind with respect to the *
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all      *
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU       *
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY                    *
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.                                 *
13*
14*  Except as expressly set forth in the Authorized License,                                 *
15*
16*  1.     This program, including its structure, sequence and organization, constitutes     *
17*  the valuable trade secrets of Broadcom, and you shall use all reasonable efforts to      *
18*  protect the confidentiality thereof,and to use this information only in connection       *
19*  with your use of Broadcom integrated circuit products.                                   *
20*                                                                                           *
21*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"          *
22*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR                   *
23*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO            *
24*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES            *
25*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,            *
26*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION             *
27*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF              *
28*  USE OR PERFORMANCE OF THE SOFTWARE.                                                      *
29*                                                                                           *
30*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS         *
31*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR             *
32*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR               *
33*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF             *
34*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT              *
35*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE            *
36*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF              *
37*  ANY LIMITED REMEDY.
38 *
39 * $brcm_Workfile: b_dtcp_stream.h $
40 * $brcm_Revision: 11 $
41 * $brcm_Date: 5/5/11 3:03p $
42 *
43 * Module Description:
44 * DTCP-IP streamer component
45 * Revision History:
46 *
47 * $brcm_Log: /nexus/lib/dtcp_ip/include/b_dtcp_stream.h $
48 *
49 * 11   5/5/11 3:03p leisun
50 * SWSECURITY-49: Update Nonce value change period, other device modes
51 *  support
52 *
53 * 10   2/11/11 5:37p leisun
54 * SWSECURITY-32: Updated lib to V1SE1.3 conformance.
55 *
56 * 9   3/1/10 2:27p leisun
57 * SW7420-561: Update from plugfest bugs
58 *
59 * 8   12/11/09 3:55p ssood
60 * SW7420-502: Add option to allow apps to indicate to DTCP/IP library to
61 *  generate PCP for every encrypted data blob
62 *
63 * 7   10/6/09 1:41p leisun
64 * SW7405-3138: Fixes for live HTTP streaming
65 *
66 * 6   7/16/09 7:04p lwhite
67 * PR55693: Fixed signedness
68 *
69 * 5   7/13/09 11:23a leisun
70 * PR 55693: Re-design interfaces, and other cleanups
71 *
72 * 4   7/1/09 4:31p leisun
73 * PR 55693: added GetNewExchKey function, fixed linked list deletion
74 *  problem, etc
75 *
76 * 3   7/1/09 10:48a leisun
77 * PR 55693: fix compile error for playback_ip
78 *
79 * 2   6/30/09 10:37p leisun
80 * PR 55693: Added exchange key expiration timer
81 *
82 * 1   6/5/09 4:06p leisun
83 * PR 55693: checking in DTCP-IP lib
84 *********************************************************************************************/
85/*! \file b_dtcp_stream.h
86 *  \brief define DTCP content management/streaming interface.
87 */
88#ifndef B_DTCP_STREAM_H
89#define B_DTCP_STREAM_H   
90
91#include "b_dtcp_constants.h"
92#ifdef __cplusplus
93extern "C"
94{
95#endif
96
97#define DTCP_AES_IV_BOUNDARY    96000
98/*
99 * Internal private data structure
100 */
101typedef struct __b_dtcp_stream_data
102{
103        BLST_S_ENTRY(__b_dtcp_stream_data) node;
104        B_StreamType_T StreamType;              /* Stream type, source/sink */
105        B_StreamTransport_T Transport;  /* Transport type, Rtp/Http/Udp */
106        int Emi;                                                /* Extended EMI. */
107        int cci;                                                /* Embedded CCI of the content */
108        /* Variables for PCP_UR handling */
109        int ur_mode;
110        int content_type;
111        int aps;
112        int ict;
113        int ast;
114        unsigned char HttpNonce[DTCP_CONTENT_KEY_NONCE_SIZE];
115        int content_length;                             /* Total length for this stream, what about RTP, total length unknown */
116        int content_remain;                             /* Remainning content length to be processed, source only */
117        int content_processed;                  /* Size of clear content that has been processed */
118        int packet_content_length;              /* PCP byte length, upto 128MB */
119        int packet_content_remain;              /* Total content remain.*/
120        int packet_bytes_remain;                /* bytes remain for this PCP */
121        int packet_padding_bytes;
122        int max_packet_size;
123    bool use_per_packet_pcp;            /* if max_packet_size is == 0, then PCP is prepended to each encrypted block */
124        void * hPacketHandle;                   /* Packet handle, obtained from ConsumePacketHeader or CreatePacketHeader function.*/
125        void * AkeHandle;                               /* Associated AKE session for this stream */
126}B_DTCP_StreamData_T;
127
128struct __b_dtcp_descriptor_private_data
129{
130#if BSTD_CPU_ENDIAN == BSTD_ENDIAN_BIG
131        unsigned int Descriptor_id:                     1;
132        unsigned int Retention_Move_mode:       1;
133        unsigned int Retention_State:           3;
134        unsigned int EPN:               1;
135        unsigned int DTCP_CCI:  2;
136        unsigned int Reserved:  5;
137        unsigned int Image_Constraint_Token:    1;
138        unsigned int APS:       2;
139#else
140        unsigned int DTCP_CCI:  2;
141        unsigned int EPN:               1;
142        unsigned int Retention_State:   3;
143        unsigned int Retention_Move_mode:       1;
144        unsigned int Descriptor_id:                     1;
145        unsigned int APS:       2;
146        unsigned int Image_Constraint_Token:    1;
147        unsigned int Reserved:  5;
148#endif
149};
150struct __b_dtcp_audio_descriptor_private_data
151{
152#if BSTD_CPU_ENDIAN == BSTD_ENDIAN_BIG
153        unsigned int Descriptor_id:     1;
154        unsigned int Reserved1:         5;
155        unsigned int DTCP_CCI_Audio:    2;
156        unsigned int Audio_Type:        3;
157        unsigned int Reserved2:         5;
158#else
159        unsigned int DTCP_CCI_Audio:    2;
160        unsigned int Reserved1:         5;
161        unsigned int Descriptor_id:     1;
162        unsigned int Reserved2:         5;
163        unsigned int Audio_Type:        3;
164#endif
165};
166struct __b_dtcp_descriptor
167{
168        unsigned char descriptor_tag;
169        unsigned char descriptor_length;
170        unsigned short CA_System_ID;
171        unsigned char private_data[2];
172};
173typedef struct __b_dtcp_stream_data * B_StreamHandle_T;
174/*! \brief function pointer to a function to open a source stream, after AKE.
175 *  \param[in] akeHandle handle to AKE session.
176 *  \param[in] Transport the stream's transport type.
177 *  \param[in] content_length length of the content to be transmited.
178 *  \param[in] emi emi value of this stream.
179 *  \param[in] max_packet_size maximum packet size (pcp length).
180 */
181B_StreamHandle_T B_DTCP_IP_OpenSourceStream(B_AkeHandle_T akeHandle, B_StreamTransport_T Transport,
182                int content_length, int cci, int content_type, int max_packet_size);
183
184/*! \brief exported function to set the stream attribute, when PCP_UR is used.
185 *  only set these attribute for source stream.
186 *  param[in] stream source stream handle.
187 *  param[in] content_has_cci, a flag indicate the content has embedded CCI.
188 *  param[in] content_type type of the content,e.g. AudioVisual, type1Audio, etc.
189 *  param[in] aps Analog copy protection information obtained from embedded CCI.
190 *  param[in] ict Image_Constraint_Token obtained from CCI.
191 *  param[in] ast Analog_sunset_token obtained from CCI.
192 */
193void B_DTCP_IP_SetSourceStreamAttribute(B_StreamHandle_T stream, bool content_has_cci, 
194                int content_type, int aps, int ict, int ast);
195/*! \brief set the stream's emi value, if caller wish to override the emi value
196 *  obtained from calling GetEmiFromCCI() function.
197 *  \param[in] stream stream handle.
198 *  \param[in] emi emi value to set.
199 */
200void B_DTCP_IP_SetSourceStreamEmi(B_StreamHandle_T stream, int emi);
201int B_DTCP_IP_GetSinkStreamEmi(B_StreamHandle_T  stream);
202/*! \brief exported function to check the sink stream's attribute, to determine
203 * if processing (decryption) is allowed.
204 * param[in] akeHandle AKE session handle.
205 * param[in] stream stream handle.
206 * param[in/out] content_type stream content type.
207 * param[in/out] aps analog copy right information.
208 * param[in/out] ict image constraint token.
209 * param[in/out] ast analog sunset token.
210 */
211BERR_Code B_DTCP_IP_GetSinkStreamAttribute(B_AkeHandle_T akeHandle, B_StreamHandle_T stream, 
212                int *content_type, int *aps, int *ict, int *ast);
213
214BERR_Code B_DTCP_IP_GetDescriptor(B_StreamHandle_T stream, unsigned char *buf, int length);
215
216/*! \brief function to open a sink stream, after AKE.
217 *  \param[in] akeHandle handle to AKE session.
218 *  \param[in] Transport the stream's transport type.
219 */
220B_StreamHandle_T B_DTCP_IP_OpenSinkStream(B_AkeHandle_T akeHandle, B_StreamTransport_T Transport);
221
222/*! \brief close a stream.
223 *  \param[in] hStreamHandle handle to the open stream.
224 */
225void B_DTCP_IP_CloseStream(B_StreamHandle_T hStreamHandle);
226
227/*! \brief packetize data, produce PCP stream, called by source device only.
228 *  \param[in] hAkeHandle handle to AKE session.
229 *  \param[in] clear_buf buffer hold the input data.
230 *  \param[in] clear_buf_size size of the input buffer.
231 *  \param[in,out] encrypted_buf buffer for output data.
232 *  \param[in] encrypted_buf_size size of output buffer.
233 *  \param[out] total total bytes processed.
234 */
235BERR_Code B_DTCP_IP_PacketizeData(B_AkeHandle_T hAkeHandle, B_StreamHandle_T hStreamHandle, 
236                unsigned char * clear_buf, unsigned int clear_buf_size, unsigned char ** encrypted_buf, 
237                unsigned int * encrypted_buf_size, unsigned int * total);
238
239/*! \brief Depacketize DTCP PCP data received from source device.
240 *  param[in] Akehandle AkeSession handle obtained from AKE procedure.
241 *  param[in] encrypted_buf buffer holding the encrypted data.
242 *  param[in] encrypted_buf_size size of the encrypted buffer.
243 *  param[in] clear_buf buffer to hold the decrypted data.
244 *  param[out] clear_buf_size size of decrypted bytes.
245 *  param[out] total total length processed.
246 */
247BERR_Code B_DTCP_IP_DepacketizeData(B_AkeHandle_T hAkeHandle, B_StreamHandle_T hStreamHandle, 
248                unsigned char * encrypted_buf, unsigned int encrypted_buf_size, unsigned char * clear_buf, unsigned int * clear_buf_size, 
249                unsigned int * total, bool * pcp_header_found);
250
251/*! \brief force to close packet handle, called by source device's exchange key timer expire function.
252 *  \param[in] hStreamHandle sream handle.
253 *  \retval none.
254 */
255void B_DTCP_Stream_ClosePacketHandle(struct __b_dtcp_stream_data * StreamData);
256
257#ifdef __cplusplus
258}
259#endif
260#endif /* B_DTCP_STREAM_H */
Note: See TracBrowser for help on using the repository browser.