Commit 53944050 authored by Brickner_cp's avatar Brickner_cp

--no commit message

--no commit message
parent 343a0136
#pragma once #pragma once
#include "PcapAddress.h" #include "IpV4socketAddress.h"
#include "PcapDeclarations.h" #include "PcapDeclarations.h"
namespace PcapDotNet namespace PcapDotNet
......
#include "IpV4SocketAddress.h"
#include "Pcap.h"
using namespace System;
using namespace System::Text;
using namespace PcapDotNet;
IpV4SocketAddress::IpV4SocketAddress(sockaddr *address)
: SocketAddress(address->sa_family)
{
sockaddr_in* ipV4Address = (struct sockaddr_in *)address;
_address = ipV4Address->sin_addr.S_un.S_addr;
}
unsigned int IpV4SocketAddress::Address::get()
{
return _address;
}
String^ IpV4SocketAddress::AddressString::get()
{
StringBuilder^ result = gcnew StringBuilder();
unsigned int address = Address;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
return result->ToString();
}
String^ IpV4SocketAddress::ToString()
{
StringBuilder^ result = gcnew StringBuilder();
result->Append(SocketAddress::ToString());
result->Append(" ");
result->Append(AddressString);
return result->ToString();
}
#pragma once
#include "SocketAddress.h"
#include "PcapDeclarations.h"
namespace PcapDotNet
{
public ref class IpV4SocketAddress : SocketAddress
{
public:
IpV4SocketAddress(sockaddr *address);
property unsigned int Address
{
unsigned int get();
}
property System::String^ AddressString
{
System::String^ get();
}
virtual System::String^ ToString() override;
private:
unsigned int _address;
};
}
\ No newline at end of file
#include "PcapAddress.h" #include "PcapAddress.h"
#include "IpV4SocketAddress.h"
#include "Pcap.h" #include "Pcap.h"
using namespace System; using namespace System;
using namespace System::Text; using namespace System::Text;
using namespace PcapDotNet; using namespace PcapDotNet;
SocketAddress::SocketAddress(unsigned short family)
{
_family = safe_cast<SocketAddressFamily>(family);
}
SocketAddressFamily^ SocketAddress::Family::get()
{
return _family;
}
String^ SocketAddress::ToString()
{
return Family->ToString();
}
IpV4SocketAddress::IpV4SocketAddress(sockaddr *address)
: SocketAddress(address->sa_family)
{
sockaddr_in* ipV4Address = (struct sockaddr_in *)address;
_address = ipV4Address->sin_addr.S_un.S_addr;
}
unsigned int IpV4SocketAddress::Address::get()
{
return _address;
}
String^ IpV4SocketAddress::AddressString::get()
{
StringBuilder^ result = gcnew StringBuilder();
unsigned int address = Address;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
result->Append(".");
address /= 256;
result->Append(address % 256);
return result->ToString();
}
String^ IpV4SocketAddress::ToString()
{
StringBuilder^ result = gcnew StringBuilder();
result->Append(SocketAddress::ToString());
result->Append(" ");
result->Append(AddressString);
return result->ToString();
}
PcapAddress::PcapAddress(pcap_addr_t* pcapAddress) PcapAddress::PcapAddress(pcap_addr_t* pcapAddress)
{ {
SocketAddressFamily family = safe_cast<SocketAddressFamily>(pcapAddress->addr->sa_family); SocketAddressFamily family = safe_cast<SocketAddressFamily>(pcapAddress->addr->sa_family);
......
#pragma once #pragma once
#include "SocketAddress.h"
#include "PcapDeclarations.h" #include "PcapDeclarations.h"
namespace PcapDotNet namespace PcapDotNet
{ {
public enum class SocketAddressFamily : System::UInt16
{
UNSPEC = 0, // unspecified
UNIX = 1, // local to host (pipes, portals)
INET = 2, // internetwork: UDP, TCP, etc.
IMPLINK = 3, // arpanet imp addresses
PUP = 4, // pup protocols: e.g. BSP
CHAOS = 5, // mit CHAOS protocols
NS = 6, // XEROX NS protocols
IPX = NS, // IPX protocols: IPX, SPX, etc.
ISO = 7, // ISO protocols
OSI = ISO, // OSI is ISO
ECMA = 8, // european computer manufacturers
DATAKIT = 9, // datakit protocols
CCITT = 10, // CCITT protocols, X.25 etc
SNA = 11, // IBM SNA
DECnet = 12, // DECnet
DLI = 13, // Direct data link interface
LAT = 14, // LAT
HYLINK = 15, // NSC Hyperchannel
APPLETALK = 16, // AppleTalk
NETBIOS = 17, // NetBios-style addresses
VOICEVIEW = 18, // VoiceView
FIREFOX = 19, // Protocols from Firefox
UNKNOWN1 = 20, // Somebody is using this!
BAN = 21, // Banyan
ATM = 22, // Native ATM Services
INET6 = 23, // Internetwork Version 6
CLUSTER = 24, // Microsoft Wolfpack
IEEE12844 = 25, // IEEE 1284.4 WG AF
IRDA = 26, // IrDA
NETDES = 28, // Network Designers OSI & gateway
TCNPROCESS = 29,
TCNMESSAGE = 30,
ICLFXBM = 31,
BTH = 32 // Bluetooth RFCOMM/L2CAP protocols
};
public ref class SocketAddress
{
public:
SocketAddress(unsigned short family);
property SocketAddressFamily^ Family
{
SocketAddressFamily^ get();
}
virtual System::String^ ToString() override;
private:
SocketAddressFamily^ _family;
};
public ref class IpV4SocketAddress : SocketAddress
{
public:
IpV4SocketAddress(sockaddr *address);
property unsigned int Address
{
unsigned int get();
}
property System::String^ AddressString
{
System::String^ get();
}
virtual System::String^ ToString() override;
private:
unsigned int _address;
};
public ref class PcapAddress public ref class PcapAddress
{ {
public: public:
......
#include "SocketAddress.h"
using namespace System;
using namespace PcapDotNet;
SocketAddress::SocketAddress(unsigned short family)
{
_family = safe_cast<SocketAddressFamily>(family);
}
SocketAddressFamily^ SocketAddress::Family::get()
{
return _family;
}
String^ SocketAddress::ToString()
{
return Family->ToString();
}
#pragma once
#include "SocketAddressFamily.h"
namespace PcapDotNet
{
public ref class SocketAddress
{
public:
SocketAddress(unsigned short family);
property SocketAddressFamily^ Family
{
SocketAddressFamily^ get();
}
virtual System::String^ ToString() override;
private:
SocketAddressFamily^ _family;
};
}
\ No newline at end of file
#pragma once
namespace PcapDotNet
{
public enum class SocketAddressFamily : System::UInt16
{
UNSPEC = 0, // unspecified
UNIX = 1, // local to host (pipes, portals)
INET = 2, // internetwork: UDP, TCP, etc.
IMPLINK = 3, // arpanet imp addresses
PUP = 4, // pup protocols: e.g. BSP
CHAOS = 5, // mit CHAOS protocols
NS = 6, // XEROX NS protocols
IPX = NS, // IPX protocols: IPX, SPX, etc.
ISO = 7, // ISO protocols
OSI = ISO, // OSI is ISO
ECMA = 8, // european computer manufacturers
DATAKIT = 9, // datakit protocols
CCITT = 10, // CCITT protocols, X.25 etc
SNA = 11, // IBM SNA
DECnet = 12, // DECnet
DLI = 13, // Direct data link interface
LAT = 14, // LAT
HYLINK = 15, // NSC Hyperchannel
APPLETALK = 16, // AppleTalk
NETBIOS = 17, // NetBios-style addresses
VOICEVIEW = 18, // VoiceView
FIREFOX = 19, // Protocols from Firefox
UNKNOWN1 = 20, // Somebody is using this!
BAN = 21, // Banyan
ATM = 22, // Native ATM Services
INET6 = 23, // Internetwork Version 6
CLUSTER = 24, // Microsoft Wolfpack
IEEE12844 = 25, // IEEE 1284.4 WG AF
IRDA = 26, // IrDA
NETDES = 28, // Network Designers OSI & gateway
TCNPROCESS = 29,
TCNMESSAGE = 30,
ICLFXBM = 31,
BTH = 32 // Bluetooth RFCOMM/L2CAP protocols
};
}
\ No newline at end of file
...@@ -210,6 +210,14 @@ ...@@ -210,6 +210,14 @@
RelativePath=".\IPcapDevice.h" RelativePath=".\IPcapDevice.h"
> >
</File> </File>
<File
RelativePath=".\IpV4SocketAddress.cpp"
>
</File>
<File
RelativePath=".\IpV4SocketAddress.h"
>
</File>
<File <File
RelativePath=".\MarshalingServices.cpp" RelativePath=".\MarshalingServices.cpp"
> >
...@@ -306,6 +314,18 @@ ...@@ -306,6 +314,18 @@
RelativePath=".\PcapStatistics.h" RelativePath=".\PcapStatistics.h"
> >
</File> </File>
<File
RelativePath=".\SocketAddress.cpp"
>
</File>
<File
RelativePath=".\SocketAddress.h"
>
</File>
<File
RelativePath=".\SocketAddressFamily.h"
>
</File>
<File <File
RelativePath=".\Timestamp.cpp" RelativePath=".\Timestamp.cpp"
> >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment