Exemplo n.º 1
0
 /**
  * Create a Consumer to use the given ConsumerDb, Face and other values.
  * @param face The face used for data packet and key fetching. This is only a
  * pointer to a Face object which must remain valid for the life of this
  * Consumer.
  * @param keyChain The keyChain used to verify data packets. This is only a
  * pointer to a KeyChain object which must remain valid for the life of this
  * Consumer.
  * @param groupName The reading group name that the consumer belongs to.
  * This makes a copy of the Name.
  * @param consumerName The identity of the consumer. This makes a copy of the
  * Name.
  * @param database The ConsumerDb database for storing decryption keys.
  * @param cKeyLink (optional) The Link object to use in Interests for C-KEY
  * retrieval. This makes a copy of the Link object. If the Link object's
  * getDelegations().size() is zero, don't use it. If omitted, don't use a Link
  * object.
  * @param dKeyLink (optional) The Link object to use in Interests for D-KEY
  * retrieval. This makes a copy of the Link object. If the Link object's
  * getDelegations().size() is zero, don't use it. If omitted, don't use a Link
  * object.
  */
 Consumer
   (Face* face, KeyChain* keyChain, const Name& groupName,
    const Name& consumerName, const ptr_lib::shared_ptr<ConsumerDb>& database,
    const Link& cKeyLink = getNO_LINK(), const Link& dKeyLink = getNO_LINK())
 : impl_(new Impl
     (face, keyChain, groupName, consumerName, database, cKeyLink, dKeyLink))
 {
 }
Exemplo n.º 2
0
 /**
  * Express an Interest to fetch the content packet with contentName, and
  * decrypt it, fetching keys as needed.
  * @param contentName The name of the content packet.
  * @param onConsumeComplete When the content packet is fetched and decrypted,
  * this calls onConsumeComplete(contentData, result) where contentData is the
  * fetched Data packet and result is the decrypted plain text Blob.
  * NOTE: The library will log any exceptions thrown by this callback, but for
  * better error handling the callback should catch and properly handle any
  * exceptions.
  * @param onError This calls onError(errorCode, message) for an error.
  * NOTE: The library will log any exceptions thrown by this callback, but for
  * better error handling the callback should catch and properly handle any
  * exceptions.
  * @param link (optional) The Link object to use in Interests for data
  * retrieval. This makes a copy of the Link object. If the Link object's
  * getDelegations().size() is zero, don't use it. If omitted, don't use a Link
  * object.
  */
 void
 consume
   (const Name& contentName, const OnConsumeComplete& onConsumeComplete,
    const EncryptError::OnError& onError, const Link& link = getNO_LINK())
 {
   impl_->consume(contentName, onConsumeComplete, onError, link);
 }
Exemplo n.º 3
0
 /**
  * Create a Producer to use the given ProducerDb, Face and other values.
  *
  * A producer can produce data with a naming convention:
  *   /{prefix}/SAMPLE/{dataType}/[timestamp]
  *
  * The produced data packet is encrypted with a content key,
  * which is stored in the ProducerDb database.
  *
  * A producer also needs to produce data containing a content key
  * encrypted with E-KEYs. A producer can retrieve E-KEYs through the face,
  * and will re-try for at most repeatAttemps times when E-KEY retrieval fails.
  * @param prefix The producer name prefix. This makes a copy of the Name.
  * @param dataType The dataType portion of the producer name. This makes a
  * copy of the Name.
  * @param face The face used to retrieve keys. This is only a pointer to a
  * Face object which must remain valid for the life of this Producer.
  * @param keyChain The keyChain used to sign data packets. This is only a
  * pointer to a KeyChain object which must remain valid for the life of this
  * Producer.
  * @param database The ProducerDb database for storing keys.
  * @param repeatAttempts (optional) The maximum retry for retrieving keys. If
  * omitted, use 3.
  * @param keyRetrievalLink (optional) The Link object to use in Interests for
  * key retrieval. This makes a copy of the Link object. If the Link object's
  * getDelegations().size() is zero, don't use it. If omitted, don't use a Link
  * object.
  */
 Producer
   (const Name& prefix, const Name& dataType, Face* face, KeyChain* keyChain,
    const ptr_lib::shared_ptr<ProducerDb>& database, int repeatAttempts = 3,
    const Link& keyRetrievalLink = getNO_LINK())
 : impl_(new Impl
     (prefix, dataType, face, keyChain, database, repeatAttempts,
      keyRetrievalLink))
 {
 }