public static enum DOFConnection.Type extends java.lang.Enum<DOFConnection.Type>
DOFConnection.Config
that simplify Config building.Enum Constant and Description |
---|
DATAGRAM
Indicates a normal datagram connection.
|
DATAGRAM_STATELESS
Indicates a "stateless" datagram connection, or in other words, simply a
place to send datagram packets and receive datagram responses.
|
GROUP
Indicates a special
DATAGRAM connection that is communicating securely with many other nodes. |
HUB
|
POINT
|
STREAM
Indicates a stream connection.
|
Modifier and Type | Method and Description |
---|---|
static DOFConnection.Type |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DOFConnection.Type[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DOFConnection.Type STREAM
public static final DOFConnection.Type DATAGRAM
GROUP
).
There are 3 cases:
//Inputs - determine these values before starting
final DOFAddress address_mcast = InetTransport.createAddress(InetTransport.DEFAULT_MULTICAST_ADDRESS_IPV4, InetTransport.DEFAULT_MULTICAST_PORT);
//Unicast DATAGRAM Base server
final DOFAddress address_ucast = InetTransport.createAddress("0.0.0.0", 0);
final DOFServer.Config serverConfig_ucast =
new DOFServer.Config.Builder( DOFServer.Type.DATAGRAM, address_ucast)
.build();
final DOFServer server_ucast = dof.createServer(serverConfig_ucast);
//Related Multicast DATAGRAM server
final DOFServer.Config serverConfig_mcast =
new DOFServer.Config.Builder(DOFServer.Type.DATAGRAM, address_mcast)
.build();
final DOFServer server_mcast = server_ucast.createServer(serverConfig_mcast);
server_mcast.start(TIMEOUT);
//Inputs - determine these values before starting
final DOFAddress address_mcast = InetTransport.createAddress(InetTransport.DEFAULT_MULTICAST_ADDRESS_IPV4, InetTransport.DEFAULT_MULTICAST_PORT);
//Related GROUP connection
final DOFConnection.Config connConfig_mcast =
new DOFConnection.Config.Builder(DOFConnection.Type.DATAGRAM, address_mcast)
.build();
final DOFConnection conn_mcast = dof.createConnection(connConfig_mcast);
conn_mcast.connect(TIMEOUT);
//Inputs - determine these values before starting
final DOFAddress address_mcast = InetTransport.createAddress(InetTransport.DEFAULT_MULTICAST_ADDRESS_IPV4, InetTransport.DEFAULT_MULTICAST_PORT);
//Unicast DATAGRAM Base server
final DOFAddress address_ucast = InetTransport.createAddress("0.0.0.0", 0);
final DOFServer.Config serverConfig_ucast =
new DOFServer.Config.Builder( DOFServer.Type.DATAGRAM, address_ucast)
.build();
final DOFServer server_ucast = dof.createServer(serverConfig_ucast);
//Related Multicast DATAGRAM server
final DOFServer.Config serverConfig_mcast =
new DOFServer.Config.Builder(DOFServer.Type.DATAGRAM, address_mcast)
.build();
final DOFServer server_mcast = server_ucast.createServer(serverConfig_mcast);
//Related GROUP connection
final DOFConnection.Config connConfig_mcast =
new DOFConnection.Config.Builder(DOFConnection.Type.DATAGRAM, address_mcast)
.build();
final DOFConnection conn_mcast = server_mcast.createConnection(connConfig_mcast);
conn_mcast.connect(TIMEOUT);
DOF.createServer(org.opendof.core.oal.DOFServer.Config)
,
DOF.createConnection(org.opendof.core.oal.DOFConnection.Config)
,
DOFServer.createServer(org.opendof.core.oal.DOFServer.Config)
,
DOFServer.createConnection(org.opendof.core.oal.DOFConnection.Config)
,
DOFConnection.Config.BuilderAS
,
DOFConnection.Config.BuilderSecureDatagram
,
DOFConnection.Config.BuilderUnsecureDatagram
,
DOFConnection.Config.BuilderUnsecureMulticast
public static final DOFConnection.Type DATAGRAM_STATELESS
public static final DOFConnection.Type HUB
DATAGRAM
connection that is communicating securely with a set of nodes
(POINT
s).
This type of connection has special authentication procedures and utilizes shared encryption keys with other
nodes in its group.
This is also called a secure unicast group.
It has the advantage of needing less traffic to manage the group (less than secure multicast groups,
see GROUP
), but all multicast operations (such as rekeying or OAP multicast) require a separate
packet per POINT.
A HUB is, by definition, the manager of the secure unicast group.
To properly create a HUB connection, you must follow these steps:
//Inputs - determine these values before starting
final DOFAddress hubAddress = InetTransport.createAddress("0.0.0.0", hubPort);
final DOFGroupAddress groupAddress = new DOFGroupAddress(groupID);
final DOFCredentials myCredentials;
//DATAGRAM Base server
final DOFServer.Config serverConfigDatagram =
new DOFServer.Config.Builder(DOFServer.Type.DATAGRAM, hubAddress)
.build();
final DOFServer serverDatagram = dof.createServer(serverConfigDatagram);
//Related HUB connection
final DOFConnection.Config connConfigHub =
new DOFConnection.Config.Builder(DOFConnection.Type.HUB, groupAddress)
.setCredentials(myCredentials)
.build();
final DOFConnection connHub = serverDatagram.createConnection(connConfigHub);
connHub.connect(TIMEOUT);
public static final DOFConnection.Type POINT
DATAGRAM
connection that is communicating securely with a central node called a
HUB
.
This type of connection has special authentication procedures and utilizes shared encryption keys with other
nodes in its group.
This is also called a secure unicast group. See HUB
.
A POINT cannot become a manager of a secure unicast group.
To properly create a POINT connection, you must follow these steps:
//Inputs - determine these values before starting
final DOFAddress hubAddress = InetTransport.createAddress(hubAddr, hubPort);
final DOFGroupAddress groupAddress = new DOFGroupAddress(groupID);
final DOFCredentials myCredentials;
//DATAGRAM base connection
final DOFConnection.Config connConfigDatagram =
new DOFConnection.Config.Builder(DOFConnection.Type.DATAGRAM, hubAddress)
.build();
final DOFConnection connDatagram = dof.createConnection(connConfigDatagram);
//Related POINT connection
final DOFConnection.Config connConfigPoint =
new DOFConnection.Config.Builder(DOFConnection.Type.POINT, groupAddress)
.setCredentials(myCredentials)
.build();
final DOFConnection connPoint = connDatagram.createConnection(connConfigPoint);
connPoint.connect(TIMEOUT);
public static final DOFConnection.Type GROUP
DATAGRAM
connection that is communicating securely with many other nodes.
This type of connection has special authentication procedures and utilizes shared encryption keys with other
nodes in its group.
This is also called a secure multicast group. It has the advantage of cheaply multicasting traffic
to all group members, but group management is a little more expensive than unicast groups
(see HUB
) due to heartbeats and manager arbitration.
Any group member can be manager of the group. The manager is chosen based on rank (see
DOF.Config.getRank()
) and other factors.
To properly create a GROUP connection you must follow these steps:
//Inputs - determine these values before starting
final DOFAddress address_mcast = InetTransport.createAddress(InetTransport.DEFAULT_MULTICAST_ADDRESS_IPV4, InetTransport.DEFAULT_MULTICAST_PORT);
final DOFGroupAddress groupAddress = new DOFGroupAddress(groupID);
final DOFCredentials myCredentials;
//Unicast DATAGRAM Base server
final DOFAddress address_ucast = InetTransport.createAddress("0.0.0.0", 0);
final DOFServer.Config serverConfig_ucast =
new DOFServer.Config.Builder(DOFServer.Type.DATAGRAM, address_ucast)
.build();
final DOFServer server_ucast = dof.createServer(serverConfig_ucast );
//Related Multicast DATAGRAM server
final DOFServer.Config serverConfig_mcast =
new DOFServer.Config.Builder(DOFServer.Type.DATAGRAM, address_mcast)
.build();
final DOFServer server_mcast = server_ucast.createServer(serverConfig_mcast);
//Related GROUP connection
final DOFConnection.Config connConfig_mcast =
new DOFConnection.Config.Builder(DOFConnection.Type.GROUP, groupAddress)
.setCredentials(myCredentials)
.build();
final DOFConnection conn_mcast = server_mcast.createConnection(connConfig_mcast);
conn_mcast.connect(TIMEOUT);
public static DOFConnection.Type[] values()
for (DOFConnection.Type c : DOFConnection.Type.values()) System.out.println(c);
public static DOFConnection.Type valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null