1
0
Fork 0

enhanced IP address

This commit is contained in:
Kevin Matz 2021-08-30 12:52:56 -04:00
parent 7495897b4a
commit b8e6dcdcef
4 changed files with 150 additions and 16 deletions

View File

@ -13,6 +13,39 @@
abstract = {This User Datagram Protocol (UDP) is defined to make available a datagram mode of packet-switched computer communication in the environment of an interconnected set of computer networks. This protocol assumes that the Internet Protocol (IP) is used as the underlying protocol.},
}
@misc{ASIPM,
series = {Request for Comments},
number = 2365,
howpublished = {RFC 2365},
publisher = {RFC Editor},
doi = {10.17487/RFC2365},
url = {https://rfc-editor.org/rfc/rfc2365.txt},
author = {David Meyer},
title = {{Administratively Scoped IP Multicast}},
pagetotal = 8,
year = 1998,
month = jul,
abstract = {This document defines the "administratively scoped IPv4 multicast space" to be the range 239.0.0.0 to 239.255.255.255. In addition, it describes a simple set of semantics for the implementation of Administratively Scoped IP Multicast. Finally, it provides a mapping between the IPv6 multicast address classes {[}RFC1884{]} and IPv4 multicast address classes. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.},
}
@misc{UnicastPrefixMcast,
series = {Request for Comments},
number = 3306,
howpublished = {RFC 3306},
publisher = {RFC Editor},
doi = {10.17487/RFC3306},
url = {https://rfc-editor.org/rfc/rfc3306.txt},
author = {Brian Haberman and Brian Haberman and Dave Thaler},
title = {{Unicast-Prefix-based IPv6 Multicast Addresses}},
pagetotal = 7,
year = 2002,
month = sep,
abstract = {This specification defines an extension to the multicast addressing architecture of the IP Version 6 protocol. The extension presented in this document allows for unicast-prefix-based allocation of multicast addresses. By delegating multicast addresses at the same time as unicast prefixes, network operators will be able to identify their multicast addresses without needing to run an inter-domain allocation protocol.},
}
@misc{utf8,
series = {Request for Comments},
number = 3629,
@ -29,6 +62,22 @@
}
@misc{EmbeddedRP,
series = {Request for Comments},
number = 3956,
howpublished = {RFC 3956},
publisher = {RFC Editor},
doi = {10.17487/RFC3956},
url = {https://rfc-editor.org/rfc/rfc3956.txt},
author = {Brian Haberman and Pekka Savola},
title = {{Embedding the Rendezvous Point (RP) Address in an IPv6 Multicast Address}},
pagetotal = 18,
year = 2004,
month = nov,
abstract = {This memo defines an address allocation policy in which the address of the Rendezvous Point (RP) is encoded in an IPv6 multicast group address. For Protocol Independent Multicast - Sparse Mode (PIM-SM), this can be seen as a specification of a group-to-RP mapping mechanism. This allows an easy deployment of scalable inter-domain multicast and simplifies the intra-domain multicast configuration as well. This memo updates the addressing format presented in RFC 3306. {[}STANDARDS-TRACK{]}},
}
@misc{uuid,
series = {Request for Comments},
number = 4122,
@ -43,3 +92,36 @@
month = jul,
abstract = {This specification defines a Uniform Resource Name namespace for UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier). A UUID is 128 bits long, and can guarantee uniqueness across space and time. UUIDs were originally used in the Apollo Network Computing System and later in the Open Software Foundation\textbackslash{}'s (OSF) Distributed Computing Environment (DCE), and then in Microsoft Windows platforms. This specification is derived from the DCE specification with the kind permission of the OSF (now known as The Open Group). Information from earlier versions of the DCE specification have been incorporated into this document. {[}STANDARDS-TRACK{]}},
}
@misc{IPv6Addr,
series = {Request for Comments},
number = 4291,
howpublished = {RFC 4291},
publisher = {RFC Editor},
doi = {10.17487/RFC4291},
url = {https://rfc-editor.org/rfc/rfc4291.txt},
author = {Dr. Steve E. Deering and Bob Hinden},
title = {{IP Version 6 Addressing Architecture}},
pagetotal = 25,
year = 2006,
month = feb,
abstract = {This specification defines the addressing architecture of the IP Version 6 (IPv6) protocol. The document includes the IPv6 addressing model, text representations of IPv6 addresses, definition of IPv6 unicast addresses, anycast addresses, and multicast addresses, and an IPv6 node's required addresses. This document obsoletes RFC 3513, "IP Version 6 Addressing Architecture". {[}STANDARDS-TRACK{]}},
}
@misc{IPv6McastScope,
series = {Request for Comments},
number = 7346,
howpublished = {RFC 7346},
publisher = {RFC Editor},
doi = {10.17487/RFC7346},
url = {https://rfc-editor.org/rfc/rfc7346.txt},
author = {Ralph Droms},
title = {{IPv6 Multicast Address Scopes}},
pagetotal = 6,
year = 2014,
month = aug,
abstract = {This document updates the definitions of IPv6 multicast scopes and therefore updates RFCs 4007 and 4291.},
}

View File

@ -100,9 +100,21 @@ static const uint16_t E131_DISCOVERY_UNIVERSE = 64214;
static const uint16_t ACN_SDT_MULTICAST_PORT = 5568;
/// @brief borrow Ip address types from ACN::SDT
using ip_addr_spec = ACN::SDT::ip_addr_spec;
/// @brief borrow Ip address struct from ACN::SDT::UDP
///
/// > \cite sACN 9 Operation of E1.31 in IPv4 and IPv6 Networks
/// >
/// > This standard has the ability to operate over both IPv4 and IPv6
/// > transports.
using ipAddress = ACN::SDT::UDP::ipAddress;
/// @brief borrow Ip address types from ACN::SDT
///
/// > \cite sACN 9 Operation of E1.31 in IPv4 and IPv6 Networks
/// >
/// > Components complying with this standard shall indicate,
/// > through labelling, manufacturer documentation, or other means, which IP
/// > transports they support.
using ip_addr_spec = ACN::SDT::ip_addr_spec;
} // SACN

View File

@ -57,16 +57,14 @@ void ipAddress::iStream(PDU::Stream stream)
return;
*stream >> port;
switch (type)
{
case SDT_ADDR_IPV4:
for (size_t i = 0; i < sizeof(ipv4); i++)
*stream >> ipv4[i];
*stream >> address.ipv4.value;
break;
case SDT_ADDR_IPV6:
for (size_t i = 0; i < sizeof(ipv6); i++)
*stream >> ipv6[i];
for (size_t i = 0; i < sizeof(address.ipv6.bytes); i++)
*stream >> address.ipv6.bytes[i];
break;
}
}
@ -86,12 +84,10 @@ void ipAddress::oStream(PDU::Stream stream) const
switch (type)
{
case SDT_ADDR_IPV4:
for (size_t i = 0; i < sizeof(ipv4); i++)
*stream << ipv4[i];
*stream << address.ipv4.value;
break;
case SDT_ADDR_IPV6:
for (size_t i = 0; i < sizeof(ipv6); i++)
*stream << ipv6[i];
stream->write(address.ipv6.bytes, sizeof(address.ipv6.bytes));
break;
}
}

View File

@ -50,13 +50,57 @@ static const uint16_t SDT_MULTICAST_PORT = 5568; // IANA registered “sdt”
struct ipAddress
: PDU::pdu_stream_object
{
uint8_t type = 0; //!< address type identifier
uint16_t port = SDT_MULTICAST_PORT; //!< Port
union {
uint8_t ipv4[4];
uint8_t ipv6[16] = {0};
ipAddress()
: type(0) // SDT_ADDR_NULL
, port(SDT_MULTICAST_PORT)
{
memset(address.ipv6.bytes, 0, sizeof(address.ipv6.bytes));
address.ipv6.scope = 0x8;
address.ipv6.flag_t = true;
address.ipv6.prefix = 0xff;
};
uint8_t type; //!< address type identifier
uint16_t port; //!< TCP/UDP Port
union {
struct {
union {
uint8_t bytes[4];
uint32_t value;
};
} ipv4;
struct {
union {
uint8_t bytes[16];
struct {
uint8_t group[14];
union {
uint8_t flags_and_scope;
struct {
/// > The scope shall be set to 0x8 to indicate Organization-Local
/// > scope per RFC 4291 \cite IPv6Addr and RFC 7346 \cite IPv6McastScope.
uint8_t scope : 4;
/// > The T flag indicates a “transient” multicast address that
/// > is not permanently assigned by IANA. This bit shall be set
/// > to 1 to indicate a non-permanently assigned multicast address.
bool flag_t : 1;
/// > The P flag is defined by RFC 3306 \cite UnicastPrefixMcast
/// > and shall be set to 0.
bool flag_p : 1;
/// > The R flag is defined by RFC 3956 \cite EmbeddedRP and
/// > shall be set to 0.
bool flag_r : 1;
/// > The high-order flag bit is reserved and shall be set to 0.
bool flag_0 : 1;
};
};
/// > The multicast address prefix is fixed at 0xFF.
uint8_t prefix;
};
};
} ipv6;
} address; ///< ipv4 or ipv6 address
size_t streamSize() const override;
void iStream(PDU::Stream) override;
void oStream(PDU::Stream) const override;