|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CPPPFRAME_H__ |
|
21 #define __CPPPFRAME_H__ |
|
22 |
|
23 /******************************************************************************* |
|
24 * |
|
25 * Definitions |
|
26 * |
|
27 ******************************************************************************/ |
|
28 #define MAXFRAMESIZE (1024*4) |
|
29 #define MAXFRAMENAME (128) |
|
30 |
|
31 /******************************************************************************* |
|
32 * |
|
33 * Types |
|
34 * |
|
35 ******************************************************************************/ |
|
36 typedef enum { |
|
37 FS_EMPTY, |
|
38 FS_IN_PROGRESS, |
|
39 FS_COMPLETE |
|
40 } TFrameStatus; |
|
41 |
|
42 typedef enum { |
|
43 FE_NONE, |
|
44 FE_OVERFLOW |
|
45 } TFrameError; |
|
46 |
|
47 /******************************************************************************* |
|
48 * |
|
49 * class CPppFrame |
|
50 * |
|
51 ******************************************************************************/ |
|
52 class CPppFrame |
|
53 { |
|
54 public: |
|
55 CPppFrame( char *aFrameName, int aRemoveHDLCFraming = 0 ); |
|
56 ~CPppFrame(); |
|
57 |
|
58 TFrameError AddByteToFrame( char c ); |
|
59 TFrameError ClearFrame(); |
|
60 TFrameError ClearFrameMemoryButNotState(); |
|
61 |
|
62 TFrameStatus GetFrameStatus(); |
|
63 int GetOverflowCount(); |
|
64 char *GetFrameBuffer( int *aLen ); |
|
65 char *GetFrameName(); |
|
66 |
|
67 private: |
|
68 char iFrameName[MAXFRAMENAME]; |
|
69 int iRemoveHDLCFraming; |
|
70 |
|
71 int iEscapedChar; |
|
72 |
|
73 char iFrameBuffer[MAXFRAMESIZE]; |
|
74 int iCurrentFrameSize; |
|
75 int iOverflowByteCount; |
|
76 int iCurrentBufferSize; |
|
77 TFrameStatus iFrameBufferStatus; |
|
78 }; |
|
79 |
|
80 #endif //__CPPPFRAME_H__ |