org.ccnx.ccn.protocol.Interest Class Reference

Represents a CCN Interest packet, and performs all the allowed specializations of queries recognized and supported by them. More...

Inheritance diagram for org.ccnx.ccn.protocol.Interest:

org.ccnx.ccn.impl.encoding.GenericXMLEncodable org.ccnx.ccn.impl.encoding.XMLEncodable org.ccnx.ccn.impl.encoding.XMLEncodable

List of all members.

Public Member Functions

 Interest (ContentName name, PublisherID publisher)
 TODO: DKS figure out how to handle encoding faster, and how to handle shorter version of names without copying, particularly without 1.6 array ops.
 Interest (ContentName name, PublisherPublicKeyDigest publisher)
 Interest (ContentName name)
 Creates Interest with null publisher ID.
 Interest (String name) throws MalformedContentNameStringException
ContentName name ()
void name (ContentName name)
Integer maxSuffixComponents ()
void maxSuffixComponents (Integer maxSuffixComponents)
Integer minSuffixComponents ()
void minSuffixComponents (Integer minSuffixComponents)
PublisherID publisherID ()
void publisherID (PublisherID publisherID)
Exclude exclude ()
void exclude (Exclude exclude)
Integer childSelector ()
void childSelector (int childSelector)
byte[] interestLifetime ()
void interestLifetime (byte[] interestLifetime)
Integer answerOriginKind ()
void answerOriginKind (int answerOriginKind)
Integer scope ()
void scope (int scope)
byte[] nonce ()
 XXX - This isn't user settable and is only useful for ccnd internal functionality.
boolean matches (ContentObject test)
 Determine whether a piece of content matches the Interest.
boolean matches (ContentName name, PublisherPublicKeyDigest resultPublisherKeyID)
 Determine whether a piece of content's name *without* digest component matches this Interest.
boolean matches (ContentObject co, PublisherPublicKeyDigest resultPublisherKeyID)
 Determine whether a piece of content matches this Interest.
boolean isPrefixOf (ContentName name)
 Determine if this Interest's name is a prefix of the specified name.
boolean isPrefixOf (ContentName name, int count)
 Determine if this Interest's name is a prefix of the first "count" components of the input name.
boolean isPrefixOf (ContentObject other)
 Determine if this Interest's name is a prefix of the specified ContentObject's name.
void decode (XMLDecoder decoder) throws ContentDecodingException
 Thought about encoding and decoding as flat -- no wrapping declaration.
void encode (XMLEncoder encoder) throws ContentEncodingException
 Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.
long getElementLabel ()
 Allow the encoder/decoder to retrieve the top-level element name programmatically.
boolean validate ()
 Make sure all of the necessary fields are filled in prior to attempting to encode.
int compareTo (Interest o)
int hashCode ()
boolean equals (Object obj)
String toString ()
 Default toString() implementation simply prints the text encoding of the object.
Interest clone ()

Static Public Member Functions

static Interest lower (ContentName name, int level, PublisherPublicKeyDigest publisher)
 Return data a specified number of levels below us in the hierarchy, with order preference of leftmost.
static Interest next (ContentName name, Integer prefixCount, PublisherPublicKeyDigest publisher)
 Construct an Interest that will give you the next content after the argument name's first prefixCount components.
static Interest next (ContentName name, Exclude exclude, Integer prefixCount, Integer maxSuffixComponents, Integer minSuffixComponents, PublisherPublicKeyDigest publisher)
 Construct an Interest that will give you the next content after the argument names's first prefixCount components excluding the components specified in the omissions.
static Interest last (ContentName name, Integer prefixCount, PublisherPublicKeyDigest publisher)
 Construct an Interest that will give you the last content after the argument name's first prefixCount components.
static Interest last (ContentName name, Exclude exclude, Integer prefixCount, Integer maxSuffixComponents, Integer minSuffixComponents, PublisherPublicKeyDigest publisher)
 Construct an Interest that will give you the last content after the argument name excluding the components specified in the Exclude.
static Interest exclude (ContentName name, Exclude exclude, Integer maxSuffixComponents, Integer minSuffixComponents, PublisherPublicKeyDigest publisherID)
 Construct an Interest that will exclude the values in omissions and require maxSuffixComponents and minSuffixComponents as specific.
static Interest constructInterest (ContentName name, Exclude filter, Integer childSelector, Integer maxSuffixComponents, Integer minSuffixComponents, PublisherPublicKeyDigest publisher)
 Construct an Interest with specified values set.
static byte[] generateNonce ()
 Currently used as an Interest name component to disambiguate multiple requests for the same content.

