Struct routing::messaging::MpidHeader [] [src]

pub struct MpidHeader {
    // some fields omitted
}

Minimal information about a given message which can be used as a notification to the receiver.

Methods

impl MpidHeader
[src]

fn new(sender: XorName, metadata: Vec<u8>, secret_key: &SecretKey) -> Result<MpidHeaderError>

Constructor.

Each new MpidHeader will have a random unique identifier assigned to it, accessed via the guid() getter.

sender represents the name of the original creator of the message.

metadata is arbitrary, user-supplied information which must not exceed MAX_HEADER_METADATA_SIZE. It can be empty if desired.

secret_key will be used to generate a signature of sender, guid and metadata.

An error will be returned if metadata exceeds MAX_HEADER_METADATA_SIZE or if serialisation during the signing process fails.

fn sender(&self) -> &XorName

The name of the original creator of the message.

fn guid(&self) -> &[u8; 16]

A unique identifier generated randomly when calling new().

fn metadata(&self) -> &Vec<u8>

Arbitrary, user-supplied information.

fn signature(&self) -> &Signature

The signature of sender, guid and metadata, created when calling new().

fn name(&self) -> Result<XorNameError>

The name of the header. This is a relatively expensive getter - the name is the SHA512 hash of the serialised header, so its use should be minimised.

fn verify(&self, public_key: &PublicKey) -> bool

Validates the header's signature against the provided PublicKey.

Trait Implementations

impl Encodable for MpidHeader
[src]

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>

impl Decodable for MpidHeader
[src]

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<MpidHeader, __D::Error>

impl Clone for MpidHeader
[src]

fn clone(&self) -> MpidHeader

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Hash for MpidHeader
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Eq for MpidHeader
[src]

impl PartialEq for MpidHeader
[src]

fn eq(&self, __arg_0: &MpidHeader) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &MpidHeader) -> bool

This method tests for !=.

impl Debug for MpidHeader
[src]

fn fmt(&self, formatter: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.