equal
deleted
inserted
replaced
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
19 @file |
19 @file |
20 */ |
20 */ |
21 |
21 |
22 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS |
22 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS |
23 |
23 |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "IPTagHeaderTraces.h" |
|
28 #endif |
|
29 |
24 #include "IPTagHeader.h" |
30 #include "IPTagHeader.h" |
25 #include "Constants.h" |
31 #include "Constants.h" |
26 |
32 |
27 /** |
33 /** |
28 Default constructor. |
34 Default constructor. |
29 */ |
35 */ |
30 CIPTagHeader::CIPTagHeader(CBttLogger* aTheLogger) |
36 CIPTagHeader::CIPTagHeader() |
31 : iTheLogger(aTheLogger) |
|
32 { |
37 { |
33 iHeaderByte.SetMax(); |
38 iHeaderByte.SetMax(); |
34 iHeaderByte.FillZ(); |
39 iHeaderByte.FillZ(); |
35 } |
40 } |
36 |
41 |
46 |
51 |
47 @param aType IP header type |
52 @param aType IP header type |
48 */ |
53 */ |
49 void CIPTagHeader::SetType(TUint16 aType) |
54 void CIPTagHeader::SetType(TUint16 aType) |
50 { |
55 { |
51 _LOG_L1C1(_L8("CIPTagHeader::SetType")); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPTAGHEADER_SETTYPE_1, "CIPTagHeader::SetType"); |
52 |
57 |
53 iHeaderByte[0] = (TUint8)(aType>>8); |
58 iHeaderByte[0] = (TUint8)(aType>>8); |
54 iHeaderByte[1] = (TUint8)(aType&0xff); |
59 iHeaderByte[1] = (TUint8)(aType&0xff); |
55 } |
60 } |
56 |
61 |
61 |
66 |
62 @param aDes the send buffer |
67 @param aDes the send buffer |
63 */ |
68 */ |
64 void CIPTagHeader::AddHeader(TDes8& aDes) |
69 void CIPTagHeader::AddHeader(TDes8& aDes) |
65 { |
70 { |
66 _LOG_L1C1(_L8("CIPTagHeader::AddHeader")); |
71 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPTAGHEADER_ADDHEADER_1, "CIPTagHeader::AddHeader"); |
67 |
72 |
68 // Add the protocol code as a header to the buffer |
73 // Add the protocol code as a header to the buffer |
69 aDes.Insert(0,iHeaderByte); |
74 aDes.Insert(0,iHeaderByte); |
70 } |
75 } |
71 |
76 |
77 @param aPdu The received data packet |
82 @param aPdu The received data packet |
78 @return The protocol header tag stripped from aPdu |
83 @return The protocol header tag stripped from aPdu |
79 */ |
84 */ |
80 TUint16 CIPTagHeader::RemoveHeader(RMBufChain& aPdu) |
85 TUint16 CIPTagHeader::RemoveHeader(RMBufChain& aPdu) |
81 { |
86 { |
82 _LOG_L1C1(_L8("CIPTagHeader::RemoveHeader")); |
87 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPTAGHEADER_REMOVEHEADER_1, "CIPTagHeader::RemoveHeader"); |
83 |
88 |
84 if (aPdu.Length() > KIPTagHeaderLength) |
89 if (aPdu.Length() > KIPTagHeaderLength) |
85 { |
90 { |
86 //Strip off the first part of the header |
91 //Strip off the first part of the header |
87 aPdu.TrimStart(1); |
92 aPdu.TrimStart(1); |