Public Attributes

long userTime

Static Public Attributes

static final String RECURSIVE_POSTFIX = "*"
static final int CHILD_SELECTOR_LEFT = 0
static final int CHILD_SELECTOR_RIGHT = 1
static final int ANSWER_CONTENT_STORE = 1
 AnswerOriginKind values These are bitmapped.
static final int ANSWER_GENERATED = 2
static final int ANSWER_STALE = 4
static final int MARK_STALE = 16
static final int DEFAULT_ANSWER_ORIGIN_KIND = ANSWER_CONTENT_STORE | ANSWER_GENERATED

Protected Attributes

ContentName _name
Integer _maxSuffixComponents
Integer _minSuffixComponents
PublisherID _publisher
Exclude _exclude
Integer _childSelector
Integer _answerOriginKind = null
Integer _scope
byte[] _interestLifetime = null
byte[] _nonce

Static Protected Attributes

static Random _random = new Random()
 For nonce generation.

Classes

class  NoResponseException


Detailed Description

Represents a CCN Interest packet, and performs all the allowed specializations of queries recognized and supported by them.

cf. ContentObject

Implements Comparable to make it easy to store in a Set and avoid duplicates.


Constructor & Destructor Documentation

org.ccnx.ccn.protocol.Interest.Interest ( ContentName  name,
PublisherID  publisher 
)

TODO: DKS figure out how to handle encoding faster, and how to handle shorter version of names without copying, particularly without 1.6 array ops.

Parameters:
name ContentName of Interest
publisher PublisherID of Interest or null

org.ccnx.ccn.protocol.Interest.Interest ( ContentName  name,
PublisherPublicKeyDigest  publisher 
)

Parameters:
name ContentName of Interest
publisher PublisherPublicKeyDigest or null

org.ccnx.ccn.protocol.Interest.Interest ( ContentName  name  ) 

Creates Interest with null publisher ID.

Parameters:
name 


Member Function Documentation

byte [] org.ccnx.ccn.protocol.Interest.nonce (  ) 

XXX - This isn't user settable and is only useful for ccnd internal functionality.

Do we ever need to return it?

Returns:

boolean org.ccnx.ccn.protocol.Interest.matches ( ContentObject  test  ) 

Determine whether a piece of content matches the Interest.

Parameters:
test 
Returns:
true if the test data packet matches the Interest

boolean org.ccnx.ccn.protocol.Interest.matches ( ContentName  name,
PublisherPublicKeyDigest  resultPublisherKeyID 
)

Determine whether a piece of content's name *without* digest component matches this Interest.

This doesn't match if the digest is specified in the Interest.

See also:
Interest.matches(ContentObject, PublisherPublicKeyDigest)
Parameters:
name - Name of a content object missing it's implied digest component
resultPublisherKeyID 
Returns:
true if the content/publisherPublicKeyDigest matches the Interest

boolean org.ccnx.ccn.protocol.Interest.matches ( ContentObject  co,
PublisherPublicKeyDigest  resultPublisherKeyID 
)

Determine whether a piece of content matches this Interest.

Note: this computes the digest for the ContentObject, to know the full name. This is computationally expensive.

See also:
Interest.matches(ContentName, PublisherPublicKeyDigest) TODO: compute digests once when ContentObjects are received into the machine, and pass them around with the ContentObjects.
Parameters:
co - ContentObject
resultPublisherKeyID 
Returns:
true if the content & publisherID match the Interest

static Interest org.ccnx.ccn.protocol.Interest.lower ( ContentName  name,
int  level,
PublisherPublicKeyDigest  publisher 
) [static]

Return data a specified number of levels below us in the hierarchy, with order preference of leftmost.

Parameters:
name name prefix for interest
level number of levels below us we want content. Includes the ephemeral digest component in the count.
publisher who should have signed content (can be null)

static Interest org.ccnx.ccn.protocol.Interest.next ( ContentName  name,
Integer  prefixCount,
PublisherPublicKeyDigest  publisher 
) [static]

Construct an Interest that will give you the next content after the argument name's first prefixCount components.

Parameters:
name 
prefixCount may be null
publisher may be null
Returns:
new Interest

static Interest org.ccnx.ccn.protocol.Interest.next ( ContentName  name,
Exclude  exclude,
Integer  prefixCount,
Integer  maxSuffixComponents,
Integer  minSuffixComponents,
PublisherPublicKeyDigest  publisher 
) [static]

Construct an Interest that will give you the next content after the argument names's first prefixCount components excluding the components specified in the omissions.

