O'Reilly logo

Mobile Agents by Wilhelm R. Rossak, Peter Braun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.5 The SATP Migration Protocol 243
The second method is used to send a message to the destination agency.
The return value contains the reply message, which must be processed
immediately.
public byte[] send( Object handle, byte[] data )throws KalongException
Sends the given byte sequence to the receiver, waits for a reply, and returns it. Throws an exception if the method
cannot be sent.
Finally, at the end of a transfer, the network connection must be closed
again.
public void closeTransfer( Object handle )
Closes a network connection.
6.4.4 Interface IServer
The last interface defines methods that must be used by the network com-
ponent to access Kalong. Kalong must provide an implementation of this
interface.
These methods are the counterparts of the ones described in the previous
section. For example, if method send of interface INetwork is called at the
sender, method receive of this interface is called at the receiver.
public Object openTransfer()throws KalongException
Opens a network connection, returns an object to identify this transfer.
The method returns null if the connection cannot be opened.
public byte[] receive( Object handle, byte[] data )throws KalongException
Receives the given byte sequence, waits for a reply, and returns it.
public void closeTransfer( Object handle )
Closes a network connection.
6.5 The SATP Migration Protocol
This section defines the SATP migration protocol, version 1.0.
244 Chapter 6 Specifications of the Kalong Mobility Model
6.5.1 Introduction
Each method of interface IKalong to transfer agent information uses one
of the message types defined in this section. Although it might be clear from
the names which method uses which message, Table 6.2 gives an overview.
A reply message named Ok/Nok stands for a reply that only contains the
information of whether the receiver has accepted the request.
To describe the message format, we use the Extended Backus-Naur Form
as introduced in Chapter 3. First of all, we define the following nonterminal
symbols: <Byte> represents a single byte with value range from 0 to 255;
<Short> is used for numbers and is two bytes long; <Integer> is also used
for numbers and is four bytes long. To code <Short> and <Integer> sym-
bols, we use the big-endian format, where the highest byte is stored first,
at the lowest storage address. For example, a 4-byte integer is stored in the
following order:
Byte3 Byte2 Byte1 Byte0
0123
The first line shows the sequence of bytes in memory, the second line shows
the byte offset.
In this section, it will sometimes be necessary to express a byte literal.
In this case, we will use hexadecimal numbers (e.g., “0x15” to express the
decimal number 21). In addition to the meta symbols introduced above, we
define n{<A>}m as a repetition of symbol <A> between n and m times, where
0 n m. Mostly, we will use this new meta symbol when we have to define
a repetition of exactly n times, so that we write n{<A>}n.
Sometimes it is necessary to refer to a value of a <Byte>, <Short>,or
<Integer> symbol. In this case, we will write <A
n
> to express that symbol
<A> contains the value n.
For example, the following <Message> is comprised of n + 5 bytes, where
the number n is described by symbol <A>.
1.
<Message> ::= <A
n
> + <B> + <C>
2. <A> ::= <Byte>
3. <B> ::= n{<Byte>}n
4. <C> ::= <Integer>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required