omadrm/drmengine/utils/inc/MultipartHandler.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MULTIPARTHANDLER_H
       
    21 #define MULTIPARTHANDLER_H
       
    22 
       
    23 // CLASS DECLARATION
       
    24 
       
    25 /**
       
    26 *  TMultipartHandler: parses MIME multipart data
       
    27 *
       
    28 *  @lib    -
       
    29 *  @since  3.0
       
    30 */
       
    31 class TMultipartHandler
       
    32     {
       
    33 public:
       
    34     static const TInt KMaxBoundaryLength = 80;
       
    35 
       
    36     enum TState
       
    37         {
       
    38         EPreamble,
       
    39         EBodyPartHeaders,
       
    40         EBodyPart,
       
    41         EEpilog
       
    42         };
       
    43 
       
    44     TMultipartHandler();
       
    45     
       
    46     void WriteL(
       
    47         const TDesC8& aData);
       
    48         
       
    49     virtual void HandleBodyHeaderDataL(
       
    50         const TDesC8& aData);
       
    51 
       
    52     virtual void HandleBodyDataL(
       
    53         const TDesC8& aData);
       
    54 
       
    55     virtual void StartBodyPartHeadersL();
       
    56     
       
    57     virtual void EndBodyPartHeadersL();
       
    58     
       
    59     virtual void StartBodyPartL();
       
    60     
       
    61     virtual void EndBodyPartL();
       
    62 
       
    63 protected:
       
    64 
       
    65     void HandlePreambleL(
       
    66         const TDesC8& aData);
       
    67 
       
    68     void HandleBodyPartHeadersL(
       
    69         const TDesC8& aData);
       
    70 
       
    71     void HandleBodyPartL(
       
    72         const TDesC8& aData);
       
    73 
       
    74     TBool FindDelimiter(
       
    75         const TDesC8& aBuffer,
       
    76         TInt& aStart,
       
    77         TInt& aEnd);
       
    78         
       
    79     TBool FindHeaderEnd(
       
    80         const TDesC8& aBuffer,
       
    81         TInt& aStart,
       
    82         TInt& aEnd);
       
    83         
       
    84     TBool FindDashBoundary(
       
    85         const TDesC8& aBuffer, 
       
    86         TInt& aStart, 
       
    87         TInt& aEnd);
       
    88         
       
    89 protected:
       
    90     
       
    91     TBuf8<KMaxBoundaryLength> iDelimiter;
       
    92     TBuf8<KMaxBoundaryLength> iBuffer;
       
    93     TState iState;
       
    94     
       
    95     };
       
    96     
       
    97 #endif      // MULTIPARTHANDLER_H
       
    98             
       
    99 // End of File