|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Obsolete TCP/IP header file |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file in_tcp.inl |
|
20 @internalComponent |
|
21 @deprecated This file originates from an obsolete implementation of the TCP/IP stack |
|
22 */ |
|
23 |
|
24 #ifndef __IN_TCP_INL__ |
|
25 #define __IN_TCP_INL__ |
|
26 |
|
27 #include <networking/in_ip.h> |
|
28 |
|
29 inline ThdrTCP* ThdrTCP::Ptr(RMBufPacketBase& aPacket) |
|
30 { return (ThdrTCP*)aPacket.First()->Ptr(); } |
|
31 |
|
32 inline ThdrTCP* ThdrTCP::Ptr(ThdrIP* aHdr) |
|
33 { return (ThdrTCP*)aHdr->EndPtr(); } |
|
34 |
|
35 inline ThdrTCP* ThdrTCP::NetPtr(ThdrIP* aHdr) |
|
36 { return (ThdrTCP*)aHdr->NetEndPtr(); } |
|
37 |
|
38 inline TUint ThdrTCP::NetGetSrcPort() |
|
39 { return ByteOrder::Swap16(u.iData16[0]); } |
|
40 inline TUint ThdrTCP::NetGetDstPort() |
|
41 { return ByteOrder::Swap16(u.iData16[1]); } |
|
42 |
|
43 inline TUint ThdrTCP::GetSrcPort() |
|
44 { return u.iData16[1]; } |
|
45 inline void ThdrTCP::SetSrcPort(TUint aPort) |
|
46 { u.iData16[1] = (TUint16)aPort; } |
|
47 |
|
48 inline TUint ThdrTCP::GetDstPort() |
|
49 { return u.iData16[0]; } |
|
50 inline void ThdrTCP::SetDstPort(TUint aPort) |
|
51 { u.iData16[0] = (TUint16)aPort; } |
|
52 |
|
53 inline TUint ThdrTCP::GetChecksum() |
|
54 { return u.iData16[9]; } |
|
55 inline void ThdrTCP::SetChecksum(TUint aSum) |
|
56 { u.iData16[9] = (TUint16)aSum; } |
|
57 inline TUint ThdrTCP::NetGetChecksum() |
|
58 { return u.iData16[8]; } |
|
59 inline void ThdrTCP::NetSetChecksum(TUint aSum) |
|
60 { u.iData16[8] = (TUint16)aSum; } |
|
61 |
|
62 inline TUint ThdrTCP::GetSeqNum() |
|
63 { return u.iData32[1]; } |
|
64 inline void ThdrTCP::SetSeqNum(TUint aVal) |
|
65 { u.iData32[1] = aVal; } |
|
66 inline TUint ThdrTCP::GetAckNum() |
|
67 { return u.iData32[2]; } |
|
68 inline void ThdrTCP::SetAckNum(TUint aVal) |
|
69 { u.iData32[2] = aVal; } |
|
70 |
|
71 //#ifdef VJCOMP |
|
72 /* |
|
73 * Take parameters in Little Endian form |
|
74 */ |
|
75 inline TUint ThdrTCP::NetGetSeqNum() |
|
76 { return BigEndian::Get32((const TUint8*)&u.iData32[1]); } |
|
77 inline void ThdrTCP::NetSetSeqNum(TUint aVal) |
|
78 { BigEndian::Put32((TUint8 *)&u.iData32[1], aVal); } |
|
79 inline TUint ThdrTCP::NetGetAckNum() |
|
80 { return BigEndian::Get32((const TUint8*)&u.iData32[2]); } |
|
81 inline void ThdrTCP::NetSetAckNum(TUint aVal) |
|
82 { BigEndian::Put32((TUint8 *)&u.iData32[2], aVal); } |
|
83 inline void ThdrTCP::NetSetUrgPtr(TUint aVal) |
|
84 { BigEndian::Put16((TUint8 *)&u.iData16[9], (TUint16)aVal); } |
|
85 inline TUint16 ThdrTCP::NetGetUrgPtr() |
|
86 { return BigEndian::Get16((TUint8 *)&u.iData16[9]);} |
|
87 inline TUint16 ThdrTCP::NetGetWindow() |
|
88 { return BigEndian::Get16((TUint8 *)&u.iData16[7]);} |
|
89 inline void ThdrTCP::NetSetWindow(TUint16 aVal) |
|
90 { BigEndian::Put16((TUint8 *)&u.iData16[7], aVal); } |
|
91 inline void ThdrTCP::VJSetChecksum(TUint aVal) |
|
92 { BigEndian::Put16((TUint8 *)&u.iData16[8], (TUint16)aVal); } |
|
93 inline TUint ThdrTCP::VJGetFlags() |
|
94 { return u.iData8[13]; } |
|
95 inline void ThdrTCP::VJSetFlags(TUint aVal) |
|
96 { u.iData8[13] = (TUint8)aVal; } |
|
97 inline TUint ThdrTCP::VJGetReserved() |
|
98 { return u.iData8[12] & 0xf; } |
|
99 //#endif |
|
100 |
|
101 |
|
102 inline TUint ThdrTCP::GetUrgPtr() |
|
103 { return u.iData16[8]; } |
|
104 inline void ThdrTCP::SetUrgPtr(TUint aVal) |
|
105 { u.iData16[8] = (TUint16)aVal; } |
|
106 inline TUint ThdrTCP::GetWindow() |
|
107 { return u.iData16[6]; } |
|
108 inline void ThdrTCP::SetWindow(TUint aVal) |
|
109 { u.iData16[6] = (TUint16)aVal; } |
|
110 inline TUint ThdrTCP::GetHdrLen() |
|
111 { return ((u.iData8[15]&0xf0)>>4)<<2; } |
|
112 inline void ThdrTCP::SetHdrLen(TUint aVal) // Safe because other bits should be 0 |
|
113 { u.iData8[15] = (TUint8)((aVal>>2)<<4); } |
|
114 inline TUint ThdrTCP::NetGetHdrLen() |
|
115 { return ((u.iData8[12]&0xf0)>>4)<<2; } |
|
116 inline TUint ThdrTCP::GetFlags() |
|
117 { return u.iData8[14]; } |
|
118 inline void ThdrTCP::SetFlags(TUint aVal) |
|
119 { u.iData8[14] = (TUint8)aVal; } |
|
120 |
|
121 #endif |
|
122 |