Parameters:
name 
omissions components to exclude - may be null
prefixCount may be null
publisher may be null
Returns:

static Interest org.ccnx.ccn.protocol.Interest.last ( ContentName  name,
Integer  prefixCount,
PublisherPublicKeyDigest  publisher 
) [static]

Construct an Interest that will give you the last content after the argument name's first prefixCount components.

Parameters:
name 
prefixCount may be null
publisher may be null
Returns:
new Interest

static Interest org.ccnx.ccn.protocol.Interest.last ( ContentName  name,
Exclude  exclude,
Integer  prefixCount,
Integer  maxSuffixComponents,
Integer  minSuffixComponents,
PublisherPublicKeyDigest  publisher 
) [static]

Construct an Interest that will give you the last content after the argument name excluding the components specified in the Exclude.

Parameters:
name 
exclude contains components to exclude - may be null
prefixCount may be null
publisher may be null
Returns:
the Interest

static Interest org.ccnx.ccn.protocol.Interest.exclude ( ContentName  name,
Exclude  exclude,
Integer  maxSuffixComponents,
Integer  minSuffixComponents,
PublisherPublicKeyDigest  publisherID 
) [static]

Construct an Interest that will exclude the values in omissions and require maxSuffixComponents and minSuffixComponents as specific.

Parameters:
name 
omissions components to exclude
publisherID 
maxSuffixComponents 
minSuffixComponents 
Returns:
the Interest

static Interest org.ccnx.ccn.protocol.Interest.constructInterest ( ContentName  name,
Exclude  filter,
Integer  childSelector,
Integer  maxSuffixComponents,
Integer  minSuffixComponents,
PublisherPublicKeyDigest  publisher 
) [static]

Construct an Interest with specified values set.

Parameters:
name 
filter may be null
childSelector may be null
publisherID may be null
maxSuffixComponents may be null
minSuffixComponents may be null
Returns:
the Interest

static byte [] org.ccnx.ccn.protocol.Interest.generateNonce (  )  [static]

Currently used as an Interest name component to disambiguate multiple requests for the same content.

Returns:
the nonce in component form

boolean org.ccnx.ccn.protocol.Interest.isPrefixOf ( ContentName  name  ) 

Determine if this Interest's name is a prefix of the specified name.

Parameters:
name 
Returns:
true if our name is a prefix of the specified name

boolean org.ccnx.ccn.protocol.Interest.isPrefixOf ( ContentName  name,
int  count 
)

Determine if this Interest's name is a prefix of the first "count" components of the input name.

Parameters:
name 
count 
Returns:
true if our name is a prefix of the specified name's first "count" components

boolean org.ccnx.ccn.protocol.Interest.isPrefixOf ( ContentObject  other  ) 

Determine if this Interest's name is a prefix of the specified ContentObject's name.

Parameters:
other 
Returns:
true if our name is a prefix of the specified ContentObject's name

void org.ccnx.ccn.protocol.Interest.decode ( XMLDecoder  decoder  )  throws ContentDecodingException [virtual]

Thought about encoding and decoding as flat -- no wrapping declaration.

But then couldn't use these solo.

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.protocol.Interest.encode ( XMLEncoder  encoder  )  throws ContentEncodingException [virtual]

Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.

Writes just the object itself, higher-level processes have handled start and end document if need be. Allows object to be written using the same code whether it is a top-level element written alone, or nested inside another element.

Parameters:
encoder the encoder being used; encapsulates state including the codec being used as well as the output destination and current offset

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

long org.ccnx.ccn.protocol.Interest.getElementLabel (  )  [virtual]

Allow the encoder/decoder to retrieve the top-level element name programmatically.

This allows subclasses to rename elements without changing their encoder/decoders.

Returns:
the element label to use, as a key in a loaded encoding dictionary

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

boolean org.ccnx.ccn.protocol.Interest.validate (  )  [virtual]

Make sure all of the necessary fields are filled in prior to attempting to encode.

All implementations of encode(XMLEncoder) should call this for their classes prior to encoding.

Returns:
true if object is valid and can be encoded, false if there is a problem; for example mandatory fields are uninitialized

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

String org.ccnx.ccn.protocol.Interest.toString (  ) 

Default toString() implementation simply prints the text encoding of the object.

This demonstrates how to force use of the text encoding.

Reimplemented from org.ccnx.ccn.impl.encoding.GenericXMLEncodable.


Member Data Documentation

AnswerOriginKind values These are bitmapped.

Default is 3. 2 is not allowed


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:07 2012 for Content-Centric Networking in Java by  doxygen 1.5.6