LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Adrian Sai-wah Tam | 3 * Copyright (c) 2011 Adrian Sai-wah Tam |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> | 18 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> |
19 */ | 19 */ |
20 | 20 |
21 #include "tcp-option.h" | 21 #include "tcp-option.h" |
22 #include "tcp-option-rfc793.h" | 22 #include "tcp-option-rfc793.h" |
| 23 #include "tcp-option-winscale.h" |
| 24 #include "tcp-option-ts.h" |
23 | 25 |
24 #include "ns3/type-id.h" | 26 #include "ns3/type-id.h" |
25 | 27 |
26 #include <vector> | 28 #include <vector> |
27 | 29 |
28 namespace ns3 { | 30 namespace ns3 { |
29 | 31 |
30 NS_OBJECT_ENSURE_REGISTERED (TcpOption); | 32 NS_OBJECT_ENSURE_REGISTERED (TcpOption); |
31 | 33 |
32 | 34 |
(...skipping 27 matching lines...) Expand all Loading... |
60 { | 62 { |
61 TcpOption::Kind kind; | 63 TcpOption::Kind kind; |
62 TypeId tid; | 64 TypeId tid; |
63 }; | 65 }; |
64 | 66 |
65 static ObjectFactory objectFactory; | 67 static ObjectFactory objectFactory; |
66 static kindToTid toTid[] = | 68 static kindToTid toTid[] = |
67 { | 69 { |
68 { TcpOption::END, TcpOptionEnd::GetTypeId () }, | 70 { TcpOption::END, TcpOptionEnd::GetTypeId () }, |
69 { TcpOption::MSS, TcpOptionMSS::GetTypeId () }, | 71 { TcpOption::MSS, TcpOptionMSS::GetTypeId () }, |
70 { TcpOption::NOP, TcpOptionNOP::GetTypeId () } | 72 { TcpOption::NOP, TcpOptionNOP::GetTypeId () }, |
| 73 { TcpOption::TS, TcpOptionTS::GetTypeId () }, |
| 74 { TcpOption::WINSCALE, TcpOptionWinScale::GetTypeId () } |
71 }; | 75 }; |
72 | 76 |
73 for (unsigned int i=0; i < sizeof(toTid)/sizeof(kindToTid); ++i) | 77 for (unsigned int i=0; i < sizeof(toTid)/sizeof(kindToTid); ++i) |
74 { | 78 { |
75 if (toTid[i].kind == kind) | 79 if (toTid[i].kind == kind) |
76 { | 80 { |
77 objectFactory.SetTypeId(toTid[i].tid); | 81 objectFactory.SetTypeId(toTid[i].tid); |
78 return objectFactory.Create<TcpOption> (); | 82 return objectFactory.Create<TcpOption> (); |
79 } | 83 } |
80 } | 84 } |
81 | 85 |
82 return CreateObject<TcpOptionUnknown> (); | 86 return CreateObject<TcpOptionUnknown> (); |
83 } | 87 } |
84 | 88 |
85 bool | 89 bool |
86 TcpOption::IsKindKnown (uint8_t kind) | 90 TcpOption::IsKindKnown (uint8_t kind) |
87 { | 91 { |
88 switch (kind) | 92 switch (kind) |
89 { | 93 { |
90 case END: | 94 case END: |
91 case NOP: | 95 case NOP: |
92 case MSS: | 96 case MSS: |
| 97 case WINSCALE: |
| 98 case TS: |
93 return true; | 99 return true; |
94 } | 100 } |
95 | 101 |
96 return false; | 102 return false; |
97 } | 103 } |
98 | 104 |
99 } // namespace ns3 | 105 } // namespace ns3 |
LEFT | RIGHT |