Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
bc1fa27c
Commit
bc1fa27c
authored
Aug 01, 2009
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IpV4
parent
77749cd4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
16 deletions
+68
-16
MoreIList.cs
PcapDotNet/src/PcapDotNet.Base/MoreIList.cs
+13
-0
PcapDotNet.Base.csproj
PcapDotNet/src/PcapDotNet.Base/PcapDotNet.Base.csproj
+1
-0
IpV4OptionLooseSourceRouting.cs
...c/PcapDotNet.Packets/IpV4/IpV4OptionLooseSourceRouting.cs
+5
-1
IpV4OptionRecordRoute.cs
...tNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRecordRoute.cs
+4
-1
IpV4OptionRoute.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
+13
-5
IpV4OptionStrictSourceRouting.cs
.../PcapDotNet.Packets/IpV4/IpV4OptionStrictSourceRouting.cs
+4
-1
IpV4OptionTimestampAndAddress.cs
.../PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
+11
-4
IpV4OptionTimestampOnly.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
+17
-4
No files found.
PcapDotNet/src/PcapDotNet.Base/MoreIList.cs
0 → 100644
View file @
bc1fa27c
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
namespace
PcapDotNet.Base
{
public
static
class
MoreIList
{
public
static
ReadOnlyCollection
<
T
>
AsReadOnly
<
T
>(
this
IList
<
T
>
list
)
{
return
new
ReadOnlyCollection
<
T
>(
list
);
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Base/PcapDotNet.Base.csproj
View file @
bc1fa27c
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile
Include=
"MoreIEnumerable.cs"
/>
<Compile
Include=
"MoreIEnumerable.cs"
/>
<Compile
Include=
"MoreIList.cs"
/>
<Compile
Include=
"Tuple.cs"
/>
<Compile
Include=
"Tuple.cs"
/>
<Compile
Include=
"UInt24.cs"
/>
<Compile
Include=
"UInt24.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionLooseSourceRouting.cs
View file @
bc1fa27c
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
IpV4OptionLooseSourceRouting
:
IpV4OptionRoute
public
class
IpV4OptionLooseSourceRouting
:
IpV4OptionRoute
{
{
public
IpV4OptionLooseSourceRouting
(
I
pV4Address
[]
addresses
,
byte
pointedAddressIndex
)
public
IpV4OptionLooseSourceRouting
(
I
List
<
IpV4Address
>
addresses
,
byte
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
LooseSourceRouting
,
addresses
,
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
LooseSourceRouting
,
addresses
,
pointedAddressIndex
)
{
{
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRecordRoute.cs
View file @
bc1fa27c
using
System.Collections.Generic
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
IpV4OptionRecordRoute
:
IpV4OptionRoute
public
class
IpV4OptionRecordRoute
:
IpV4OptionRoute
{
{
public
IpV4OptionRecordRoute
(
I
pV4Address
[]
addresses
,
byte
pointedAddressIndex
)
public
IpV4OptionRecordRoute
(
I
List
<
IpV4Address
>
addresses
,
byte
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
RecordRoute
,
addresses
,
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
RecordRoute
,
addresses
,
pointedAddressIndex
)
{
{
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRoute.cs
View file @
bc1fa27c
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
...
@@ -16,7 +19,7 @@ namespace PcapDotNet.Packets
...
@@ -16,7 +19,7 @@ namespace PcapDotNet.Packets
public
override
int
Length
public
override
int
Length
{
{
get
{
return
OptionMinimumLength
+
4
*
_addresses
.
Length
;
}
get
{
return
OptionMinimumLength
+
4
*
_addresses
.
Count
;
}
}
}
public
override
bool
IsAppearsAtMostOnce
public
override
bool
IsAppearsAtMostOnce
...
@@ -46,12 +49,17 @@ namespace PcapDotNet.Packets
...
@@ -46,12 +49,17 @@ namespace PcapDotNet.Packets
_addresses
.
Aggregate
(
0
,
(
value
,
address
)
=>
value
^
address
.
GetHashCode
());
_addresses
.
Aggregate
(
0
,
(
value
,
address
)
=>
value
^
address
.
GetHashCode
());
}
}
public
ReadOnlyCollection
<
IpV4Address
>
Route
{
get
{
return
_addresses
;
}
}
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
internal
override
void
Write
(
byte
[]
buffer
,
ref
int
offset
)
{
{
base
.
Write
(
buffer
,
ref
offset
);
base
.
Write
(
buffer
,
ref
offset
);
buffer
[
offset
++]
=
(
byte
)
Length
;
buffer
[
offset
++]
=
(
byte
)
Length
;
buffer
[
offset
++]
=
(
byte
)(
OptionMinimumLength
+
1
+
PointedAddressIndex
*
4
);
buffer
[
offset
++]
=
(
byte
)(
OptionMinimumLength
+
1
+
PointedAddressIndex
*
4
);
for
(
int
i
=
0
;
i
!=
_addresses
.
Length
;
++
i
)
for
(
int
i
=
0
;
i
!=
_addresses
.
Count
;
++
i
)
buffer
.
Write
(
ref
offset
,
_addresses
[
i
],
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
_addresses
[
i
],
Endianity
.
Big
);
}
}
...
@@ -81,17 +89,17 @@ namespace PcapDotNet.Packets
...
@@ -81,17 +89,17 @@ namespace PcapDotNet.Packets
return
true
;
return
true
;
}
}
protected
IpV4OptionRoute
(
IpV4OptionType
optionType
,
I
pV4Address
[]
addresses
,
byte
pointedAddressIndex
)
protected
IpV4OptionRoute
(
IpV4OptionType
optionType
,
I
List
<
IpV4Address
>
addresses
,
byte
pointedAddressIndex
)
:
base
(
optionType
)
:
base
(
optionType
)
{
{
if
(
pointedAddressIndex
>
PointedAddressIndexMaxValue
)
if
(
pointedAddressIndex
>
PointedAddressIndexMaxValue
)
throw
new
ArgumentOutOfRangeException
(
"pointedAddressIndex"
,
pointedAddressIndex
,
"Maximum value is "
+
PointedAddressIndexMaxValue
);
throw
new
ArgumentOutOfRangeException
(
"pointedAddressIndex"
,
pointedAddressIndex
,
"Maximum value is "
+
PointedAddressIndexMaxValue
);
_addresses
=
addresses
;
_addresses
=
addresses
.
AsReadOnly
()
;
_pointedAddressIndex
=
pointedAddressIndex
;
_pointedAddressIndex
=
pointedAddressIndex
;
}
}
private
readonly
IpV4Address
[]
_addresses
;
private
readonly
ReadOnlyCollection
<
IpV4Address
>
_addresses
;
private
readonly
byte
_pointedAddressIndex
;
private
readonly
byte
_pointedAddressIndex
;
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionStrictSourceRouting.cs
View file @
bc1fa27c
using
System.Collections.Generic
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
IpV4OptionStrictSourceRouting
:
IpV4OptionRoute
public
class
IpV4OptionStrictSourceRouting
:
IpV4OptionRoute
{
{
public
IpV4OptionStrictSourceRouting
(
I
pV4Address
[]
addresses
,
byte
pointedAddressIndex
)
public
IpV4OptionStrictSourceRouting
(
I
List
<
IpV4Address
>
addresses
,
byte
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
StrictSourceRouting
,
addresses
,
pointedAddressIndex
)
:
base
(
IpV4OptionType
.
StrictSourceRouting
,
addresses
,
pointedAddressIndex
)
{
{
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampAndAddress.cs
View file @
bc1fa27c
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
IpV4OptionTimestampAndAddress
:
IpV4OptionTimestamp
public
class
IpV4OptionTimestampAndAddress
:
IpV4OptionTimestamp
{
{
public
IpV4OptionTimestampAndAddress
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
KeyValuePair
<
IpV4Address
,
uint
>[]
addressesAndTimestamps
)
public
IpV4OptionTimestampAndAddress
(
IpV4OptionTimestampType
timestampType
,
byte
overflow
,
byte
pointedIndex
,
IList
<
KeyValuePair
<
IpV4Address
,
uint
>>
addressesAndTimestamps
)
:
base
(
timestampType
,
overflow
,
pointedIndex
)
:
base
(
timestampType
,
overflow
,
pointedIndex
)
{
{
if
(
timestampType
!=
IpV4OptionTimestampType
.
AddressAndTimestamp
&&
if
(
timestampType
!=
IpV4OptionTimestampType
.
AddressAndTimestamp
&&
...
@@ -15,7 +17,12 @@ namespace PcapDotNet.Packets
...
@@ -15,7 +17,12 @@ namespace PcapDotNet.Packets
throw
new
ArgumentException
(
"Illegal timestamp type "
+
timestampType
,
"timestampType"
);
throw
new
ArgumentException
(
"Illegal timestamp type "
+
timestampType
,
"timestampType"
);
}
}
_addressesAndTimestamps
=
addressesAndTimestamps
;
_addressesAndTimestamps
=
addressesAndTimestamps
.
AsReadOnly
();
}
public
ReadOnlyCollection
<
KeyValuePair
<
IpV4Address
,
uint
>>
TimedRoute
{
get
{
return
_addressesAndTimestamps
;
}
}
}
public
override
int
GetHashCode
()
public
override
int
GetHashCode
()
...
@@ -43,7 +50,7 @@ namespace PcapDotNet.Packets
...
@@ -43,7 +50,7 @@ namespace PcapDotNet.Packets
protected
override
int
ValuesLength
protected
override
int
ValuesLength
{
{
get
{
return
_addressesAndTimestamps
.
Length
*
2
*
4
;
}
get
{
return
_addressesAndTimestamps
.
Count
*
2
*
4
;
}
}
}
protected
override
bool
EqualValues
(
IpV4OptionTimestamp
other
)
protected
override
bool
EqualValues
(
IpV4OptionTimestamp
other
)
...
@@ -60,6 +67,6 @@ namespace PcapDotNet.Packets
...
@@ -60,6 +67,6 @@ namespace PcapDotNet.Packets
}
}
}
}
private
readonly
KeyValuePair
<
IpV4Address
,
uint
>[]
_addressesAndTimestamps
;
private
readonly
ReadOnlyCollection
<
KeyValuePair
<
IpV4Address
,
uint
>>
_addressesAndTimestamps
;
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
View file @
bc1fa27c
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
public
class
IpV4OptionTimestampOnly
:
IpV4OptionTimestamp
public
class
IpV4OptionTimestampOnly
:
IpV4OptionTimestamp
{
{
public
IpV4OptionTimestampOnly
(
byte
overflow
,
byte
pointedIndex
,
params
uint
[]
timestamps
)
public
IpV4OptionTimestampOnly
(
byte
overflow
,
byte
pointedIndex
,
IList
<
uint
>
timestamps
)
:
base
(
IpV4OptionTimestampType
.
TimestampOnly
,
overflow
,
pointedIndex
)
:
base
(
IpV4OptionTimestampType
.
TimestampOnly
,
overflow
,
pointedIndex
)
{
{
_timestamps
=
timestamps
;
_timestamps
=
timestamps
.
AsReadOnly
();
}
public
IpV4OptionTimestampOnly
(
byte
overflow
,
byte
pointedIndex
,
params
uint
[]
timestamps
)
:
this
(
overflow
,
pointedIndex
,
(
IList
<
uint
>)
timestamps
)
{
}
public
ReadOnlyCollection
<
uint
>
Timestamps
{
get
{
return
_timestamps
;
}
}
}
public
override
int
GetHashCode
()
public
override
int
GetHashCode
()
...
@@ -28,7 +41,7 @@ namespace PcapDotNet.Packets
...
@@ -28,7 +41,7 @@ namespace PcapDotNet.Packets
protected
override
int
ValuesLength
protected
override
int
ValuesLength
{
{
get
{
return
_timestamps
.
Length
*
4
;
}
get
{
return
_timestamps
.
Count
*
4
;
}
}
}
protected
override
bool
EqualValues
(
IpV4OptionTimestamp
other
)
protected
override
bool
EqualValues
(
IpV4OptionTimestamp
other
)
...
@@ -42,6 +55,6 @@ namespace PcapDotNet.Packets
...
@@ -42,6 +55,6 @@ namespace PcapDotNet.Packets
buffer
.
Write
(
ref
offset
,
timestamp
,
Endianity
.
Big
);
buffer
.
Write
(
ref
offset
,
timestamp
,
Endianity
.
Big
);
}
}
private
readonly
uint
[]
_timestamps
;
private
readonly
ReadOnlyCollection
<
uint
>
_timestamps
;
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment