Skip to content
Browse files

init

  • Loading branch information...
0 parents commit a7ee82814a6907c4286fc1bbbe69e3b2f1cd96a4 Tom committed Aug 22, 2010
Showing with 104 additions and 0 deletions.
  1. +27 −0 LICENSE
  2. +40 −0 Network/CCN.hs
  3. +37 −0 ccn.cabal
27 LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) Tom Hawkins 2010
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
40 Network/CCN.hs
@@ -0,0 +1,40 @@
+module Network.CCN
+ ( Message (..)
+ , Interest (..)
+ , Content (..)
+ , Qualifier (..)
+ , Author
+ , Title
+ , Signature
+ , Timestamp
+ ) where
+
+import Data.ByteString (ByteString)
+import Data.Word
+
+-- | Globally unique name associated with author of content. Each author has a public key.
+type Author = String
+
+-- | Unique name of content by the author. Author + Title = Globally unqiue content name.
+type Title = String
+
+-- | Signature algorithm: hash author, title, timestamps, and content, then encrypt/decrypt with private/public key.
+type Signature = String
+type Timestamp = Word64
+
+-- | An interest message consists of a content name (author + title) and a list of qualifications.
+data Interest = Interest Author Title [Qualifier]
+
+-- | A content message is the author, title, timestamp of content creation, time when to mark stale, the content, and the signature.
+data Content = Content Author Title Timestamp (Maybe Timestamp) ByteString Signature
+
+-- | Content qualifiers in 'Interest' messages.
+data Qualifier
+ = SignatureIs Signature -- ^ 'Content' signature equals ...
+ | TimestampGT Timestamp -- ^ 'Content' timestamp is greater than...
+ | TimestampLT Timestamp -- ^ 'Content' timestamp is less than...
+
+data Message
+ = InterestMessage Interest
+ | ContentMessage Content
+
37 ccn.cabal
@@ -0,0 +1,37 @@
+name: improve
+version: 0.0.0
+
+category: Network
+
+synopsis: TODO
+
+description:
+ TODO
+
+author: Tom Hawkins <tomahawkins@gmail.com>
+maintainer: Tom Hawkins <tomahawkins@gmail.com>
+
+license: BSD3
+license-file: LICENSE
+
+homepage: http://tomahawkins.org
+
+build-type: Simple
+cabal-version: >= 1.6
+
+library
+ build-depends:
+ base >= 4.2 && < 5,
+ bytestring >= 0.9.1.6 && < 0.9.2
+
+ exposed-modules:
+ Network.CCN
+
+ extensions:
+
+ ghc-options: -W
+
+source-repository head
+ type: git
+ location: git://github.com/tomahawkins/ccn.git
+

0 comments on commit a7ee828

Please sign in to comment.
Something went wrong with that request. Please try again.