public class MessageTransferAcceptPolicy
extends java.lang.Object
Message transfer accepting policy module. Can be used to decide whether certain messages should be accepted or not. Shared by a whole node group, but uses the module communication bus of each node in question.
Supports 3 different modes: "simple policy", Hop Count, and
ModuleCommunicationBus (MCB) values. With simple policy, hosts that are
accepted as the source of a message (i.e., the original message sender) when
receiving a message are listed (comma separated values) using the
FROM_RPOLICY_S setting
(when sending, using FROM_SPOLICY_S) and hosts that are accepted as
the destination when receiving are listed using TO_RPOLICY_S
(and when sending, using TO_SPOLICY_S). By default, any message is
accepted.
With ModuleCommunicationBus values, the amount of conditions is first defined
with NROF_MCBCS_S and sending/receiving conditions are defined
as ArithmeticCondition with MCBACS_S or MCBACR_S
and the ModuleCommuncationBus IDs where to get values from to use with the
condition with MCBCVS_S and MCBCVR_S.
The MCB conditions are checked first, and if none of them match, simple policy conditions are checked. If they don't exists, or one of them matches, hop count policy is checked. If that doesn't exist or matches to message's hop count, transfer is accepted. Otherwise transfer is denied.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FROM_RPOLICY_S
Simple-policy accept-from -setting id ("fromReceivePolicy").
|
static java.lang.String |
FROM_SPOLICY_S
Simple-policy accept-from -setting id ("fromSendPolicy").
|
static java.lang.String |
HOPCOUNT_RPOLICY_S
Hop count forwarding receive policy -setting id ("hopCountReceivePolicy").
|
static java.lang.String |
HOPCOUNT_SPOLICY_S
Hop count forwarding send policy -setting id ("hopCountSendPolicy").
|
static java.lang.String |
MCBACR_S
Module Communication Bus Arithmetic Condition for Receiving -setting id
("MCBRcondition").
|
static java.lang.String |
MCBACS_S
Module Communication Bus Arithmetic Condition for Sending -setting id
("MCBScondition").
|
static java.lang.String |
MCBCVR_S
Module Communication Bus Condition Value for Receiving -setting id
("MCBRvalue").
|
static java.lang.String |
MCBCVS_S
Module Communication Bus Condition Value for Sending -setting id
("MCBSvalue").
|
static java.lang.String |
MTA_POLICY_NS
Namespace for all "Message Transfer Accept policy" settings ("mtaPolicy")
|
static java.lang.String |
NROF_MCBCS_S
Number of Module Communication Bus Conditions -setting id ("nrofMCBACs").
|
static int |
TO_ME_VALUE
The valued used in to-policy to refer to this host (-1)
|
static java.lang.String |
TO_RPOLICY_S
Simple-policy accept-to -setting id ("toReceivePolicy").
|
static java.lang.String |
TO_SPOLICY_S
Simple-policy accept-to -setting id ("toSendPolicy").
|
| Constructor and Description |
|---|
MessageTransferAcceptPolicy(Settings nsSettings) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptReceiving(DTNHost from,
DTNHost to,
Message m)
Returns true if the given message is OK to receive from "from" to
"to" host.
|
boolean |
acceptSending(DTNHost from,
DTNHost to,
Connection con,
Message m)
Returns true if the given message, using the given connection, is OK
to send from "from" to "to" host.
|
public static final java.lang.String MTA_POLICY_NS
public static final java.lang.String NROF_MCBCS_S
public static final java.lang.String MCBACR_S
ArithmeticCondition. Defines one arithmetic condition
to use for receiving messages.public static final java.lang.String MCBACS_S
ArithmeticCondition.public static final java.lang.String MCBCVR_S
public static final java.lang.String MCBCVS_S
public static final int TO_ME_VALUE
public static final java.lang.String TO_RPOLICY_S
TO_ME_VALUE
refers to this host.public static final java.lang.String FROM_RPOLICY_S
TO_ME_VALUE
refers to this host.public static final java.lang.String TO_SPOLICY_S
TO_ME_VALUE refers
to this host (but doesn't usually make much sense here).public static final java.lang.String FROM_SPOLICY_S
Simple-policy accept-from -setting id ("fromSendPolicy"). Integer list.
Defines the addresses of the hosts accepted as the source of a
message when sending messages. Special value TO_ME_VALUE refers
to this host.
Note: if this setting is defined and the TO_ME_VALUE
is NOT listed, the hosts own messages are not sent anywhere.
public static final java.lang.String HOPCOUNT_RPOLICY_S
ArithmeticCondition. Defines condition for the message hop
count; if the condition does not match, the message is rejected,
unless it is destined to this node.public static final java.lang.String HOPCOUNT_SPOLICY_S
ArithmeticCondition. Defines condition for the message hop
count; if the condition does not match, the message is not offered
to other nodes, unless it would be delivered to the final destination.public MessageTransferAcceptPolicy(Settings nsSettings)
public boolean acceptSending(DTNHost from, DTNHost to, Connection con, Message m)
from - The sending hostto - The receiving hostcon - The connection used by the hostsm - The message to transferpublic boolean acceptReceiving(DTNHost from, DTNHost to, Message m)
from - The sending hostto - The receiving hostm - The message to transfer