|
HelloWorld Programs
The HyperCast HelloWorld programs demonstrate
various
aspects of the HyperCast API. The programs create an overlay
socket that sends and receives messages. The
following are
(extended) versions of the HelloWorld programs explained in the
chapters "Basic API"
and the "Advanced
API".
Compile
each file and
start the program in multiple windows on the same host or different hosts.
The programs work with any of the "standard" configuration files given below.
Configuration Files
-All configuration files can be created from the HyperCast Configuration Editor program
-Rename the files as needed by the above HelloWorld programs.
Standard Configurations |
Default Configuration
hypercast.xml |
Protocol: Delaunay Triangulation (DT)
with buddylist
rendezvous
Control: UDP Unicast
Data: TCP
Required changes:
At least one application must be configured to be a `buddy' that is used by other applications to join the overlay.
- On one system, say with IP address 10.0.1.2, set
/Public/NodeAdapter/NodeAdptUDP/PhyAddr/INETV4AndTwoPorts=0.0.0.0:9800:0
- On all applications (including the above), set
/Public/OverlayID=MyOverlay
/Public/Node/DTBuddyList/Buddy/UnderlayAddress/INETV4AndOnePort=10.0.1.2:9800
Note:
- An IP address set to 0.0.0.0 is replaced by an IP address of the
local machine. A port number set to 0 is replaced by an unused port. If
a port is set to a value >0, but unavailable, another unused port is
selected.
- In (1), the first step sets the address of the node
adapter to 10.0.1.2/9800. The node that allocates this port will
become the buddy. (This port must be available.) In (2), the first
line sets the overlay identifier (The default setting is an empty
string. If an overlay socket is started with an empty overlay ID,
HyperCast picks an overlay ID consisting of an address and a
timestamp), and the second line sets address of the buddy to that
selected in step (1).
|
Spanning Tree
hypercast-spt.xml |
Protocol: Spanning Tree (SPT) protocol with broadcast rendezvous
Control: UDP Multicast
Data: UDP Unicast
Required changes: None
Note:
- The number of recorded hops in the header is
set to 1, i.e., /Public/RouteRecordSize=1. This is needed
to prevent forwarding loops in the (HyperCast) multicast
transmission.
- The default address for UDP Multicast of the
node adapter is 224.228.19.78/9472. If this address is not
available, a different value should be picked.
- If run in an 802.11 networks in ad-hoc mode, this configuration sets up an application layer ad hoc network.
|
Configurations with Overlay servers |
Overlay Server
hypercast-oserver.xml |
Protocol: Spanning Tree (SPT) protocol with broadcast rendezvous
Control: UDP Multicast
Data: UDP Unicast
Required changes:
- The configuration
attribute /Public/OverlayServer/HTTP_Server must be changed to the URL
of a valid overlay server, e.g., http://128.100.11.52:8080.
- An overlay server must be started on some system, e.g., by executing :
java hypercast.HTTP_Server 8080
Note:
- To observe the current configuration of the overlay server, run a browser with the URL of the overlay server.
- If an overlay server is specified, a
configuration object contacts the overlay server before creating the
overlay socket. Depending on the overlay identifier in the
configuration file, the following happens:
- If the overlay identifier in the
configuration file is not stored at the overlay server, the
configuration attributes are uploaded to the overlay server, and a new
entry is created at the overlay server
- If the overlay server has an entry for the
overlay identifier in the configuration file, the configuration
attributes of this entry are downloaded from the server, and merged
with the attributes in the configuration file. When merging, the
downloaded attributes take precedence over the attributes in the
configuration file.
- If the local configuration file does not
specify an overlay identifier, the configuration object uploads its
configuration file. The overlay server creates a new overlay
identifier, and returns the identifier to the configuration object. The
server also creates a new entry with the uploaded attributes.
|
Configurations with Securit
|
Security (SSL Adapters)
hypercast-ssl.xml |
Protocol: DT
with buddylist
rendezvous
Control: SSL with ciphersuite TLS_RSA_WITH_AES_128_CBC_SHA
Data: SSL with ciphersuite TLS_RSA_WITH_AES_128_CBC_SHA
Required changes:
Very similar to the required changes in the default configuration.
- On one system, say with IP address 10.0.1.2, set
/Public/NodeAdapter/NodeAdptSSL/PhyAddr/INETV4AndTwoPorts=0.0.0.0:9800:0
/Public/Node/DTBuddyList/Buddy/UnderlayAddress/INETV4AndOnePort=10.0.1.2:9800
- On all other applications, set
/Public/Node/DTBuddyList/Buddy/UnderlayAddress/INETV4AndOnePort=10.0.1.2:9800
Note:
- The attribute
/Public/Security/KeyStoreLocation=.keystore
assumes that there is a keystore file ".keystore" in the working directory containing a public/private key pair
- The attribute
/Public/Security/CertificateLocation=testcert.cer
assumes that there is an X.509 version 3 file "testcert.cer" in
the working directory, that matches the public key in the .keystore
file.
- The attribute
/Public/Security/CACertificateLocation=testcert.cer
specifies the certificate of the CA. Here, it is assumed that testcert.cer is self-signed.
- The program using this file must set a private attribute
/Private/KeyStorePassword
that contains the password to the .keystore file (see HelloWorld_Security.java)
- The distribution of HyperCast contains files
testcert.cer and .keystore that work with the above configuraiton.
These files should be replaced by user-defined files.
|
Security (Encryption)
hypercast-spt-encrypt.xml |
Protocol: Spanning Tree (SPT) protocol with broadcast rendezvous
Control: UDP Multicast
Data: UDP Unicast
SecurityLevel: Privacy.
Required changes: None
Note:
- This configuration uses the Neighborhood key method (NeighborhoodKey1) for key management.
- This configuration uses the following algorithms:
- Application payload: encrypted with AES (128 bits) and signed with HmacMD5.
- Application header: Signed with HmacMD5.
- Protocol messages: Signed with HmacMD5.
- See instructions for SPT configuration.
- See instructions for SSL Adapters.
- The program using this file must set these private attributes
/Private/KeyStorePassword
/Private/PrivateKeyAlias
/Private/PrivateKeyPassword
which contain, respectively, the password to the .keystore file,
the alias for the private key in .keystore, and the password for the
private key (see HelloWorld_Security.java)
|
|
|