java.lang.Object
anbxj.AnB_Protocol<S,R>
- Type Parameters:
S
- class stepsR
- roles class
- Direct Known Subclasses:
AnBx_Protocol
AnB Protocol: an abstract class for defining AnB protocols
-
Field Summary
FieldsModifier and TypeFieldDescriptionMapping of aliases for protocol roles.protected static final AnBx_Layers
The layer for debugging purposes.protected Map
<String, AnB_Session> Mapping of session names to session instances.protected String
The name of the protocol.protected R
The role of the protocol.protected static long
Number of sessions for the protocol.protected String
The path for sharing data in the protocol.protected Crypto_ByteArray
A byte array of zeros used in the protocol. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Abort the protocol with a specified error messageprotected void
Abort the protocol with a specified error message, exception, and session ID.protected boolean
Checks if two objects are equal without a specific label.protected boolean
Checks if two objects are equal with a flag indicating possible failure.protected boolean
Checks if two objects are equal with a specified label.protected boolean
Checks if two objects are equal with a specified label and a flag indicating possible failure.protected abstract void
executeStep
(AnB_Session lbs, S step) Abstract method to execute a step in the AnB protocol.protected String
getAlias()
Get the alias for the current role.protected abstract void
init()
Abstract method to initialise the AnB protocol.protected boolean
Perform an inverse check without a label for a single object.protected boolean
Perform an inverse check without a label for an object and a class.protected boolean
Perform an inverse check without a label for two objects.protected boolean
Perform an inverse check with a label for a single object.protected boolean
Perform an inverse check with a label for an object and a class.protected boolean
Perform an inverse check with a label for two objects.protected boolean
Get the value of abortOnFail.protected boolean
Return the value of checkAnywayprotected boolean
noteqCheck
(Object obj1, Object obj2) Checks if two objects are not equal without a specific label.protected boolean
noteqCheck
(String label, Object obj1, Object obj2) Checks if two objects are not equal with a specified label.void
Runs the protocol with the given maps of sessions and aliases.abstract void
Abstract method to run the AnB protocol.protected boolean
Checks if the specified object has been seen.protected boolean
Checks if the specified object has been seen with a given label.protected void
setAbortOnFail
(boolean abortOnFail) Set the value of abortOnFail.protected void
setCheckAnyway
(boolean checkAnyway) Set the value of checkAnyway.protected void
Outputs the status of the protocol with a specific step.protected void
Outputs the status of the protocol with a specific step and payload.protected void
statusLabel
(String label) Outputs the status label for a check with a given label.protected boolean
Checks if the given object is a well-formed formula (WFF) without a specific label.protected boolean
Checks if the given object is a well-formed formula (WFF) with a specified class type.protected boolean
Checks if the given object is a well-formed formula (WFF) with a specified label.protected boolean
Checks if the given object is a well-formed formula (WFF) with a specified label and class type.
-
Field Details
-
layer
The layer for debugging purposes. -
name
The name of the protocol. -
role
The role of the protocol. -
aliases
Mapping of aliases for protocol roles. -
lbs
Mapping of session names to session instances. -
sessions
protected static long sessionsNumber of sessions for the protocol. -
zero
A byte array of zeros used in the protocol.
-
-
Constructor Details
-
AnB_Protocol
public AnB_Protocol()Default constructor
-
-
Method Details
-
run
Runs the protocol with the given maps of sessions and aliases.- Parameters:
lbs
- Mapping of session names to session instances.aliases
- Mapping of aliases for protocol roles.
-
run
Abstract method to run the AnB protocol.- Parameters:
lbs
- The map of session IDs to AnB sessions.aliases
- The map of role names to their corresponding aliases.sessions
- The number of sessions for the protocol.
-
executeStep
Abstract method to execute a step in the AnB protocol.- Parameters:
lbs
- The AnB session for the role.step
- The step to execute.
-
init
protected abstract void init()Abstract method to initialise the AnB protocol. -
isAbortOnFail
protected boolean isAbortOnFail()Get the value of abortOnFail.- Returns:
- true if the protocol should abort on failure, false otherwise.
-
setAbortOnFail
protected void setAbortOnFail(boolean abortOnFail) Set the value of abortOnFail.- Parameters:
abortOnFail
- The value to set for abortOnFail.
-
isCheckAnyway
protected boolean isCheckAnyway()Return the value of checkAnyway- Returns:
- the checkAnyway
-
setCheckAnyway
protected void setCheckAnyway(boolean checkAnyway) Set the value of checkAnyway.- Parameters:
checkAnyway
- The value to set for checkAnyway.
-
abort
Abort the protocol with a specified error message- Parameters:
msg
- The error message.
-
abort
Abort the protocol with a specified error message, exception, and session ID.- Parameters:
msg
- The error message.e
- The exception (can be null).sessionID
- The session ID.
-
getAlias
Get the alias for the current role.- Returns:
- The alias for the current role.
-
invCheck
Perform an inverse check with a label for two objects.- Parameters:
label
- The label for the check.obj1
- The first object.obj2
- The second object.- Returns:
- True if the check is successful, false otherwise.
-
invCheck
Perform an inverse check with a label for an object and a class.- Parameters:
label
- The label for the check.obj
- The object.cls
- The class to check against.- Returns:
- True if the check is successful, false otherwise.
-
invCheck
Perform an inverse check with a label for a single object.- Parameters:
label
- The label for the check.obj
- The object.- Returns:
- True if the check is successful, false otherwise.
-
invCheck
Perform an inverse check without a label for two objects.- Parameters:
obj1
- The first object.obj2
- The second object.- Returns:
- True if the check is successful, false otherwise.
-
invCheck
Perform an inverse check without a label for an object and a class.- Parameters:
obj
- The object.cls
- The class to check against.- Returns:
- True if the check is successful, false otherwise.
-
invCheck
Perform an inverse check without a label for a single object.- Parameters:
obj
- The object.- Returns:
- True if the check is successful, false otherwise.
-
wffCheck
Checks if the given object is a well-formed formula (WFF) with a specified label.- Parameters:
label
- the label for the checkobj
- the object to be checked- Returns:
- true if the object is a well-formed formula, false otherwise
-
wffCheck
Checks if the given object is a well-formed formula (WFF) with a specified label and class type.- Parameters:
label
- the label for the checkobj
- the object to be checkedcls
- the expected class type for the object- Returns:
- true if the object is a well-formed formula, false otherwise
-
wffCheck
Checks if the given object is a well-formed formula (WFF) without a specific label.- Parameters:
obj
- the object to be checked- Returns:
- true if the object is a well-formed formula, false otherwise
-
wffCheck
Checks if the given object is a well-formed formula (WFF) with a specified class type.- Parameters:
obj
- the object to be checkedcls
- the expected class type for the object- Returns:
- true if the object is a well-formed formula, false otherwise
-
noteqCheck
Checks if two objects are not equal with a specified label.- Parameters:
label
- the label for the checkobj1
- the first object to be comparedobj2
- the second object to be compared- Returns:
- true if the objects are not equal, false otherwise
-
noteqCheck
Checks if two objects are not equal without a specific label.- Parameters:
obj1
- the first object to be comparedobj2
- the second object to be compared- Returns:
- true if the objects are not equal, false otherwise
-
eqCheck
Checks if two objects are equal with a specified label.- Parameters:
label
- the label for the checkobj1
- the first object to be comparedobj2
- the second object to be compared- Returns:
- true if the objects are equal, false otherwise
-
eqCheck
Checks if two objects are equal with a specified label and a flag indicating possible failure.- Parameters:
label
- the label for the checkobj1
- the first object to be comparedobj2
- the second object to be comparedmayfail
- flag indicating whether the check may fail- Returns:
- true if the objects are equal, false otherwise
-
eqCheck
Checks if two objects are equal without a specific label.- Parameters:
obj1
- the first object to be comparedobj2
- the second object to be compared- Returns:
- true if the objects are equal, false otherwise
-
eqCheck
Checks if two objects are equal with a flag indicating possible failure.- Parameters:
obj1
- the first object to be comparedobj2
- the second object to be comparedmayfail
- flag indicating whether the check may fail- Returns:
- true if the objects are equal, false otherwise
-
seen
Checks if the specified object has been seen with a given label.- Parameters:
label
- the label for the checkobj
- the object to be checked- Returns:
- true if the object has been seen before, false otherwise
-
seen
Checks if the specified object has been seen.- Parameters:
obj
- the object to be checked- Returns:
- true if the object has been seen before, false otherwise
-
status
Outputs the status of the protocol with a specific step.- Parameters:
step
- the step in the protocol
-
statusLabel
Outputs the status label for a check with a given label.- Parameters:
label
- the label for the check
-
status
Outputs the status of the protocol with a specific step and payload.- Parameters:
step
- the step in the protocolpayload
- the payload associated with the step
-