├── .travis.d ├── .gitignore ├── id-rsa.enc └── id-rsa.pub ├── pytest.ini ├── doc ├── make-apidoc.sh ├── index.rst ├── pyndn.in_memory_storage.rst ├── Makefile ├── pyndn.security.pib.detail.rst ├── pyndn.lp.rst ├── pyndn.encoding.der.rst ├── make.bat ├── pyndn.security.certificate.rst ├── pyndn.impl.rst ├── pyndn.encoding.tlv.rst ├── pyndn.encrypt.algo.rst ├── pyndn.sync.detail.rst ├── pyndn.security.v2.validator_config.rst ├── pyndn.security.policy.rst ├── pyndn.sync.rst ├── pyndn.transport.rst └── pyndn.encoding.rst ├── autogen.sh ├── tests ├── integration_tests │ ├── policy_config │ │ ├── hierarchical_ruleset.conf │ │ ├── testData │ │ ├── relation_ruleset_prefix.conf │ │ ├── relation_ruleset_equal.conf │ │ ├── relation_ruleset_strict.conf │ │ ├── certs │ │ │ ├── anchor.cert │ │ │ └── anchor.cert-v2 │ │ ├── simple_rules.conf │ │ ├── regex_ruleset.conf │ │ └── hyperrelation_ruleset.conf │ └── __init__.py └── unit_tests │ └── __init__.py ├── examples ├── chatbuf.proto ├── channel-status.proto ├── fib-entry.proto ├── rib-entry.proto ├── repo_ng │ ├── repo-command-response.proto │ └── repo-command-parameter.proto ├── face-query-filter.proto ├── face-status.proto └── control-parameters.proto ├── python └── pyndn │ ├── lp │ └── __init__.py │ ├── util │ ├── regex │ │ ├── __init__.py │ │ ├── ndn_regex_pseudo_matcher.py │ │ ├── ndn_regex_backref_manager.py │ │ └── ndn_regex_backref_matcher.py │ └── __init__.py │ ├── encoding │ ├── tlv │ │ └── __init__.py │ ├── __init__.py │ ├── der │ │ ├── __init__.py │ │ ├── der_exceptions.py │ │ └── der.py │ ├── tlv_0_1_wire_format.py │ ├── tlv_0_1_1_wire_format.py │ ├── oid.py │ └── tlv_wire_format.py │ ├── sync │ ├── sync-state.proto │ ├── detail │ │ └── __init__.py │ ├── psync_missing_data_info.py │ └── __init__.py │ ├── contrib │ ├── __init__.py │ └── cocoapy │ │ ├── LICENSE │ │ └── __init__.py │ ├── security │ ├── pib │ │ ├── __init__.py │ │ └── detail │ │ │ └── __init__.py │ ├── tpm │ │ └── __init__.py │ ├── v2 │ │ ├── validator_config │ │ │ └── __init__.py │ │ ├── certificate_container_interface.py │ │ ├── validation_policy_accept_all.py │ │ ├── certificate_fetcher_offline.py │ │ └── certificate_request.py │ ├── certificate │ │ └── __init__.py │ ├── validator_config_error.py │ ├── security_types.py │ ├── key_id_type.py │ ├── validator_null.py │ ├── security_exception.py │ ├── policy │ │ ├── __init__.py │ │ └── validation_request.py │ ├── __init__.py │ └── identity │ │ └── __init__.py │ ├── impl │ └── __init__.py │ ├── in_memory_storage │ └── __init__.py │ ├── transport │ └── __init__.py │ ├── encrypt │ ├── algo │ │ └── __init__.py │ ├── decrypt_key.py │ └── encrypt_key.py │ └── forwarding_flags.py ├── contrib └── murmur-hash │ ├── murmur-hash.h │ └── murmur-hash.c ├── .travis.yml ├── src ├── c │ ├── util │ │ ├── ndn_realloc.c │ │ ├── blob_c.c │ │ ├── ndn_realloc.h │ │ └── ndn_memory.c │ ├── encoding │ │ ├── tlv │ │ │ ├── tlv-lp-packet.h │ │ │ └── tlv-signature-info.h │ │ ├── element-listener.h │ │ └── tlv-0_3-wire-format_c.c │ ├── encrypt │ │ └── algo │ │ │ └── encrypt-params.h │ ├── registration-options.c │ ├── control-parameters_c.c │ ├── network-nack_c.c │ └── lp │ │ ├── congestion-mark_c.c │ │ └── incoming-face-id_c.c ├── lite │ ├── meta-info-lite.cpp │ ├── lp │ │ ├── lp-packet-lite.cpp │ │ ├── congestion-mark-lite.cpp │ │ └── incoming-face-id-lite.cpp │ ├── encrypt │ │ ├── algo │ │ │ └── encrypt-params-lite.cpp │ │ └── encrypted-content-lite.cpp │ ├── key-locator-lite.cpp │ ├── encoding │ │ ├── element-listener-lite.cpp │ │ └── tlv-0_2-wire-format-lite.cpp │ ├── control-response-lite.cpp │ ├── data-lite.cpp │ ├── signature-lite.cpp │ ├── delegation-set-lite.cpp │ ├── network-nack-lite.cpp │ ├── registration-options-lite.cpp │ ├── control-parameters-lite.cpp │ ├── util │ │ ├── blob-lite.cpp │ │ └── dynamic-uint8-array-lite.cpp │ └── security │ │ └── validity-period-lite.cpp └── py-object-ref.hpp ├── .gitignore └── include └── ndn-cpp ├── c ├── security │ ├── ec-public-key-types.h │ ├── rsa-public-key-types.h │ ├── rsa-private-key-types.h │ ├── ec-private-key-types.h │ └── validity-period-types.h ├── delegation-set-types.h ├── lp │ ├── congestion-mark-types.h │ └── incoming-face-id-types.h ├── util │ └── blob-types.h ├── forwarding-flags.h ├── transport │ └── transport-types.h ├── registration-options-types.h ├── control-response-types.h ├── key-types.h ├── encrypt │ ├── encrypted-content-types.h │ └── algo │ │ └── encrypt-params-types.h └── network-nack-types.h └── lite └── encoding └── tlv-0_1_1-wire-format-lite.hpp /.travis.d/.gitignore: -------------------------------------------------------------------------------- 1 | id-rsa 2 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = tests/unit_tests 3 | -------------------------------------------------------------------------------- /.travis.d/id-rsa.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/named-data/PyNDN2/HEAD/.travis.d/id-rsa.enc -------------------------------------------------------------------------------- /doc/make-apidoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sphinx-apidoc -f -F -H PyNDN -A 'Regents of the University of California' -V 2.1 -o . ../python ../python/pyndn/contrib 3 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | test -n "$srcdir" || srcdir=`dirname "$0"` 4 | test -n "$srcdir" || srcdir=. 5 | autoreconf --force --install --verbose "$srcdir" 6 | # Don't run ./configure since the user may want to run ./configure with options. 7 | echo "" ; echo "You need to run ./configure again." 8 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/hierarchical_ruleset.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | rule 4 | { 5 | id "Another Rule" 6 | for data 7 | filter 8 | { 9 | type name 10 | regex "^" 11 | } 12 | checker 13 | { 14 | type hierarchical 15 | sig-type rsa-sha256 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/chatbuf.proto: -------------------------------------------------------------------------------- 1 | package SyncDemo; 2 | 3 | message ChatMessage { 4 | required string to = 1; 5 | required string from = 2; 6 | enum ChatMessageType { 7 | CHAT = 0; 8 | HELLO = 1; 9 | LEAVE = 2; 10 | JOIN = 3; 11 | OTHER = 4; 12 | } 13 | required ChatMessageType type = 3 [default = CHAT]; 14 | optional string data = 4; 15 | required int32 timestamp = 5; 16 | } 17 | -------------------------------------------------------------------------------- /.travis.d/id-rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCghPR0z4LB+TdSDYvdIiPbcRc9vmTaQpG/KR2XfHwZm4unGSB742q7A9LlFvk4nwfNDQuK22YUB77gNxBQRi1nTB+q+AZ4XzFZ3u/8+8al7wTvZZrL2spDzjkcidfuqcBSwluSzyohk4TGzic1Hx/GFV8qg7+TJUWG5xAkC460YG3QcGagbI9av5L+NeQjtiabO7HlYP8K+ayXTGpiFaJ00jGoOdIAJIIKtlJ9Yb7Gn8vSPPq/XD07GbqalK8wwfbF60Bpmh8G1+miXUFAZyh5b1PA4xisEaMLxuCRGHJUq04uT5GIu/KHbU6J9eqaMIOZtITtz4BuNi0lrUObJUxb cawka@cawkaMac.local 2 | -------------------------------------------------------------------------------- /python/pyndn/lp/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # See COPYING for copyright and distribution information. 6 | 7 | # Don't include internal modules. 8 | __all__ = [] 9 | 10 | import sys as _sys 11 | 12 | try: 13 | pass 14 | except ImportError: 15 | del _sys.modules[__name__] 16 | raise 17 | -------------------------------------------------------------------------------- /python/pyndn/util/regex/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # See COPYING for copyright and distribution information. 6 | 7 | # Don't include internal modules. 8 | __all__ = [] 9 | 10 | import sys as _sys 11 | 12 | try: 13 | pass 14 | except ImportError: 15 | del _sys.modules[__name__] 16 | raise 17 | -------------------------------------------------------------------------------- /python/pyndn/encoding/tlv/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # See COPYING for copyright and distribution information. 6 | 7 | # Don't include internal modules. 8 | __all__ = [] 9 | 10 | import sys as _sys 11 | 12 | try: 13 | pass 14 | except ImportError: 15 | del _sys.modules[__name__] 16 | raise 17 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/testData: -------------------------------------------------------------------------------- 1 | Bv0BXAcMCAR0ZW1wCAR0ZXN0FAAVFlRoaXMgaXMgc29tZSB0ZXN0IGRhdGEWLhsBARwpBycIBHRlbXAIA0tFWQgRa3NrLTE0MTQxOTU3Nzk2NjUIB0lELUNFUlQX/QEAGb5kqcevg7m3tABnZcKeWC0CZZZVt+fHN0F/Xe6lOq080dnT8j1jAyUHktZ9nH/5LgzYBNW04xOFFf9FXwbO3QLmfZ3iKnzbnHhyxm9baeTaFun6cQM/1cAXO0nS5tvNBsZRdACWQYTQCIX7SKKp3dCHLC/2vS+vVpTXFpL789pe+iuOaRmvTrBiHcEOGFYwDISvXkNxkN8Bx7sG9voThqCb3jixTATBf55/I+16O7M0BYYCvqhJCLdMJKdKsEKwGcoAaz/KyLvx8wJthM245GawkJ0yCWhu/SxHwBqafs2JPp7HXIJpZnCeM4+zIUmb3T68DkBKcOLsL6XTP6QEuA== -------------------------------------------------------------------------------- /python/pyndn/sync/sync-state.proto: -------------------------------------------------------------------------------- 1 | package Sync; 2 | 3 | message SyncState 4 | { 5 | required string name = 1; 6 | enum ActionType 7 | { 8 | UPDATE = 0; 9 | DELETE = 1; 10 | OTHER = 2; 11 | } 12 | required ActionType type = 2; 13 | message SeqNo 14 | { 15 | required uint64 seq = 1; 16 | required uint64 session = 2; 17 | } 18 | optional SeqNo seqno = 3; 19 | optional bytes application_info = 4; 20 | } 21 | 22 | message SyncStateMsg 23 | { 24 | repeated SyncState ss = 1; 25 | } 26 | -------------------------------------------------------------------------------- /examples/channel-status.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. channel-status.proto 3 | 4 | package ndn_message; 5 | 6 | // Protobuf has no "outer" message type, so we need to put the TLV ChannelStatus 7 | // message inside an outer "typeless" ChannelStatusMessage. 8 | message ChannelStatusMessage { 9 | message ChannelStatus { 10 | required string local_uri = 129; 11 | } 12 | 13 | // A ChannelStatusMessage has repeated ChannelStatus. 14 | repeated ChannelStatus channel_status = 130; 15 | } 16 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. PyNDN documentation master file, created by 2 | sphinx-quickstart on Tue Mar 5 15:11:41 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to PyNDN's documentation! 7 | ================================= 8 | 9 | .. toctree:: 10 | :maxdepth: 4 11 | :caption: Contents: 12 | 13 | pyndn 14 | 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/relation_ruleset_prefix.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | rule 4 | { 5 | id "A rule" 6 | for data 7 | filter 8 | { 9 | type name 10 | name /TestRule1/ 11 | relation is-prefix-of 12 | } 13 | checker 14 | { 15 | type customized 16 | sig-type rsa-sha256 17 | key-locator 18 | { 19 | type name 20 | name /SecurityTestSecRule 21 | relation is-prefix-of 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/relation_ruleset_equal.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | rule 4 | { 5 | id "A very strict rule" 6 | for data 7 | filter 8 | { 9 | type name 10 | name /TestRule1/ 11 | relation equal 12 | } 13 | checker 14 | { 15 | type customized 16 | sig-type rsa-sha256 17 | key-locator 18 | { 19 | type name 20 | name /SecurityTestSecRule 21 | relation is-prefix-of 22 | } 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/relation_ruleset_strict.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | rule 4 | { 5 | id "A strict rule" 6 | for data 7 | filter 8 | { 9 | type name 10 | name /TestRule1/ 11 | relation is-strict-prefix-of 12 | } 13 | checker 14 | { 15 | type customized 16 | sig-type rsa-sha256 17 | key-locator 18 | { 19 | type name 20 | name /SecurityTestSecRule 21 | relation is-prefix-of 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /doc/pyndn.in_memory_storage.rst: -------------------------------------------------------------------------------- 1 | pyndn.in\_memory\_storage package 2 | ================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.in\_memory\_storage.in\_memory\_storage\_retaining module 8 | --------------------------------------------------------------- 9 | 10 | .. automodule:: pyndn.in_memory_storage.in_memory_storage_retaining 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: pyndn.in_memory_storage 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = PyNDN 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /examples/fib-entry.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. fib-entry.proto 3 | 4 | package ndn_message; 5 | 6 | // Protobuf has no "outer" message type, so we need to put the TLV FibEntry 7 | // message inside an outer "typeless" FibEntryMessage. 8 | message FibEntryMessage { 9 | message Name { 10 | repeated bytes component = 8; 11 | } 12 | 13 | message NextHopRecord { 14 | required uint32 face_id = 105; 15 | required uint32 cost = 106; 16 | } 17 | 18 | message FibEntry { 19 | required Name name = 7; 20 | repeated NextHopRecord next_hop_records = 129; 21 | } 22 | 23 | // A FibEntryMessage has one FibEntry. 24 | required FibEntry fib_entry = 128; 25 | } 26 | -------------------------------------------------------------------------------- /doc/pyndn.security.pib.detail.rst: -------------------------------------------------------------------------------- 1 | pyndn.security.pib.detail package 2 | ================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.security.pib.detail.pib\_identity\_impl module 8 | ---------------------------------------------------- 9 | 10 | .. automodule:: pyndn.security.pib.detail.pib_identity_impl 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.security.pib.detail.pib\_key\_impl module 16 | ----------------------------------------------- 17 | 18 | .. automodule:: pyndn.security.pib.detail.pib_key_impl 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: pyndn.security.pib.detail 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /examples/rib-entry.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. rib-entry.proto 3 | 4 | package ndn_message; 5 | 6 | // Protobuf has no "outer" message type, so we need to put the TLV RibEntry 7 | // message inside an outer "typeless" RibEntryMessage. 8 | message RibEntryMessage { 9 | message Name { 10 | repeated bytes component = 8; 11 | } 12 | 13 | message Route { 14 | required uint32 face_id = 105; 15 | required uint32 origin = 111; 16 | required uint32 cost = 106; 17 | required uint32 flags = 108; 18 | optional uint32 expiration_period = 109; 19 | } 20 | 21 | message RibEntry { 22 | required Name name = 7; 23 | repeated Route routes = 129; 24 | } 25 | 26 | // A RibEntryMessage has repeated RibEntry. 27 | repeated RibEntry rib_entry = 128; 28 | } 29 | -------------------------------------------------------------------------------- /doc/pyndn.lp.rst: -------------------------------------------------------------------------------- 1 | pyndn.lp package 2 | ================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.lp.congestion\_mark module 8 | -------------------------------- 9 | 10 | .. automodule:: pyndn.lp.congestion_mark 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.lp.incoming\_face\_id module 16 | ---------------------------------- 17 | 18 | .. automodule:: pyndn.lp.incoming_face_id 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.lp.lp\_packet module 24 | -------------------------- 25 | 26 | .. automodule:: pyndn.lp.lp_packet 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: pyndn.lp 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /contrib/murmur-hash/murmur-hash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * murmurHash3 was written by Austin Appleby, and is placed in the public 3 | * domain. The author hereby disclaims copyright to this source code. 4 | * https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp 5 | */ 6 | 7 | #ifndef NDN_MURMUR_HASH_H 8 | #define NDN_MURMUR_HASH_H 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /** 17 | * Compute the MurmurHash3 of the data. 18 | * @param nHashSeed The hash seed. 19 | * @param dataToHash A pointer to the input byte array to hash. 20 | * @param dataToHashLength The length of the data to hash. 21 | * @return The hash value. 22 | */ 23 | uint32_t 24 | ndn_murmurHash3 25 | (uint32_t nHashSeed, const uint8_t* dataToHash, size_t dataToHashLength); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /doc/pyndn.encoding.der.rst: -------------------------------------------------------------------------------- 1 | pyndn.encoding.der package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.encoding.der.der module 8 | ----------------------------- 9 | 10 | .. automodule:: pyndn.encoding.der.der 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.encoding.der.der\_exceptions module 16 | ----------------------------------------- 17 | 18 | .. automodule:: pyndn.encoding.der.der_exceptions 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.encoding.der.der\_node module 24 | ----------------------------------- 25 | 26 | .. automodule:: pyndn.encoding.der.der_node 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: pyndn.encoding.der 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /examples/repo_ng/repo-command-response.proto: -------------------------------------------------------------------------------- 1 | // This is the Protobuf definition for RepoCommandResponse, described at: 2 | // http://redmine.named-data.net/projects/repo-ng/wiki/Repo_Command 3 | // Compile this file using: 4 | // protoc --python_out=. repo-command-response.proto 5 | 6 | package ndn_message; 7 | 8 | // Protobuf has no "outer" message type, so we need to put the TLV RepoCommandResponse 9 | // message inside an outer "typeless" RepoCommandResponseMessage. 10 | message RepoCommandResponseMessage { 11 | message RepoCommandResponse { 12 | optional uint64 process_id = 206; 13 | required uint64 status_code = 208; 14 | optional uint64 start_block_id = 204; 15 | optional uint64 end_block_id = 205; 16 | optional uint64 insert_num = 209; 17 | optional uint64 delete_num = 210; 18 | } 19 | 20 | // A RepoCommandResponseMessage has one RepoCommandResponse. 21 | required RepoCommandResponse repo_command_response = 207; 22 | } 23 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=PyNDN 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /python/pyndn/contrib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | -------------------------------------------------------------------------------- /doc/pyndn.security.certificate.rst: -------------------------------------------------------------------------------- 1 | pyndn.security.certificate package 2 | ================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.security.certificate.certificate module 8 | --------------------------------------------- 9 | 10 | .. automodule:: pyndn.security.certificate.certificate 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.security.certificate.identity\_certificate module 16 | ------------------------------------------------------- 17 | 18 | .. automodule:: pyndn.security.certificate.identity_certificate 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.security.certificate.public\_key module 24 | --------------------------------------------- 25 | 26 | .. automodule:: pyndn.security.certificate.public_key 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: pyndn.security.certificate 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /examples/face-query-filter.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. face-query-filter.proto 3 | 4 | package ndn_message; 5 | 6 | // Protobuf has no "outer" message type, so we need to put the TLV FaceQueryFilter 7 | // message inside an outer "typeless" FaceQueryFilterMessage. 8 | message FaceQueryFilterMessage { 9 | enum FaceScope { 10 | NON_LOCAL = 0; 11 | LOCAL = 1; 12 | } 13 | 14 | enum FacePersistency { 15 | PERSISTENT = 0; 16 | ON_DEMAND = 1; 17 | PERMANENT = 2; 18 | } 19 | 20 | enum LinkType { 21 | POINT_TO_POINT = 0; 22 | MULTI_ACCESS = 1; 23 | } 24 | 25 | message FaceQueryFilter { 26 | optional uint64 face_id = 105; 27 | optional string uri_scheme = 131; 28 | optional string uri = 114; 29 | optional string local_uri = 129; 30 | optional FaceScope face_scope = 132; 31 | optional FacePersistency face_persistency = 133; 32 | optional LinkType link_type = 134; 33 | } 34 | 35 | // A FaceQueryFilterMessage has repeated FaceQueryFilter. 36 | repeated FaceQueryFilter face_query_filter = 150; 37 | } 38 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/certs/anchor.cert: -------------------------------------------------------------------------------- 1 | Bv0DIQdHCBdUZXN0Q29uZmlnUG9saWN5TWFuYWdlcggEdGVtcAgDS0VZCA5rc2stMTQxNjAxMDEyMwgHSUQtQ0VSVAgIAAABSbDXRm8UAxgBAhX9AYUwggGBMCIYDzIwMTQxMTE1MDAyNTM4WhgPMjAxNDEyMTUwMDI1MzhaMDUwMwYDVQQpEywvVGVzdENvbmZpZ1BvbGljeU1hbmFnZXIvdGVtcC9rc2stMTQxNjAxMDEyMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANRP2a560oeAZxExuFusi1/yISgscOxm6RjuXvHj7wnLXuDN5DlqP0MqPhoG8sywD1vYoT8cuPqMpL+gV2HLNakPVnZXBaRWkGQ9Dm4kQ15UAplbvgWryfu3jxfLWcBCR3mxuFyX76tlIYi9WD6ajneEbD0acXq1m8Te5SQYYmFYQBRlbY+kgj6+6Xr6VJ2a05NEXGKaJl5rTLUV5OlLTwbXWUb8Sz4JAQvUqMs5FU0FDz8IUY46IH6zAXvg6z1i3AqeY1fNaNi+/z48M2wN2LVO3+vvO326MsBTSH53kcd6Lbivi+eMDqk5SdylTn07yb8YQV7AVU+QZvsZyEsRk/8CAwEAARZEGwEBHD8HPQgXVGVzdENvbmZpZ1BvbGljeU1hbmFnZXIIBHRlbXAIA0tFWQgOa3NrLTE0MTYwMTAxMjMIB0lELUNFUlQX/QEAqO9vDnZTnyInuwLvJfwAKeuvHN8hW0fndPG9sa87p6E0qFA5IUb98TbOy3Hm7ybMXT0Bur1yFyLMwdSeQmLCmo0to0hkVKKwfvfN4L9zDCYE0E0RyBpFgI5+ZprxTIBHaMOA1KRvaeIKHeUaSkqTh2BhUNSi+9zp8w/KzYSYiA1FRw0gLMkarg8w8B6rOWcNfZFPnKhMItOw0Gm0Pz2UIBhA9stmiGvXqa/uvC5yBFfOEtltdN8g+IoAaZcRs7vDzYPOCzW/YueN7KTbi+YrohPzuzqoE/Y7jxDdOVW4XU98CSmS/VFLrcToeEI0X6Z18qRY31BH8mrdWa9B/AxVOg== -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/certs/anchor.cert-v2: -------------------------------------------------------------------------------- 1 | Bv0C5wdFCBdUZXN0Q29uZmlnUG9saWN5TWFuYWdlcggEdGVtcAgDS0VZCA5rc2st 2 | MTQxNjAxMDEyMwgEc2VsZggJ/QAAAVwOQy0YFAkYAQIZBAA27oAV/QEmMIIBIjAN 3 | BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuAmnWYKE7E8G+hyy4TiTU7t91KyI 4 | GvglEeT6HWEkW4LKzXLO22a1jVS9+yP96I6vp7N5vpS1t7oXtgWuzkO+O85u6gfb 5 | vwp+67zJe2I89eHO4dmNnP4fx/j7WcCUCyzZfbyW67h5IoouoBIdQge2Xdvh9rFd 6 | ex9UUhyjEZv5676zlcqlhz8xGBrJmQHsqpD9ijY1XhKBvoSIoQ0ZKkpmwVk8QYM9 7 | PbjUqzSQBj4aYXS+BPV6aRudVvyDt2DBXp2FNP0CGrosCXKnSl4Yv8BYp0k0RmFZ 8 | DuJuntLb/XIvPEfMX5li7g3zHzAlIJIVSwT+FRkd3H5cECFSIZFUYIuSQQIDAQAB 9 | FmUbAQEcNgc0CBdUZXN0Q29uZmlnUG9saWN5TWFuYWdlcggEdGVtcAgDS0VZCA5r 10 | c2stMTQxNjAxMDEyM/0A/Sb9AP4PMjAxNzEyMDFUMTc0MTI4/QD/DzIwMzcxMTI2 11 | VDE3NDEyNxf9AQA4sGQi2+ji/a2c1A2vWhZA9j9bZAe/hxY55BM9beZN0HktIVk0 12 | OOZmz7p5p29aO9zgrqsKb/H8oCSGv5F340KUGLixlJ9CaNLnBsn2BfZ4la2OrVO1 13 | 2JY/TPqzscrWzZgSwAGhuu8XJrdlsPhVPK/3fMnhmMZYyA8P+YD5JIZaHMiHm21/ 14 | 3i4hWT0TqOEAw9CcILU6IWljT21Xs0bY9Ay6c8CzKYDDTa7p8FMzANRGjeOECWv+ 15 | 4elVRbHxAu0RYgH6+39JzUs6oT0xu9KsIe9j3naAmzawuDYFUc3eDxVRYva6YKYb 16 | m5fm8bhWjgRXKLhG5lzqzwHBSb3g6vWtuNmo 17 | 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | language: python 3 | python: 4 | - "2.7" 5 | - "3.4" 6 | - "3.5" 7 | - "3.6" 8 | - "3.7" 9 | - "3.8" 10 | - "pypy" 11 | - "pypy3" 12 | matrix: 13 | allow_failures: 14 | - python: "pypy" 15 | - python: "pypy3" 16 | fast_finish: true 17 | 18 | install: 19 | - pip install ".[test]" 20 | 21 | script: 22 | - pytest 23 | 24 | jobs: 25 | include: 26 | - stage: build & deploy docs 27 | if: branch = master AND fork = false AND type = push 28 | python: "2.7" 29 | install: 30 | - pip install ".[doc]" 31 | script: 32 | - make -C doc html 33 | after_success: 34 | - ssh-keyscan -H $HOSTNAME 2>&1 | tee -a $HOME/.ssh/known_hosts 35 | - openssl aes-256-cbc -K $encrypted_e73ed2842ced_key -iv $encrypted_e73ed2842ced_iv -in .travis.d/id-rsa.enc -out .travis.d/id-rsa -d 36 | - mkdir -p ~/.ssh && mv .travis.d/id-rsa ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa 37 | - rsync -arv --delete --progress doc/_build/html/ $USERNAME@$HOSTNAME:/var/www/named-data.net/www/doc/ndn-ccl/latest/PyNDN2 38 | # TODO: sync tagged versions 39 | -------------------------------------------------------------------------------- /doc/pyndn.impl.rst: -------------------------------------------------------------------------------- 1 | pyndn.impl package 2 | ================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.impl.delayed\_call\_table module 8 | -------------------------------------- 9 | 10 | .. automodule:: pyndn.impl.delayed_call_table 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.impl.interest\_filter\_table module 16 | ----------------------------------------- 17 | 18 | .. automodule:: pyndn.impl.interest_filter_table 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.impl.pending\_interest\_table module 24 | ------------------------------------------ 25 | 26 | .. automodule:: pyndn.impl.pending_interest_table 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.impl.registered\_prefix\_table module 32 | ------------------------------------------- 33 | 34 | .. automodule:: pyndn.impl.registered_prefix_table 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: pyndn.impl 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /tests/unit_tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | __all__ = [] 21 | 22 | import sys as _sys 23 | 24 | try: 25 | pass 26 | except ImportError: 27 | del _sys.modules[__name__] 28 | raise 29 | -------------------------------------------------------------------------------- /doc/pyndn.encoding.tlv.rst: -------------------------------------------------------------------------------- 1 | pyndn.encoding.tlv package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.encoding.tlv.tlv module 8 | ----------------------------- 9 | 10 | .. automodule:: pyndn.encoding.tlv.tlv 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.encoding.tlv.tlv\_decoder module 16 | -------------------------------------- 17 | 18 | .. automodule:: pyndn.encoding.tlv.tlv_decoder 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.encoding.tlv.tlv\_encoder module 24 | -------------------------------------- 25 | 26 | .. automodule:: pyndn.encoding.tlv.tlv_encoder 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.encoding.tlv.tlv\_structure\_decoder module 32 | ------------------------------------------------- 33 | 34 | .. automodule:: pyndn.encoding.tlv.tlv_structure_decoder 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: pyndn.encoding.tlv 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /python/pyndn/security/pib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | __all__ = [] 21 | 22 | import sys as _sys 23 | 24 | try: 25 | pass 26 | except ImportError: 27 | del _sys.modules[__name__] 28 | raise 29 | -------------------------------------------------------------------------------- /python/pyndn/security/tpm/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | __all__ = [] 21 | 22 | import sys as _sys 23 | 24 | try: 25 | pass 26 | except ImportError: 27 | del _sys.modules[__name__] 28 | raise 29 | -------------------------------------------------------------------------------- /tests/integration_tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | __all__ = [] 21 | 22 | import sys as _sys 23 | 24 | try: 25 | pass 26 | except ImportError: 27 | del _sys.modules[__name__] 28 | raise 29 | -------------------------------------------------------------------------------- /doc/pyndn.encrypt.algo.rst: -------------------------------------------------------------------------------- 1 | pyndn.encrypt.algo package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.encrypt.algo.aes\_algorithm module 8 | ---------------------------------------- 9 | 10 | .. automodule:: pyndn.encrypt.algo.aes_algorithm 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.encrypt.algo.encrypt\_params module 16 | ----------------------------------------- 17 | 18 | .. automodule:: pyndn.encrypt.algo.encrypt_params 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.encrypt.algo.encryptor module 24 | ----------------------------------- 25 | 26 | .. automodule:: pyndn.encrypt.algo.encryptor 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.encrypt.algo.rsa\_algorithm module 32 | ---------------------------------------- 33 | 34 | .. automodule:: pyndn.encrypt.algo.rsa_algorithm 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: pyndn.encrypt.algo 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /python/pyndn/security/pib/detail/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | __all__ = [] 21 | 22 | import sys as _sys 23 | 24 | try: 25 | pass 26 | except ImportError: 27 | del _sys.modules[__name__] 28 | raise 29 | -------------------------------------------------------------------------------- /python/pyndn/encoding/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # See COPYING for copyright and distribution information. 6 | 7 | # Don't include internal modules. 8 | from pyndn.encoding import tlv_0_1_wire_format, tlv_0_1_1_wire_format 9 | from pyndn.encoding import tlv_0_3_wire_format 10 | from pyndn.encoding import tlv_0_2_wire_format, tlv_wire_format, wire_format 11 | __all__ = ['tlv_0_1_wire_format', 'tlv_0_1_1_wire_format', 'tlv_0_2_wire_format', 12 | 'tlv_0_3_wire_format', 'tlv_wire_format', 'wire_format'] 13 | 14 | import sys as _sys 15 | 16 | try: 17 | from pyndn.encoding.protobuf_tlv import * 18 | from pyndn.encoding.tlv_0_1_wire_format import * 19 | from pyndn.encoding.tlv_0_1_1_wire_format import * 20 | from pyndn.encoding.tlv_0_2_wire_format import * 21 | from pyndn.encoding.tlv_0_3_wire_format import * 22 | from pyndn.encoding.tlv_wire_format import * 23 | from pyndn.encoding.wire_format import * 24 | except ImportError: 25 | del _sys.modules[__name__] 26 | raise 27 | -------------------------------------------------------------------------------- /python/pyndn/impl/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2016-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | # Don't include internal modules. 21 | __all__ = [] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | pass 27 | except ImportError: 28 | del _sys.modules[__name__] 29 | raise 30 | -------------------------------------------------------------------------------- /python/pyndn/sync/detail/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | # Don't include internal modules. 21 | __all__ = [] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | pass 27 | except ImportError: 28 | del _sys.modules[__name__] 29 | raise 30 | -------------------------------------------------------------------------------- /python/pyndn/security/v2/validator_config/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | # Don't include internal modules. 21 | __all__ = [] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | pass 27 | except ImportError: 28 | del _sys.modules[__name__] 29 | raise 30 | -------------------------------------------------------------------------------- /doc/pyndn.sync.detail.rst: -------------------------------------------------------------------------------- 1 | pyndn.sync.detail package 2 | ========================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.sync.detail.invertible\_bloom\_lookup\_table module 8 | --------------------------------------------------------- 9 | 10 | .. automodule:: pyndn.sync.detail.invertible_bloom_lookup_table 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.sync.detail.psync\_segment\_publisher module 16 | -------------------------------------------------- 17 | 18 | .. automodule:: pyndn.sync.detail.psync_segment_publisher 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.sync.detail.psync\_state module 24 | ------------------------------------- 25 | 26 | .. automodule:: pyndn.sync.detail.psync_state 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.sync.detail.psync\_user\_prefixes module 32 | ---------------------------------------------- 33 | 34 | .. automodule:: pyndn.sync.detail.psync_user_prefixes 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: pyndn.sync.detail 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /src/c/util/ndn_realloc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include 22 | #include "ndn_realloc.h" 23 | 24 | uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length) 25 | { 26 | return (uint8_t *)realloc(array, length); 27 | } 28 | -------------------------------------------------------------------------------- /examples/face-status.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. face-status.proto 3 | 4 | package ndn_message; 5 | 6 | // Protobuf has no "outer" message type, so we need to put the TLV FaceStatus 7 | // message inside an outer "typeless" FaceStatusMessage. 8 | message FaceStatusMessage { 9 | message FaceStatus { 10 | required uint64 face_id = 105; 11 | required string uri = 114; 12 | required string local_uri = 129; 13 | optional uint64 expiration_period = 109; 14 | required uint64 face_scope = 132; 15 | required uint64 face_persistency = 133; 16 | required uint64 link_type = 134; 17 | optional uint64 base_congestion_marking_interval = 135; 18 | optional uint64 default_congestion_threshold = 136; 19 | optional uint64 mtu = 137; 20 | required uint64 n_in_interests = 144; 21 | required uint64 n_in_datas = 145; 22 | required uint64 n_in_nacks = 151; 23 | required uint64 n_out_interests = 146; 24 | required uint64 n_out_datas = 147; 25 | required uint64 n_out_nacks = 152; 26 | required uint64 n_in_bytes = 148; 27 | required uint64 n_out_bytes = 149; 28 | required uint64 flags = 108; 29 | } 30 | 31 | // A FaceStatusMessage has repeated FaceStatus. 32 | repeated FaceStatus face_status = 128; 33 | } 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # macOS 7 | .DS_Store 8 | 9 | # Emacs temp files 10 | *~ 11 | 12 | # Eclipse 13 | .project 14 | .pydevproject 15 | 16 | # Visual Studio Code 17 | .vscode/ 18 | 19 | # Distribution / packaging 20 | build/ 21 | dist/ 22 | eggs/ 23 | .eggs/ 24 | parts/ 25 | sdist/ 26 | wheels/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | MANIFEST 31 | 32 | # Tests 33 | .pytest_cache/ 34 | /tests/integration_tests/policy_config/test-public-info.db 35 | /tests/integration_tests/policy_config/ndnsec-key-file 36 | 37 | # Sphinx documentation 38 | docs/_build/ 39 | 40 | # Compiled files 41 | *.slo 42 | *.lo 43 | *.o 44 | *.so 45 | *.dylib 46 | *.lai 47 | *.la 48 | *.a 49 | bin/* 50 | libs/* 51 | .libs/* 52 | 53 | # Autoconf files 54 | /Makefile 55 | /include/Makefile 56 | /autom4te.cache 57 | config.log 58 | /config.status 59 | /include/config.h 60 | /_configs.sed 61 | /stamp-h1 62 | /include/ndn-cpp/ndn-cpp-config.h 63 | /include/stamp-h1 64 | /aclocal.m4 65 | /libtool 66 | /condefs.h 67 | /conftest.cpp 68 | /conftest.err 69 | /test-suite.log 70 | *.Po 71 | .deps 72 | .dirstamp 73 | *.tar.gz 74 | /*.pc 75 | # Let autoconf automatically copy these files 76 | /m4/libtool.m4 77 | /m4/ltoptions.m4 78 | /m4/ltsugar.m4 79 | /m4/ltversion.m4 80 | /m4/lt~obsolete.m4 81 | -------------------------------------------------------------------------------- /python/pyndn/sync/psync_missing_data_info.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.name import Name 21 | 22 | class PSyncMissingDataInfo(object): 23 | def __init__(self, prefix, lowSequenceNo, highSequenceNo): 24 | # Copy the name. 25 | self._prefix = Name(prefix) 26 | self._lowSequenceNo = lowSequenceNo 27 | self._highSequenceNo = highSequenceNo 28 | -------------------------------------------------------------------------------- /python/pyndn/in_memory_storage/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | # Don't include internal modules. 21 | from pyndn.in_memory_storage import in_memory_storage_retaining 22 | __all__ = ['in_memory_storage_retaining'] 23 | 24 | import sys as _sys 25 | 26 | try: 27 | from pyndn.in_memory_storage.in_memory_storage_retaining import * 28 | except ImportError: 29 | del _sys.modules[__name__] 30 | raise 31 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/simple_rules.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | trust-anchor 4 | { 5 | type dir 6 | dir "policy_config/certs" 7 | refresh 5s 8 | } 9 | rule 10 | { 11 | id "For the encoded data" 12 | for data 13 | filter 14 | { 15 | type name 16 | name /temp 17 | relation is-prefix-of 18 | } 19 | checker 20 | { 21 | type customized 22 | sig-type rsa-sha256 23 | key-locator 24 | { 25 | type name 26 | name /temp 27 | relation is-strict-prefix-of 28 | } 29 | } 30 | } 31 | rule 32 | { 33 | id "A Rule" 34 | for data 35 | checker 36 | { 37 | type customized 38 | sig-type rsa-sha256 39 | key-locator 40 | { 41 | type name 42 | name /TestConfigPolicyManager 43 | relation is-strict-prefix-of 44 | } 45 | } 46 | } 47 | rule 48 | { 49 | id "Another Rule" 50 | for interest 51 | checker 52 | { 53 | type customized 54 | sig-type rsa-sha256 55 | key-locator 56 | { 57 | type name 58 | name /TestConfigPolicyManager 59 | relation is-strict-prefix-of 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /python/pyndn/encoding/der/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Adeola Bannis 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.encoding.der import der, der_exceptions, der_node 21 | __all__ = ['der', 'der_exceptions', 'der_node'] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | from pyndn.encoding.der.der import Der 27 | from pyndn.encoding.der.der_exceptions import * 28 | from pyndn.encoding.der.der_node import * 29 | 30 | except ImportError: 31 | del _sys.modules[__name__] 32 | raise 33 | -------------------------------------------------------------------------------- /src/lite/meta-info-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/data.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | MetaInfoLite::MetaInfoLite() 28 | { 29 | ndn_MetaInfo_initialize(this); 30 | } 31 | 32 | void 33 | MetaInfoLite::clear() 34 | { 35 | ndn_MetaInfo_clear(this); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/regex_ruleset.conf: -------------------------------------------------------------------------------- 1 | # checkers are irrelevant for this test 2 | validator 3 | { 4 | rule 5 | { 6 | id "A rule" 7 | for data 8 | filter 9 | { 10 | type name 11 | regex "^$" 12 | } 13 | checker 14 | { 15 | type customized 16 | sig-type rsa-sha256 17 | key-locator 18 | { 19 | type name 20 | name / 21 | relation is-prefix-of 22 | } 23 | } 24 | } 25 | rule 26 | { 27 | id "Another rule" 28 | for data 29 | filter 30 | { 31 | type name 32 | regex "[^]+$" 33 | } 34 | checker 35 | { 36 | type customized 37 | sig-type rsa-sha256 38 | key-locator 39 | { 40 | type name 41 | name / 42 | relation is-prefix-of 43 | } 44 | } 45 | } 46 | rule 47 | { 48 | id "Yet another rule" 49 | for data 50 | filter 51 | { 52 | type name 53 | regex "^[^]+<.*Data>?$" 54 | } 55 | checker 56 | { 57 | type customized 58 | sig-type rsa-sha256 59 | key-locator 60 | { 61 | type name 62 | name / 63 | relation is-prefix-of 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /examples/repo_ng/repo-command-parameter.proto: -------------------------------------------------------------------------------- 1 | // This is the Protobuf definition for RepoCommandParameter, described at: 2 | // http://redmine.named-data.net/projects/repo-ng/wiki/Repo_Command 3 | // Compile this file using: 4 | // protoc --python_out=. repo-command-parameter.proto 5 | 6 | package ndn_message; 7 | 8 | // Protobuf has no "outer" message type, so we need to put the TLV RepoCommandParameter 9 | // message inside an outer "typeless" RepoCommandParameterMessage. 10 | message RepoCommandParameterMessage { 11 | message Name { 12 | repeated bytes component = 8; 13 | } 14 | 15 | message Selectors { 16 | optional uint32 min_suffix_components = 13; 17 | optional uint32 max_suffix_components = 14; 18 | optional bytes publisher_public_key_locator = 15; 19 | // TODO: Add Exclude. 20 | optional uint32 child_selector = 17; 21 | } 22 | 23 | message RepoCommandParameter { 24 | optional Name name = 7; 25 | optional Selectors selectors = 9; 26 | optional uint64 start_block_id = 204; 27 | optional uint64 end_block_id = 205; 28 | optional uint64 process_id = 206; 29 | optional uint64 max_interest_num = 211; 30 | optional uint64 watch_timeout = 212; 31 | optional uint64 watch_status = 213; 32 | optional uint64 interest_lifetime = 214; 33 | } 34 | 35 | // A RepoCommandParameterMessage has one RepoCommandParameter. 36 | required RepoCommandParameter repo_command_parameter = 201; 37 | } 38 | -------------------------------------------------------------------------------- /src/lite/lp/lp-packet-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/lp/lp-packet.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | LpPacketLite::LpPacketLite 28 | (struct ndn_LpPacketHeaderField* headerFields, size_t maxHeaderFields) 29 | { 30 | ndn_LpPacket_initialize(this, headerFields, maxHeaderFields); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /doc/pyndn.security.v2.validator_config.rst: -------------------------------------------------------------------------------- 1 | pyndn.security.v2.validator\_config package 2 | =========================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.security.v2.validator\_config.config\_checker module 8 | ---------------------------------------------------------- 9 | 10 | .. automodule:: pyndn.security.v2.validator_config.config_checker 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.security.v2.validator\_config.config\_filter module 16 | --------------------------------------------------------- 17 | 18 | .. automodule:: pyndn.security.v2.validator_config.config_filter 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.security.v2.validator\_config.config\_name\_relation module 24 | ----------------------------------------------------------------- 25 | 26 | .. automodule:: pyndn.security.v2.validator_config.config_name_relation 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.security.v2.validator\_config.config\_rule module 32 | ------------------------------------------------------- 33 | 34 | .. automodule:: pyndn.security.v2.validator_config.config_rule 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: pyndn.security.v2.validator_config 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /python/pyndn/security/certificate/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.security.certificate import public_key, certificate, identity_certificate 21 | __all__ = ['public_key', 'certificate', 'identity_certificate'] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | from pyndn.security.certificate.public_key import * 27 | from pyndn.security.certificate.certificate import * 28 | from pyndn.security.certificate.identity_certificate import * 29 | except ImportError: 30 | del _sys.modules[__name__] 31 | raise 32 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/security/ec-public-key-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_EC_PUBLIC_KEY_TYPES_H 22 | #define NDN_EC_PUBLIC_KEY_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | struct ec_key_st; 29 | 30 | /** 31 | * A struct ndn_EcPublicKey holds a decoded EC public key for use in crypto 32 | * operations. 33 | */ 34 | struct ndn_EcPublicKey { 35 | struct ec_key_st *publicKey; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/security/rsa-public-key-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_RSA_PUBLIC_KEY_TYPES_H 22 | #define NDN_RSA_PUBLIC_KEY_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | struct rsa_st; 29 | 30 | /** 31 | * A struct ndn_RsaPublicKey holds a decoded RSA public key for use in crypto 32 | * operations. 33 | */ 34 | struct ndn_RsaPublicKey { 35 | struct rsa_st *publicKey; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /python/pyndn/transport/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.transport import tcp_transport, transport, udp_transport, unix_transport 21 | __all__ = ['tcp_transport', 'transport', 'udp_transport', 'unix_transport'] 22 | 23 | import sys as _sys 24 | 25 | try: 26 | from pyndn.transport.tcp_transport import * 27 | from pyndn.transport.transport import * 28 | from pyndn.transport.udp_transport import * 29 | from pyndn.transport.unix_transport import * 30 | except ImportError: 31 | del _sys.modules[__name__] 32 | raise 33 | -------------------------------------------------------------------------------- /src/c/util/blob_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "ndn_memory.h" 22 | #include "blob.h" 23 | 24 | int 25 | ndn_Blob_equals(const struct ndn_Blob *self, const struct ndn_Blob *other) 26 | { 27 | if (ndn_Blob_isNull(self)) 28 | return ndn_Blob_isNull(other); 29 | else if (ndn_Blob_isNull(other)) 30 | return 0; 31 | else { 32 | if (self->length != other->length) 33 | return 0; 34 | 35 | return ndn_memcmp(self->value, other->value, self->length) == 0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/security/rsa-private-key-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_RSA_PRIVATE_KEY_TYPES_H 22 | #define NDN_RSA_PRIVATE_KEY_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | struct rsa_st; 29 | 30 | /** 31 | * A struct ndn_RsaPrivateKey holds a decoded RSA private key for use in crypto 32 | * operations. 33 | */ 34 | struct ndn_RsaPrivateKey { 35 | struct rsa_st *privateKey; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/security/ec-private-key-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_EC_PRIVATE_KEY_TYPES_H 22 | #define NDN_EC_PRIVATE_KEY_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | struct ec_key_st; 29 | 30 | /** 31 | * A struct ndn_EcPrivateKey holds a decoded EC private key for use in crypto 32 | * operations. 33 | */ 34 | struct ndn_EcPrivateKey { 35 | struct ec_key_st *privateKey; 36 | }; 37 | 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/lite/encrypt/algo/encrypt-params-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * @author: From ndn-group-encrypt src/encrypt-params https://github.com/named-data/ndn-group-encrypt 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version, with the additional exemption that 11 | * compiling, linking, and/or using OpenSSL is allowed. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * A copy of the GNU Lesser General Public License is in the file COPYING. 21 | */ 22 | 23 | #include "../../../c/encrypt/algo/encrypt-params.h" 24 | #include 25 | 26 | namespace ndn { 27 | 28 | EncryptParamsLite::EncryptParamsLite() 29 | { 30 | ndn_EncryptParams_initialize(this); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/delegation-set-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_DELEGATION_SET_TYPES_H 22 | #define NDN_DELEGATION_SET_TYPES_H 23 | 24 | #include "name-types.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * An ndn_DelegationSet_Delegation holds a preference number and delegation name. 32 | */ 33 | struct ndn_DelegationSet_Delegation { 34 | int preference; 35 | struct ndn_Name name; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /python/pyndn/security/validator_config_error.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/v2/validator-config/common.hpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the ValidatorConfigError class for reporting an error using 23 | ValidatorConfig. 24 | """ 25 | 26 | class ValidatorConfigError(Exception): 27 | """ 28 | Create a ValidatorConfigError. 29 | 30 | :param str message: The error message. 31 | """ 32 | def __init__(self, message): 33 | super(ValidatorConfigError, self).__init__(message) 34 | 35 | -------------------------------------------------------------------------------- /python/pyndn/encrypt/algo/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2015-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.encrypt.algo import aes_algorithm, encrypt_params, encryptor 21 | from pyndn.encrypt.algo import rsa_algorithm 22 | __all__ = ['aes_algorithm', 'encrypt_params', 'encryptor', 'rsa_algorithm'] 23 | 24 | import sys as _sys 25 | 26 | try: 27 | from pyndn.encrypt.algo.aes_algorithm import * 28 | from pyndn.encrypt.algo.encrypt_params import * 29 | from pyndn.encrypt.algo.encryptor import * 30 | from pyndn.encrypt.algo.rsa_algorithm import * 31 | except ImportError: 32 | del _sys.modules[__name__] 33 | raise 34 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/lp/congestion-mark-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_CONGESTION_MARK_TYPES_H 22 | #define NDN_CONGESTION_MARK_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * An ndn_CongestionMark represents the congestion mark header field in an 30 | * NDNLPv2 packet. 31 | * http://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 32 | */ 33 | struct ndn_CongestionMark { 34 | uint64_t congestionMark; /**< 0 if not specified. */ 35 | }; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/util/blob-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2015-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_BLOB_TYPES_H 22 | #define NDN_BLOB_TYPES_H 23 | 24 | #include "../common.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * An ndn_Blob holds a pointer to a read-only pre-allocated buffer and its length. 32 | */ 33 | struct ndn_Blob { 34 | const uint8_t *value; /**< pointer to the pre-allocated buffer for the value. Must be treated as read only. */ 35 | size_t length; /**< the number of bytes in value. */ 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /python/pyndn/sync/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.sync import chrono_sync2013, full_psync2017, full_psync2017_with_users 21 | from pyndn.sync import psync_missing_data_info 22 | __all__ = ['chrono_sync2013', 'full_psync2017', 'full_psync2017_with_users', 23 | 'psync_missing_data_info'] 24 | 25 | import sys as _sys 26 | 27 | try: 28 | from pyndn.sync.chrono_sync2013 import * 29 | from pyndn.sync.full_psync2017 import * 30 | from pyndn.sync.full_psync2017_with_users import * 31 | from pyndn.sync.psync_missing_data_info import * 32 | except ImportError: 33 | del _sys.modules[__name__] 34 | raise 35 | -------------------------------------------------------------------------------- /src/lite/key-locator-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/key-locator.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | KeyLocatorLite::KeyLocatorLite 28 | (ndn_NameComponent* keyNameComponents, size_t maxKeyNameComponents) 29 | { 30 | ndn_KeyLocator_initialize(this, keyNameComponents, maxKeyNameComponents); 31 | } 32 | 33 | ndn_Error 34 | KeyLocatorLite::set(const KeyLocatorLite& other) 35 | { 36 | return ndn_KeyLocator_setFromKeyLocator(this, &other); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /python/pyndn/security/security_types.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # From ndn-cxx security by Yingdi Yu . 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines constants used by the security library. 23 | """ 24 | 25 | # The KeyType integer is used by the Sqlite key storage, so don't change them. 26 | # Make these the same as ndn-cxx in case the storage file is shared. 27 | class KeyType(object): 28 | RSA = 0 29 | EC = 1 30 | # Deprecated. Use KeyType.EC . 31 | ECDSA = 1 32 | AES = 128 33 | 34 | class KeyClass(object): 35 | PUBLIC = 1 36 | PRIVATE = 2 37 | SYMMETRIC = 3 38 | 39 | class DigestAlgorithm(object): 40 | SHA256 = 1 41 | -------------------------------------------------------------------------------- /python/pyndn/util/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.util import blob, exponential_re_express, memory_content_cache 21 | from pyndn.util import segment_fetcher, signed_blob 22 | __all__ = ['blob', 'exponential_re_express', 'memory_content_cache', 23 | 'segment_fetcher', 'signed_blob'] 24 | 25 | import sys as _sys 26 | 27 | try: 28 | from pyndn.util.blob import * 29 | from pyndn.util.exponential_re_express import * 30 | from pyndn.util.memory_content_cache import * 31 | from pyndn.util.segment_fetcher import * 32 | from pyndn.util.signed_blob import * 33 | except ImportError: 34 | del _sys.modules[__name__] 35 | raise 36 | -------------------------------------------------------------------------------- /src/lite/encoding/element-listener-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/encoding/element-listener.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | ElementListenerLite::ElementListenerLite(OnReceivedElementLite onReceivedElement) 28 | { 29 | // OnReceivedElementLite is the same as ndn_OnReceivedElement except for the 30 | // pointer type of the first argument, so just cast it. 31 | ndn_ElementListener_initialize(this, (ndn_OnReceivedElement)onReceivedElement); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /python/pyndn/contrib/cocoapy/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2008 Alex Holkner 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in 11 | the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of pyglet nor the names of its 14 | contributors may be used to endorse or promote products 15 | derived from this software without specific prior written 16 | permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | -------------------------------------------------------------------------------- /src/lite/control-response-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/control-response.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | ControlResponseLite::ControlResponseLite 28 | (struct ndn_NameComponent *nameComponents, size_t maxNameComponents, 29 | struct ndn_NameComponent *strategyNameComponents, 30 | size_t strategyMaxNameComponents) 31 | { 32 | ndn_ControlResponse_initialize 33 | (this, nameComponents, maxNameComponents, strategyNameComponents, 34 | strategyMaxNameComponents); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/lite/data-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/data.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | DataLite::DataLite 28 | (ndn_NameComponent* nameComponents, size_t maxNameComponents, 29 | ndn_NameComponent* keyNameComponents, size_t maxKeyNameComponents) 30 | { 31 | ndn_Data_initialize 32 | (this, nameComponents, maxNameComponents, keyNameComponents, 33 | maxKeyNameComponents); 34 | } 35 | 36 | ndn_Error 37 | DataLite::set(const DataLite& other) { return ndn_Data_setFromData(this, &other); } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/lite/signature-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/data.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | SignatureLite::SignatureLite 28 | (ndn_NameComponent* keyNameComponents, size_t maxKeyNameComponents) 29 | { 30 | ndn_Signature_initialize(this, keyNameComponents, maxKeyNameComponents); 31 | } 32 | 33 | void 34 | SignatureLite::clear() { ndn_Signature_clear(this); } 35 | 36 | ndn_Error 37 | SignatureLite::set(const SignatureLite& other) 38 | { 39 | return ndn_Signature_setFromSignature(this, &other); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/forwarding-flags.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | /* Note: This file should be named forward-flags-types.h (like data-types.h) but 22 | * we leave it as forwarding-flags.h for backwards compatibility with the 23 | * include directory of old installations. 24 | */ 25 | 26 | #ifndef NDN_FORWARDING_FLAGS_H 27 | #define NDN_FORWARDING_FLAGS_H 28 | 29 | #include "registration-options-types.h" 30 | 31 | /** 32 | * struct ndn_ForwardingFlags is deprecated. You should change to 33 | * struct ndn_RegistrationOptions. If you don't want to change your code yet, you can 34 | * #define ndn_ForwardingFlags ndn_RegistrationOptions 35 | */ 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/security/validity-period-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_VALIDITY_PERIOD_TYPES_H 22 | #define NDN_VALIDITY_PERIOD_TYPES_H 23 | 24 | #include "../common.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * An ndn_ValidityPeriod is used in a Data packet's SignatureInfo and represents 32 | * the begin and end times of a certificate's validity period. 33 | */ 34 | struct ndn_ValidityPeriod { 35 | ndn_MillisecondsSince1970 notBefore; /**< DBL_MAX for none. */ 36 | ndn_MillisecondsSince1970 notAfter; /**< -DBL_MAX for none. */ 37 | }; 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/lite/delegation-set-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/delegation-set.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | DelegationSetLite::Delegation::Delegation 28 | (ndn_NameComponent* nameComponents, size_t maxNameComponents) 29 | { 30 | ndn_DelegationSet_Delegation_initialize 31 | (this, nameComponents, maxNameComponents); 32 | } 33 | 34 | ndn_Error 35 | DelegationSetLite::Delegation::set(const Delegation& other) 36 | { 37 | return ndn_DelegationSet_Delegation_setFromDelegationSet_Delegation(this, &other); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/lite/network-nack-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/network-nack.h" 23 | #include 24 | #include 25 | 26 | namespace ndn { 27 | 28 | NetworkNackLite::NetworkNackLite() 29 | { 30 | ndn_NetworkNack_initialize(this); 31 | } 32 | 33 | const NetworkNackLite* 34 | NetworkNackLite::getFirstHeader(const LpPacketLite& lpPacket) 35 | { 36 | const ndn_NetworkNack* result = ndn_NetworkNack_getFirstHeader(&lpPacket); 37 | if (result) 38 | return &downCast(*result); 39 | else 40 | return 0; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /python/pyndn/encoding/der/der_exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Adeola Bannis 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | """ 21 | Exceptions that may occur during DER encoding/decoding 22 | Correspond to exceptions in ndn-cpp 23 | """ 24 | 25 | class DerException(Exception): 26 | pass 27 | 28 | class NegativeLengthException(DerException): 29 | def __init__(self, message): 30 | super(NegativeLengthException, self).__init__(self, message) 31 | 32 | class DerEncodingException(DerException): 33 | def __init__(self, message): 34 | super(DerEncodingException, self).__init__(self, message) 35 | 36 | class DerDecodingException(DerException): 37 | def __init__(self, message): 38 | super(DerDecodingException, self).__init__(self, message) 39 | 40 | -------------------------------------------------------------------------------- /python/pyndn/security/key_id_type.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From code in ndn-cxx by Yingdi Yu 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the KeyIdType enum which represents the type of a KeyId 23 | component in a key name. 24 | """ 25 | 26 | class KeyIdType(object): 27 | # USER_SPECIFIED: A user-specified key ID. It is the user's responsibility 28 | # to ensure the uniqueness of key names. 29 | USER_SPECIFIED = 0 30 | 31 | # SHA256: The SHA256 hash of the public key as the key id. This KeyId type 32 | # guarantees the uniqueness of key names. 33 | SHA256 = 1 34 | 35 | # RANDOM: A 64-bit random number as the key id. This KeyId provides rough 36 | # uniqueness of key names. 37 | RANDOM = 2 38 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/lp/incoming-face-id-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * @author: From ndn-cxx fields.hpp https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/lp/fields.hpp 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_INCOMING_FACE_ID_TYPES_H 23 | #define NDN_INCOMING_FACE_ID_TYPES_H 24 | 25 | #include "../common.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * An ndn_IncomingFaceId represents the incoming face ID header field in an 33 | * NDNLPv2 packet. 34 | * http://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 35 | */ 36 | struct ndn_IncomingFaceId { 37 | uint64_t faceId; /**< (uint64_t)-1 if not specified. */ 38 | }; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/lite/lp/congestion-mark-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2018-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/lp/congestion-mark.h" 23 | #include 24 | #include 25 | 26 | namespace ndn { 27 | 28 | CongestionMarkLite::CongestionMarkLite() 29 | { 30 | ndn_CongestionMark_initialize(this); 31 | } 32 | 33 | const CongestionMarkLite* 34 | CongestionMarkLite::getFirstHeader(const LpPacketLite& lpPacket) 35 | { 36 | const ndn_CongestionMark* result = ndn_CongestionMark_getFirstHeader(&lpPacket); 37 | if (result) 38 | return &downCast(*result); 39 | else 40 | return 0; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/transport/transport-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2015-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_TRANSPORT_TYPES_H 22 | #define NDN_TRANSPORT_TYPES_H 23 | 24 | #include "../encoding/element-reader-types.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | struct ndn_SocketTransport { 31 | int socketDescriptor; /**< -1 if not connected */ 32 | struct ndn_ElementReader elementReader; 33 | }; 34 | 35 | struct ndn_TcpTransport { 36 | struct ndn_SocketTransport base; 37 | }; 38 | 39 | struct ndn_UdpTransport { 40 | struct ndn_SocketTransport base; 41 | }; 42 | 43 | struct ndn_UnixTransport { 44 | struct ndn_SocketTransport base; 45 | }; 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/lite/lp/incoming-face-id-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/lp/incoming-face-id.h" 23 | #include 24 | #include 25 | 26 | namespace ndn { 27 | 28 | IncomingFaceIdLite::IncomingFaceIdLite() 29 | { 30 | ndn_IncomingFaceId_initialize(this); 31 | } 32 | 33 | const IncomingFaceIdLite* 34 | IncomingFaceIdLite::getFirstHeader(const LpPacketLite& lpPacket) 35 | { 36 | const ndn_IncomingFaceId* result = ndn_IncomingFaceId_getFirstHeader(&lpPacket); 37 | if (result) 38 | return &downCast(*result); 39 | else 40 | return 0; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /python/pyndn/security/validator_null.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/validator-null.hpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the ValidatorNull class which extends Validator with an 23 | "accept-all" policy and an offline certificate fetcher. 24 | """ 25 | 26 | from pyndn.security.v2.validator import Validator 27 | from pyndn.security.v2.validation_policy_accept_all import ValidationPolicyAcceptAll 28 | from pyndn.security.v2.certificate_fetcher_offline import CertificateFetcherOffline 29 | 30 | class ValidatorNull(Validator): 31 | def __init__(self): 32 | super(ValidatorNull, self).__init__( 33 | ValidationPolicyAcceptAll(), CertificateFetcherOffline()) 34 | 35 | -------------------------------------------------------------------------------- /src/c/util/ndn_realloc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_NDN_REALLOC_H 22 | #define NDN_NDN_REALLOC_H 23 | 24 | #include "dynamic-uint8-array.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * Wrap the C stdlib realloc to convert to/from void * to uint8_t *. 32 | * This can be used by ndn_DynamicUInt8Array_initialize. 33 | * @param self This is ignored. 34 | * @param array the allocated array buffer to realloc. 35 | * @param length the length for the new array buffer. 36 | * @return the new allocated array buffer. 37 | */ 38 | uint8_t *ndn_realloc(struct ndn_DynamicUInt8Array *self, uint8_t *array, size_t length); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /python/pyndn/security/security_exception.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # From ndn-cxx security by Yingdi Yu . 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the SecurityException class which extends Exception 23 | to report an exception from the security library. 24 | """ 25 | 26 | class SecurityException(Exception): 27 | def __init__(self, message): 28 | super(SecurityException, self).__init__(message) 29 | 30 | class UnrecognizedKeyFormatException(SecurityException): 31 | def __init__(self, message): 32 | super(UnrecognizedKeyFormatException, self).__init__(message) 33 | 34 | class UnrecognizedDigestAlgorithmException(SecurityException): 35 | def __init__(self, message): 36 | super(UnrecognizedDigestAlgorithmException, self).__init__(message) 37 | -------------------------------------------------------------------------------- /include/ndn-cpp/lite/encoding/tlv-0_1_1-wire-format-lite.hpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_TLV_0_1_1_WIRE_FORMAT_LITE_HPP 23 | #define NDN_TLV_0_1_1_WIRE_FORMAT_LITE_HPP 24 | 25 | #include "tlv-0_2-wire-format-lite.hpp" 26 | 27 | namespace ndn { 28 | 29 | /** 30 | * A Tlv0_1_1WireFormatLite extends Tlv0_2WireFormatLite so that it is an alias 31 | * in case any applications use Tlv0_1_1WireFormatLite directly. These two wire 32 | * formats are the same except that Tlv0_2WireFormatLite adds support for the 33 | * name component type ImplicitSha256Digest. 34 | */ 35 | class Tlv0_1_1WireFormatLite : public Tlv0_2WireFormatLite { 36 | }; 37 | 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /python/pyndn/util/regex/ndn_regex_pseudo_matcher.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Yingdi Yu 5 | # Author: Jeff Thompson 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | from pyndn.name import Name 22 | from pyndn.util.regex.ndn_regex_matcher_base import NdnRegexMatcherBase 23 | 24 | class NdnRegexPseudoMatcher(NdnRegexMatcherBase): 25 | """ 26 | Create an NdnRegexPseudoMatcher. 27 | """ 28 | def __init__(self): 29 | super(NdnRegexPseudoMatcher, self).__init__( 30 | "", NdnRegexMatcherBase.NdnRegexExprType.PSEUDO) 31 | 32 | def _compile(self): 33 | pass 34 | 35 | def setMatchResult(self, value): 36 | """ 37 | :param str value: 38 | """ 39 | self._matchResult.append(Name.Component(value)) 40 | 41 | def resetMatchResult(self): 42 | self._matchResult = [] 43 | -------------------------------------------------------------------------------- /python/pyndn/forwarding_flags.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | """ 21 | This module defines the ForwardingFlags class which is deprecated. Use 22 | RegistrationOptions. 23 | """ 24 | 25 | from pyndn.registration_options import RegistrationOptions 26 | 27 | class ForwardingFlags(RegistrationOptions): 28 | """ 29 | Create a new ForwardingFlags object, possibly copying values from another 30 | object. 31 | 32 | :param RegistrationOptions value: (optional) If value is a 33 | RegistrationOptions (or ForwardingFlags), copy its values. If value is 34 | omitted, the type is the default with "childInherit" True and other flags 35 | False. 36 | :deprecated: Use RegistrationOptions. 37 | """ 38 | def __init__(self, value = None): 39 | super(ForwardingFlags, self).__init__(value) 40 | -------------------------------------------------------------------------------- /src/lite/encrypt/encrypted-content-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/encrypt/encrypted-content.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | EncryptedContentLite::EncryptedContentLite 28 | (ndn_NameComponent* keyNameComponents, size_t maxKeyNameComponents) 29 | { 30 | ndn_EncryptedContent_initialize(this, keyNameComponents, maxKeyNameComponents); 31 | } 32 | 33 | void 34 | EncryptedContentLite::clear() { ndn_EncryptedContent_clear(this); } 35 | 36 | ndn_Error 37 | EncryptedContentLite::set(const EncryptedContentLite& other) 38 | { 39 | return ndn_EncryptedContent_setFromEncryptedContent(this, &other); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/lite/registration-options-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2019-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/registration-options.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | RegistrationOptionsLite::RegistrationOptionsLite() 28 | { 29 | ndn_RegistrationOptions_initialize(this); 30 | } 31 | 32 | int 33 | RegistrationOptionsLite::getNfdForwardingFlags() const 34 | { 35 | return ndn_RegistrationOptions_getNfdForwardingFlags(this); 36 | } 37 | 38 | RegistrationOptionsLite& 39 | RegistrationOptionsLite::setNfdForwardingFlags(int nfdForwardingFlags) 40 | { 41 | ndn_RegistrationOptions_setNfdForwardingFlags(this, nfdForwardingFlags); 42 | return *this; 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /python/pyndn/security/policy/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.security.policy import no_verify_policy_manager, policy_manager 21 | from pyndn.security.policy import self_verify_policy_manager, validation_request 22 | __all__ = ['no_verify_policy_manager', 'policy_manager', 23 | 'self_verify_policy_manager', 'validation_request', 24 | 'config_policy_manager'] 25 | 26 | import sys as _sys 27 | 28 | try: 29 | from pyndn.security.policy.no_verify_policy_manager import * 30 | from pyndn.security.policy.policy_manager import * 31 | from pyndn.security.policy.self_verify_policy_manager import * 32 | from pyndn.security.policy.config_policy_manager import * 33 | from pyndn.security.policy.validation_request import * 34 | except ImportError: 35 | del _sys.modules[__name__] 36 | raise 37 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/registration-options-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2019-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_REGISTRATION_OPTIONS_TYPES_H 22 | #define NDN_REGISTRATION_OPTIONS_TYPES_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * An ndn_RegistrationOptions holds the options used when registering with the 30 | * forwarder to specify how to forward an interest and other options. We use a 31 | * separate ndn_RegistrationOptions to retain future compatibility if the 32 | * format of the registration command is changed. 33 | * (This was renamed from ndn_ForwardingFlags, which is deprecated.) 34 | */ 35 | struct ndn_RegistrationOptions { 36 | int childInherit; 37 | int capture; 38 | int origin; /**< -1 for none. */ 39 | }; 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/c/encoding/tlv/tlv-lp-packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_TLV_LP_PACKET_H 22 | #define NDN_TLV_LP_PACKET_H 23 | 24 | #include "../../lp/lp-packet.h" 25 | #include "tlv-encoder.h" 26 | #include "tlv-decoder.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /** 33 | * Expect the next element to be a TLV LpPacket and decode into the ndn_LpPacket 34 | * struct. 35 | * @param lpPacket A pointer to the LpPacket struct. 36 | * @param decoder A pointer to the ndn_TlvDecoder struct. 37 | * @return 0 for success, else an error code, including if the next element is 38 | * not LpPacket. 39 | */ 40 | ndn_Error 41 | ndn_decodeTlvLpPacket 42 | (struct ndn_LpPacket *lpPacket, struct ndn_TlvDecoder *decoder); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /doc/pyndn.security.policy.rst: -------------------------------------------------------------------------------- 1 | pyndn.security.policy package 2 | ============================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.security.policy.certificate\_cache module 8 | ----------------------------------------------- 9 | 10 | .. automodule:: pyndn.security.policy.certificate_cache 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.security.policy.config\_policy\_manager module 16 | ---------------------------------------------------- 17 | 18 | .. automodule:: pyndn.security.policy.config_policy_manager 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.security.policy.no\_verify\_policy\_manager module 24 | -------------------------------------------------------- 25 | 26 | .. automodule:: pyndn.security.policy.no_verify_policy_manager 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.security.policy.policy\_manager module 32 | -------------------------------------------- 33 | 34 | .. automodule:: pyndn.security.policy.policy_manager 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pyndn.security.policy.self\_verify\_policy\_manager module 40 | ---------------------------------------------------------- 41 | 42 | .. automodule:: pyndn.security.policy.self_verify_policy_manager 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pyndn.security.policy.validation\_request module 48 | ------------------------------------------------ 49 | 50 | .. automodule:: pyndn.security.policy.validation_request 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | 56 | Module contents 57 | --------------- 58 | 59 | .. automodule:: pyndn.security.policy 60 | :members: 61 | :undoc-members: 62 | :show-inheritance: 63 | -------------------------------------------------------------------------------- /python/pyndn/encoding/der/der.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Adeola Bannis 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | """ 21 | This module defines the Der object with known DER node types. 22 | """ 23 | class Der(object): 24 | Eoc = 0 25 | Boolean = 1 26 | Integer = 2 27 | BitString = 3 28 | OctetString = 4 29 | Null = 5 30 | ObjectIdentifier = 6 31 | ObjectDescriptor = 7 32 | External = 40 33 | Real = 9 34 | Enumerated = 10 35 | EmbeddedPdv = 43 36 | Utf8String = 12 37 | RelativeOid = 13 38 | Sequence = 48 39 | Set = 49 40 | NumericString = 18 41 | PrintableString = 19 42 | T61String = 20 43 | VideoTexString = 21 44 | Ia5String = 22 45 | UtcTime = 23 46 | GeneralizedTime = 24 47 | GraphicString = 25 48 | VisibleString = 26 49 | GeneralString = 27 50 | UniversalString = 28 51 | CharacterString = 29 52 | BmpString = 30 53 | 54 | -------------------------------------------------------------------------------- /python/pyndn/encoding/tlv_0_1_wire_format.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | """ 21 | This module defines the Tlv0_1WireFormat class which extends Tlv0_1_1WireFormat 22 | so that it is an alias in case any applications use Tlv0_1WireFormat directly. 23 | These two wire formats are the same except that Tlv0_1_1WireFormat adds support 24 | for Sha256WithEcdsaSignature. 25 | """ 26 | 27 | from pyndn.encoding.tlv_0_1_1_wire_format import Tlv0_1_1WireFormat 28 | 29 | class Tlv0_1WireFormat(Tlv0_1_1WireFormat): 30 | _instance = None 31 | 32 | @classmethod 33 | def get(self): 34 | """ 35 | Get a singleton instance of a Tlv0_1WireFormat. 36 | 37 | :return: The singleton instance. 38 | :rtype: Tlv0_1WireFormat 39 | """ 40 | if self._instance == None: 41 | self._instance = Tlv0_1WireFormat() 42 | return self._instance 43 | -------------------------------------------------------------------------------- /src/c/encrypt/algo/encrypt-params.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * @author: From ndn-group-encrypt src/encrypt-params https://github.com/named-data/ndn-group-encrypt 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_ENCRYPT_PARAMS_H 23 | #define NDN_ENCRYPT_PARAMS_H 24 | 25 | #include 26 | #include "../../util/blob.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /** 33 | * Initialize an ndn_EncryptParams struct with defaults for all the values. 34 | * @param self A pointer to the ndn_EncryptParams struct. 35 | */ 36 | static __inline void ndn_EncryptParams_initialize(struct ndn_EncryptParams *self) 37 | { 38 | self->algorithmType = (ndn_EncryptAlgorithmType)-1; 39 | ndn_Blob_initialize(&self->initialVector, 0, 0); 40 | } 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/lite/control-parameters-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../c/control-parameters.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | ControlParametersLite::ControlParametersLite 28 | (struct ndn_NameComponent *nameComponents, size_t maxNameComponents, 29 | struct ndn_NameComponent *strategyNameComponents, 30 | size_t strategyMaxNameComponents) 31 | { 32 | ndn_ControlParameters_initialize 33 | (this, nameComponents, maxNameComponents, strategyNameComponents, 34 | strategyMaxNameComponents); 35 | } 36 | 37 | ndn_Error 38 | ControlParametersLite::set(const ControlParametersLite& other) 39 | { 40 | return ndn_ControlParameters_setFromControlParameters(this, &other); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /doc/pyndn.sync.rst: -------------------------------------------------------------------------------- 1 | pyndn.sync package 2 | ================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | pyndn.sync.detail 10 | 11 | Submodules 12 | ---------- 13 | 14 | pyndn.sync.chrono\_sync2013 module 15 | ---------------------------------- 16 | 17 | .. automodule:: pyndn.sync.chrono_sync2013 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | pyndn.sync.digest\_tree module 23 | ------------------------------ 24 | 25 | .. automodule:: pyndn.sync.digest_tree 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | pyndn.sync.full\_psync2017 module 31 | --------------------------------- 32 | 33 | .. automodule:: pyndn.sync.full_psync2017 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | pyndn.sync.full\_psync2017\_with\_users module 39 | ---------------------------------------------- 40 | 41 | .. automodule:: pyndn.sync.full_psync2017_with_users 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | pyndn.sync.psync\_missing\_data\_info module 47 | -------------------------------------------- 48 | 49 | .. automodule:: pyndn.sync.psync_missing_data_info 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | pyndn.sync.psync\_producer\_base module 55 | --------------------------------------- 56 | 57 | .. automodule:: pyndn.sync.psync_producer_base 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | pyndn.sync.sync\_state\_pb2 module 63 | ---------------------------------- 64 | 65 | .. automodule:: pyndn.sync.sync_state_pb2 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | 71 | Module contents 72 | --------------- 73 | 74 | .. automodule:: pyndn.sync 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | -------------------------------------------------------------------------------- /python/pyndn/encoding/tlv_0_1_1_wire_format.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2016-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | """ 21 | This module defines the Tlv0_1_1WireFormat class which extends Tlv0_2WireFormat 22 | so that it is an alias in case any applications use Tlv0_1_1WireFormat directly. 23 | These two wire formats are the same except that Tlv0_2WireFormat adds support 24 | for the name component type ImplicitSha256Digest. 25 | """ 26 | 27 | from pyndn.encoding.tlv_0_2_wire_format import Tlv0_2WireFormat 28 | 29 | class Tlv0_1_1WireFormat(Tlv0_2WireFormat): 30 | _instance = None 31 | 32 | @classmethod 33 | def get(self): 34 | """ 35 | Get a singleton instance of a Tlv0_1_1WireFormat. 36 | 37 | :return: The singleton instance. 38 | :rtype: Tlv0_1_1WireFormat 39 | """ 40 | if self._instance == None: 41 | self._instance = Tlv0_1_1WireFormat() 42 | return self._instance 43 | -------------------------------------------------------------------------------- /tests/integration_tests/policy_config/hyperrelation_ruleset.conf: -------------------------------------------------------------------------------- 1 | validator 2 | { 3 | rule 4 | { 5 | id "A rule" 6 | for data 7 | filter 8 | { 9 | type name 10 | name /SecurityTestSecRule/Basic/Longer 11 | relation is-strict-prefix-of 12 | } 13 | checker 14 | { 15 | type customized 16 | sig-type rsa-sha256 17 | key-locator 18 | { 19 | type name 20 | hyper-relation 21 | { 22 | # there are 2 components between SecurityTestSecRule and KEY 23 | # in the key name, and the data name begins with SecurityTestSecRule 24 | k-regex "^()[^]{2}$" 25 | k-expand "\\1" 26 | h-relation is-strict-prefix-of 27 | p-regex "^(<>*)$" 28 | p-expand "\\1" 29 | } 30 | } 31 | } 32 | } 33 | rule 34 | { 35 | id "Another rule" 36 | for data 37 | filter 38 | { 39 | type name 40 | name /SecurityTestSecRule/Basic/ 41 | relation is-prefix-of 42 | } 43 | checker 44 | { 45 | type customized 46 | sig-type rsa-sha256 47 | key-locator 48 | { 49 | type name 50 | hyper-relation 51 | { 52 | # there is 1 component between KEY and key-id 53 | # and the data name must end in a /Data* component 54 | # key identity is a prefix of everything before /Data* in data name 55 | k-regex "^([^]+)(<>)$" 56 | k-expand "\\1\\2" 57 | h-relation is-strict-prefix-of 58 | p-regex "^(<>+)$" 59 | p-expand "\\1" 60 | } 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /python/pyndn/util/regex/ndn_regex_backref_manager.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Yingdi Yu 5 | # Author: Jeff Thompson 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | class NdnRegexBackrefManager(object): 22 | def __init__(self): 23 | # Array of NdnRegexMatcherBase 24 | self._backrefs = [] 25 | 26 | def pushRef(self, matcher): 27 | """ 28 | :param NdnRegexMatcherBase matcher: 29 | :rtype: int 30 | """ 31 | last = len(self._backrefs) 32 | self._backrefs.append(matcher) 33 | 34 | return last 35 | 36 | def popRef(self): 37 | self._backrefs.pop() 38 | 39 | def size(self): 40 | """ 41 | :rtype: int 42 | """ 43 | return len(self._backrefs) 44 | 45 | def getBackref(self, i): 46 | """ 47 | :param int i: 48 | :rtype: NdnRegexMatcherBase 49 | """ 50 | return self._backrefs[i] 51 | -------------------------------------------------------------------------------- /python/pyndn/contrib/cocoapy/__init__.py: -------------------------------------------------------------------------------- 1 | # objective-ctypes 2 | # 3 | # Copyright (c) 2011, Phillip Nguyen 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # Neither the name of objective-ctypes nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | # POSSIBILITY OF SUCH DAMAGE. 31 | 32 | from .runtime import objc, send_message, send_super 33 | from .runtime import get_selector 34 | from .runtime import ObjCClass, ObjCInstance, ObjCSubclass 35 | 36 | from .cocoatypes import * 37 | from .cocoalibs import * 38 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/control-response-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_CONTROL_RESPONSE_TYPES_H 22 | #define NDN_CONTROL_RESPONSE_TYPES_H 23 | 24 | #include "control-parameters-types.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /** 31 | * An ndn_ControlResponse struct holds a status code, status text and other 32 | * fields for a ControlResponse which is used, for example, in the response from 33 | * sending a register prefix control command to a forwarder. 34 | */ 35 | struct ndn_ControlResponse { 36 | int statusCode; /**< -1 for none. */ 37 | struct ndn_Blob statusText; /**< A Blob whose value is a pointer to pre-allocated buffer. 38 | 0 for none. */ 39 | int hasBodyAsControlParameters; 40 | struct ndn_ControlParameters bodyAsControlParameters; 41 | }; 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/key-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_KEY_TYPES_H 22 | #define NDN_KEY_TYPES_H 23 | 24 | #include "name-types.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef enum { 31 | ndn_KeyLocatorType_KEYNAME = 1, 32 | ndn_KeyLocatorType_KEY_LOCATOR_DIGEST = 2 33 | } ndn_KeyLocatorType; 34 | 35 | /** 36 | * An ndn_KeyLocator holds the type of key locator and related data. 37 | */ 38 | struct ndn_KeyLocator { 39 | ndn_KeyLocatorType type; /**< -1 for none */ 40 | struct ndn_Blob keyData; /**< A Blob whose value is a pointer to a pre-allocated buffer for the key data as follows: 41 | * If type is ndn_KeyLocatorType_KEY_LOCATOR_DIGEST, the digest data. 42 | */ 43 | struct ndn_Name keyName; /**< The key name (only used if type is ndn_KeyLocatorType_KEYNAME.) */ 44 | }; 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /contrib/murmur-hash/murmur-hash.c: -------------------------------------------------------------------------------- 1 | /** 2 | * murmurHash3 was written by Austin Appleby, and is placed in the public 3 | * domain. The author hereby disclaims copyright to this source code. 4 | * https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp 5 | */ 6 | 7 | #include "murmur-hash.h" 8 | 9 | static uint32_t 10 | ROTL32(uint32_t x, int8_t r) 11 | { 12 | return (x << r) | (x >> (32 - r)); 13 | } 14 | 15 | uint32_t 16 | ndn_murmurHash3 17 | (uint32_t nHashSeed, const uint8_t* dataToHash, size_t dataToHashLength) 18 | { 19 | // Imitate MurmurHash3_x86_32 20 | // https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp#L94 21 | 22 | uint32_t h1 = nHashSeed; 23 | const uint32_t c1 = 0xcc9e2d51; 24 | const uint32_t c2 = 0x1b873593; 25 | 26 | const size_t nblocks = dataToHashLength / 4; 27 | 28 | //---------- 29 | // body 30 | const uint32_t* blocks = (const uint32_t*)(dataToHash + nblocks * 4); 31 | 32 | for (int i = -nblocks; i < 0; i++) { 33 | // Note that this indexes backwards from the end of the array. 34 | uint32_t k1 = blocks[i]; 35 | 36 | k1 *= c1; 37 | k1 = ROTL32(k1,15); 38 | k1 *= c2; 39 | 40 | h1 ^= k1; 41 | h1 = ROTL32(h1,13); 42 | h1 = h1*5+0xe6546b64; 43 | } 44 | 45 | //---------- 46 | // tail 47 | const uint8_t* tail = dataToHash + nblocks * 4; 48 | 49 | uint32_t k1 = 0; 50 | 51 | switch (dataToHashLength & 3) { 52 | case 3: 53 | k1 ^= tail[2] << 16; 54 | // fall through... 55 | 56 | case 2: 57 | k1 ^= tail[1] << 8; 58 | // fall through... 59 | 60 | case 1: 61 | k1 ^= tail[0]; 62 | k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; 63 | } 64 | 65 | //---------- 66 | // finalization 67 | h1 ^= dataToHashLength; 68 | h1 ^= h1 >> 16; 69 | h1 *= 0x85ebca6b; 70 | h1 ^= h1 >> 13; 71 | h1 *= 0xc2b2ae35; 72 | h1 ^= h1 >> 16; 73 | 74 | return h1; 75 | } 76 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/encrypt/encrypted-content-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * @author: From ndn-group-encrypt src/encrypted-content https://github.com/named-data/ndn-group-encrypt 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_ENCRYPTED_CONTENT_TYPES_H 23 | #define NDN_ENCRYPTED_CONTENT_TYPES_H 24 | 25 | #include "algo/encrypt-params-types.h" 26 | #include "../key-types.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /** 33 | * An ndn_EncryptedContent holds an encryption type, a payload and other fields 34 | * representing encrypted content. 35 | * @note This class is an experimental feature. The API may change. 36 | */ 37 | struct ndn_EncryptedContent { 38 | ndn_EncryptAlgorithmType algorithmType; /**< -1 for none */ 39 | struct ndn_KeyLocator keyLocator; 40 | struct ndn_Blob initialVector; 41 | struct ndn_Blob payload; 42 | struct ndn_Blob payloadKey; 43 | }; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/lite/util/blob-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/util/blob.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | BlobLite::BlobLite() 28 | { 29 | ndn_Blob_initialize(this, 0, 0); 30 | } 31 | 32 | BlobLite::BlobLite(const uint8_t* buf, size_t size) 33 | { 34 | ndn_Blob_initialize(this, buf, size); 35 | } 36 | 37 | size_t 38 | BlobLite::size() const 39 | { 40 | return ndn_Blob_size(this); 41 | } 42 | 43 | bool 44 | BlobLite::equals(const BlobLite& other) const 45 | { 46 | return ndn_Blob_equals(this, &other) != 0; 47 | } 48 | 49 | size_t 50 | BlobLite::hash(const uint8_t* buf, size_t size) 51 | { 52 | // Imitate Java's ByteBuffer.hashCode().) 53 | size_t result = 1; 54 | for (size_t i = 0; i < size; ++i) 55 | result = 31 * result + (size_t)buf[i]; 56 | 57 | return result; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /python/pyndn/security/v2/certificate_container_interface.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/v2/trust-anchor-group.cpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the CertificateContainerInterface class. 23 | """ 24 | 25 | class CertificateContainerInterface(object): 26 | def add(self, certificate): 27 | """ 28 | Add the certificate to the container. 29 | 30 | :param CertificateV2 certificate: The certificate to add, which is 31 | copied. 32 | """ 33 | raise RuntimeError("CertificateContainerInterface.add is unimplemented") 34 | 35 | def remove(self, certificateName): 36 | """ 37 | Remove the certificate with the given name. If the name does not exist, 38 | do nothing. 39 | 40 | :param Name certificateName: The name of the certificate. 41 | """ 42 | raise RuntimeError("CertificateContainerInterface.remove is unimplemented") 43 | -------------------------------------------------------------------------------- /python/pyndn/security/v2/validation_policy_accept_all.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/v2/validation-policy-accept-all.hpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the ValidationPolicyAcceptAll class which extends 23 | ValidationPolicy to implement a validator policy that accepts any signature of a 24 | Data or Interest packet. 25 | """ 26 | 27 | from pyndn.security.v2.validation_policy import ValidationPolicy 28 | 29 | class ValidationPolicyAcceptAll(ValidationPolicy): 30 | def __init__(self): 31 | super(ValidationPolicyAcceptAll, self).__init__() 32 | 33 | def checkPolicy(self, dataOrInterest, state, continueValidation): 34 | """ 35 | :param dataOrInterest: 36 | :type dataOrInterest: Data or Interest 37 | :param ValidationState state: 38 | :param continueValidation: 39 | :type continueValidation: function object 40 | """ 41 | continueValidation(None, state) 42 | -------------------------------------------------------------------------------- /src/c/registration-options.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2019-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "control-parameters.h" 22 | #include "registration-options.h" 23 | 24 | void ndn_RegistrationOptions_initialize(struct ndn_RegistrationOptions *self) 25 | { 26 | self->childInherit = 1; 27 | self->capture = 0; 28 | self->origin = -1; 29 | } 30 | 31 | int 32 | ndn_RegistrationOptions_getNfdForwardingFlags(const struct ndn_RegistrationOptions *self) 33 | { 34 | int result = 0; 35 | 36 | if (self->childInherit) 37 | result |= ndn_NfdForwardingFlags_CHILD_INHERIT; 38 | if (self->capture) 39 | result |= ndn_NfdForwardingFlags_CAPTURE; 40 | 41 | return result; 42 | } 43 | 44 | void 45 | ndn_RegistrationOptions_setNfdForwardingFlags 46 | (struct ndn_RegistrationOptions *self, int nfdForwardingFlags) 47 | { 48 | self->childInherit = (nfdForwardingFlags & ndn_NfdForwardingFlags_CHILD_INHERIT) ? 1 : 0; 49 | self->capture = (nfdForwardingFlags & ndn_NfdForwardingFlags_CAPTURE) ? 1 : 0; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/py-object-ref.hpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2019 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_PY_OBJECT_REF_HPP 23 | #define NDN_PY_OBJECT_REF_HPP 24 | 25 | #include 26 | 27 | /** 28 | * When PyObjectRef goes out of scope, it calls Py_DECREF on the PyObject given 29 | * to the constructor. 30 | */ 31 | class PyObjectRef { 32 | public: 33 | PyObjectRef() 34 | : obj(0) 35 | {} 36 | 37 | PyObjectRef(PyObject* obj) 38 | : obj(obj) 39 | {} 40 | 41 | ~PyObjectRef() 42 | { 43 | if (obj) 44 | Py_DECREF(obj); 45 | } 46 | 47 | void 48 | reset(PyObject* obj) 49 | { 50 | if (this->obj) 51 | Py_DECREF(this->obj); 52 | this->obj = obj; 53 | } 54 | 55 | operator PyObject*() { return obj; } 56 | 57 | PyObject* obj; 58 | 59 | private: 60 | // Don't allow copying. 61 | PyObjectRef(const PyObjectRef& other); 62 | PyObjectRef& operator=(const PyObjectRef& other); 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/c/control-parameters_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "control-parameters.h" 22 | 23 | ndn_Error 24 | ndn_ControlParameters_setFromControlParameters 25 | (struct ndn_ControlParameters *self, const struct ndn_ControlParameters *other) 26 | { 27 | ndn_Error error; 28 | if (other == self) 29 | // Setting to itself. Do nothing. 30 | return NDN_ERROR_success; 31 | 32 | self->hasName = other->hasName; 33 | if (other->hasName) { 34 | if ((error = ndn_Name_setFromName(&self->name, &other->name))) 35 | return error; 36 | } 37 | self->faceId = other->faceId; 38 | ndn_Blob_setFromBlob(&self->uri, &other->uri); 39 | self->localControlFeature = other->localControlFeature; 40 | self->origin = other->origin; 41 | self->cost = other->cost; 42 | self->flags = other->flags; 43 | if ((error = ndn_Name_setFromName(&self->strategy, &other->strategy))) 44 | return error; 45 | self->expirationPeriod = other->expirationPeriod; 46 | 47 | return NDN_ERROR_success; 48 | } 49 | -------------------------------------------------------------------------------- /src/c/network-nack_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "network-nack.h" 22 | 23 | const struct ndn_NetworkNack * 24 | ndn_NetworkNack_getFirstHeader(const struct ndn_LpPacket *lpPacket) 25 | { 26 | size_t i; 27 | for (i = 0; i < lpPacket->nHeaderFields; ++i) { 28 | const struct ndn_LpPacketHeaderField *field = &lpPacket->headerFields[i]; 29 | if (field->type == ndn_LpPacketHeaderFieldType_NETWORK_NACK) 30 | return &field->networkNack; 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | ndn_Error 37 | ndn_NetworkNack_add 38 | (struct ndn_LpPacket *lpPacket, struct ndn_NetworkNack **networkNack) 39 | { 40 | ndn_Error error; 41 | struct ndn_LpPacketHeaderField *headerField; 42 | 43 | if ((error = ndn_LpPacket_addEmptyHeaderField(lpPacket, &headerField))) 44 | return error; 45 | headerField->type = ndn_LpPacketHeaderFieldType_NETWORK_NACK; 46 | *networkNack = &headerField->networkNack; 47 | ndn_NetworkNack_initialize(*networkNack); 48 | 49 | return NDN_ERROR_success; 50 | } 51 | -------------------------------------------------------------------------------- /src/c/util/ndn_memory.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "ndn_memory.h" 22 | 23 | #if !NDN_CPP_HAVE_MEMCMP 24 | int ndn_memcmp(const uint8_t *buf1, const uint8_t *buf2, size_t len) 25 | { 26 | size_t i; 27 | 28 | for (i = 0; i < len; i++) { 29 | if (buf1[i] > buf2[i]) 30 | return 1; 31 | else if (buf1[i] < buf2[i]) 32 | return -1; 33 | } 34 | 35 | return 0; 36 | } 37 | #else 38 | int ndn_memcmp_stub_to_avoid_empty_file_warning = 0; 39 | #endif 40 | 41 | #if !NDN_CPP_HAVE_MEMCPY 42 | void ndn_memcpy(uint8_t *dest, const uint8_t *src, size_t len) 43 | { 44 | size_t i; 45 | 46 | for (i = 0; i < len; i++) 47 | dest[i] = src[i]; 48 | } 49 | #else 50 | int ndn_memcpy_stub_to_avoid_empty_file_warning = 0; 51 | #endif 52 | 53 | #if !NDN_CPP_HAVE_MEMSET 54 | void ndn_memset(uint8_t *dest, int val, size_t len) 55 | { 56 | size_t i; 57 | 58 | for (i = 0; i < len; i++) 59 | dest[i] = (uint8_t)val; 60 | } 61 | #else 62 | int ndn_memset_stub_to_avoid_empty_file_warning = 0; 63 | #endif 64 | -------------------------------------------------------------------------------- /src/c/encoding/element-listener.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_ELEMENT_LISTENER_H 22 | #define NDN_ELEMENT_LISTENER_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * Initialize an ndn_ElementListener struct to use the onReceivedElement 33 | * function pointer. 34 | * @param self pointer to the ndn_ElementListener struct 35 | * @param onReceivedElement When an entire packet element is received, call 36 | * onReceivedElement(self, element, elementLength) where self is the pointer to 37 | * this ndn_ElementListener struct, and element is a pointer to the array of 38 | * length elementLength with the bytes of the element. 39 | */ 40 | static __inline void ndn_ElementListener_initialize 41 | (struct ndn_ElementListener *self, ndn_OnReceivedElement onReceivedElement) 42 | { 43 | self->onReceivedElement = onReceivedElement; 44 | } 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /examples/control-parameters.proto: -------------------------------------------------------------------------------- 1 | // Compile this file using: 2 | // protoc --python_out=. control-parameters.proto 3 | 4 | package ndn_message; 5 | 6 | // Create ControlParametersTypes so we can define both ControlParametersMessage 7 | // and ControlParametersResponseMessage. 8 | message ControlParametersTypes { 9 | message Name { 10 | repeated bytes component = 8; 11 | } 12 | 13 | message Strategy { 14 | required Name name = 7; 15 | } 16 | 17 | message ControlParameters { 18 | optional Name name = 7; 19 | optional uint64 face_id = 105; 20 | optional string uri = 114; 21 | optional string local_uri = 129; 22 | optional uint64 origin = 111; 23 | optional uint64 cost = 106; 24 | optional uint64 capacity = 131; 25 | optional uint64 count = 132; 26 | optional uint64 flags = 108; 27 | optional uint64 mask = 112; 28 | optional Strategy strategy = 107; 29 | optional uint64 expiration_period = 109; 30 | optional uint64 face_persistency = 133; 31 | optional uint64 base_congestion_marking_interval = 135; 32 | optional uint64 default_congestion_threshold = 136; 33 | optional uint64 mtu = 137; 34 | } 35 | 36 | // A ControlParametersResponse is a ControlResponse where the body is zero or 37 | // more ControlParameters. 38 | message ControlParametersResponse { 39 | required uint64 status_code = 102; 40 | required string status_text = 103; 41 | repeated ControlParameters control_parameters = 104; 42 | } 43 | 44 | // Protobuf has no "outer" message type, so we need to put the TLV ControlParameters 45 | // message inside an outer "typeless" ControlParametersMessage. 46 | message ControlParametersMessage { 47 | // A ControlParametersMessage has one ControlParameters. 48 | required ControlParameters control_parameters = 104; 49 | } 50 | 51 | message ControlParametersResponseMessage { 52 | // A ControlParametersResponseMessage has one ControlParametersResponse. 53 | required ControlParametersResponse control_response = 101; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/encrypt/algo/encrypt-params-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * @author: From ndn-group-encrypt src/encrypt-params https://github.com/named-data/ndn-group-encrypt 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_ENCRYPT_PARAMS_TYPES_H 23 | #define NDN_ENCRYPT_PARAMS_TYPES_H 24 | 25 | #include "../../util/blob-types.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef enum { 32 | // These correspond to the TLV codes. 33 | ndn_EncryptAlgorithmType_AesEcb = 0, 34 | ndn_EncryptAlgorithmType_AesCbc = 1, 35 | ndn_EncryptAlgorithmType_RsaPkcs = 2, 36 | ndn_EncryptAlgorithmType_RsaOaep = 3 37 | } ndn_EncryptAlgorithmType; 38 | 39 | /** 40 | * An ndn_EncryptParams holds an algorithm type and other parameters used to 41 | * encrypt and decrypt. 42 | * @note This class is an experimental feature. The API may change. 43 | */ 44 | struct ndn_EncryptParams { 45 | ndn_EncryptAlgorithmType algorithmType; /**< -1 for none */ 46 | struct ndn_Blob initialVector; 47 | }; 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /doc/pyndn.transport.rst: -------------------------------------------------------------------------------- 1 | pyndn.transport package 2 | ======================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | pyndn.transport.async\_socket\_transport module 8 | ----------------------------------------------- 9 | 10 | .. automodule:: pyndn.transport.async_socket_transport 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pyndn.transport.async\_tcp\_transport module 16 | -------------------------------------------- 17 | 18 | .. automodule:: pyndn.transport.async_tcp_transport 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.transport.async\_unix\_transport module 24 | --------------------------------------------- 25 | 26 | .. automodule:: pyndn.transport.async_unix_transport 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.transport.socket\_poller module 32 | ------------------------------------- 33 | 34 | .. automodule:: pyndn.transport.socket_poller 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pyndn.transport.tcp\_transport module 40 | ------------------------------------- 41 | 42 | .. automodule:: pyndn.transport.tcp_transport 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pyndn.transport.transport module 48 | -------------------------------- 49 | 50 | .. automodule:: pyndn.transport.transport 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pyndn.transport.udp\_transport module 56 | ------------------------------------- 57 | 58 | .. automodule:: pyndn.transport.udp_transport 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pyndn.transport.unix\_transport module 64 | -------------------------------------- 65 | 66 | .. automodule:: pyndn.transport.unix_transport 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | 72 | Module contents 73 | --------------- 74 | 75 | .. automodule:: pyndn.transport 76 | :members: 77 | :undoc-members: 78 | :show-inheritance: 79 | -------------------------------------------------------------------------------- /src/c/lp/congestion-mark_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2018-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "congestion-mark.h" 22 | 23 | const struct ndn_CongestionMark * 24 | ndn_CongestionMark_getFirstHeader(const struct ndn_LpPacket *lpPacket) 25 | { 26 | size_t i; 27 | for (i = 0; i < lpPacket->nHeaderFields; ++i) { 28 | const struct ndn_LpPacketHeaderField *field = &lpPacket->headerFields[i]; 29 | if (field->type == ndn_LpPacketHeaderFieldType_CONGESTION_MARK) 30 | return &field->congestionMark; 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | ndn_Error 37 | ndn_CongestionMark_add 38 | (struct ndn_LpPacket *lpPacket, struct ndn_CongestionMark **congestionMark) 39 | { 40 | ndn_Error error; 41 | struct ndn_LpPacketHeaderField *headerField; 42 | 43 | if ((error = ndn_LpPacket_addEmptyHeaderField(lpPacket, &headerField))) 44 | return error; 45 | headerField->type = ndn_LpPacketHeaderFieldType_CONGESTION_MARK; 46 | *congestionMark = &headerField->congestionMark; 47 | ndn_CongestionMark_initialize(*congestionMark); 48 | 49 | return NDN_ERROR_success; 50 | } 51 | -------------------------------------------------------------------------------- /src/c/lp/incoming-face-id_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "incoming-face-id.h" 22 | 23 | const struct ndn_IncomingFaceId * 24 | ndn_IncomingFaceId_getFirstHeader(const struct ndn_LpPacket *lpPacket) 25 | { 26 | size_t i; 27 | for (i = 0; i < lpPacket->nHeaderFields; ++i) { 28 | const struct ndn_LpPacketHeaderField *field = &lpPacket->headerFields[i]; 29 | if (field->type == ndn_LpPacketHeaderFieldType_INCOMING_FACE_ID) 30 | return &field->incomingFaceId; 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | ndn_Error 37 | ndn_IncomingFaceId_add 38 | (struct ndn_LpPacket *lpPacket, struct ndn_IncomingFaceId **incomingFaceId) 39 | { 40 | ndn_Error error; 41 | struct ndn_LpPacketHeaderField *headerField; 42 | 43 | if ((error = ndn_LpPacket_addEmptyHeaderField(lpPacket, &headerField))) 44 | return error; 45 | headerField->type = ndn_LpPacketHeaderFieldType_INCOMING_FACE_ID; 46 | *incomingFaceId = &headerField->incomingFaceId; 47 | ndn_IncomingFaceId_initialize(*incomingFaceId); 48 | 49 | return NDN_ERROR_success; 50 | } 51 | -------------------------------------------------------------------------------- /src/lite/encoding/tlv-0_2-wire-format-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/encoding/tlv-0_2-wire-format.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | ndn_Error 28 | Tlv0_2WireFormatLite::encodeInterest 29 | (const InterestLite& interest, size_t* signedPortionBeginOffset, 30 | size_t* signedPortionEndOffset, DynamicUInt8ArrayLite& output, 31 | size_t* encodingLength) 32 | { 33 | return ndn_Tlv0_2WireFormat_encodeInterest 34 | (&interest, signedPortionBeginOffset, signedPortionEndOffset, 35 | &output, encodingLength); 36 | } 37 | 38 | ndn_Error 39 | Tlv0_2WireFormatLite::decodeInterest 40 | (InterestLite& interest, const uint8_t* input, size_t inputLength, 41 | size_t* signedPortionBeginOffset, size_t* signedPortionEndOffset) 42 | { 43 | return ndn_Tlv0_2WireFormat_decodeInterest 44 | (&interest, input, inputLength, signedPortionBeginOffset, 45 | signedPortionEndOffset); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /python/pyndn/encrypt/decrypt_key.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2015-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-group-encrypt src/decrypt-key https://github.com/named-data/ndn-group-encrypt 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the EncryptKey class which supplies the key for decrypt. 23 | Note: This class is an experimental feature. The API may change. 24 | """ 25 | 26 | from pyndn.util.blob import Blob 27 | 28 | class DecryptKey(object): 29 | """ 30 | Create a DecryptKey with the given key value. 31 | 32 | :param value: If value is another DecryptKey then copy it. Otherwise, value 33 | is the key value. 34 | :type value: Blob or DecryptKey 35 | """ 36 | def __init__(self, value): 37 | if isinstance(value, DecryptKey): 38 | # Make a deep copy. 39 | self._keyBits = value._keyBits 40 | else: 41 | keyBits = value 42 | self._keyBits = keyBits if isinstance(keyBits, Blob) else Blob(keyBits) 43 | 44 | def getKeyBits(self): 45 | """ 46 | Get the key value. 47 | 48 | :return: The key value. 49 | :rtype: Blob 50 | """ 51 | return self._keyBits 52 | -------------------------------------------------------------------------------- /python/pyndn/encrypt/encrypt_key.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # Author: From ndn-group-encrypt src/encrypt-key https://github.com/named-data/ndn-group-encrypt 3 | # 4 | # Copyright (C) 2015-2019 Regents of the University of California. 5 | # Author: Jeff Thompson 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the EncryptKey class which supplies the key for encrypt. 23 | Note: This class is an experimental feature. The API may change. 24 | """ 25 | 26 | from pyndn.util.blob import Blob 27 | 28 | class EncryptKey(object): 29 | """ 30 | Create an EncryptKey with the given key value. 31 | 32 | :param value: If value is another EncryptKey then copy it. Otherwise, value 33 | is the key value. 34 | :type value: Blob or EncryptKey 35 | """ 36 | def __init__(self, value): 37 | if isinstance(value, EncryptKey): 38 | # Make a deep copy. 39 | self._keyBits = value._keyBits 40 | else: 41 | keyBits = value 42 | self._keyBits = keyBits if isinstance(keyBits, Blob) else Blob(keyBits) 43 | 44 | def getKeyBits(self): 45 | """ 46 | Get the key value. 47 | 48 | :return: The key value. 49 | :rtype: Blob 50 | """ 51 | return self._keyBits 52 | -------------------------------------------------------------------------------- /doc/pyndn.encoding.rst: -------------------------------------------------------------------------------- 1 | pyndn.encoding package 2 | ====================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | pyndn.encoding.der 10 | pyndn.encoding.tlv 11 | 12 | Submodules 13 | ---------- 14 | 15 | pyndn.encoding.element\_reader module 16 | ------------------------------------- 17 | 18 | .. automodule:: pyndn.encoding.element_reader 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pyndn.encoding.oid module 24 | ------------------------- 25 | 26 | .. automodule:: pyndn.encoding.oid 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pyndn.encoding.protobuf\_tlv module 32 | ----------------------------------- 33 | 34 | .. automodule:: pyndn.encoding.protobuf_tlv 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pyndn.encoding.tlv\_0\_1\_1\_wire\_format module 40 | ------------------------------------------------ 41 | 42 | .. automodule:: pyndn.encoding.tlv_0_1_1_wire_format 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pyndn.encoding.tlv\_0\_1\_wire\_format module 48 | --------------------------------------------- 49 | 50 | .. automodule:: pyndn.encoding.tlv_0_1_wire_format 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pyndn.encoding.tlv\_0\_2\_wire\_format module 56 | --------------------------------------------- 57 | 58 | .. automodule:: pyndn.encoding.tlv_0_2_wire_format 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pyndn.encoding.tlv\_wire\_format module 64 | --------------------------------------- 65 | 66 | .. automodule:: pyndn.encoding.tlv_wire_format 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | pyndn.encoding.wire\_format module 72 | ---------------------------------- 73 | 74 | .. automodule:: pyndn.encoding.wire_format 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | 80 | Module contents 81 | --------------- 82 | 83 | .. automodule:: pyndn.encoding 84 | :members: 85 | :undoc-members: 86 | :show-inheritance: 87 | -------------------------------------------------------------------------------- /python/pyndn/security/v2/certificate_fetcher_offline.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2018-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/v2/certificate-fetcher-offline.hpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the CertificateFetcherOffline class which extends 23 | CertificateFetcher to implement a fetcher that does not fetch certificates 24 | (always offline). 25 | """ 26 | 27 | from pyndn.security.v2.validation_error import ValidationError 28 | from pyndn.security.v2.certificate_fetcher import CertificateFetcher 29 | 30 | class CertificateFetcherOffline(CertificateFetcher): 31 | def __init__(self): 32 | super(CertificateFetcherOffline, self).__init__() 33 | 34 | def _doFetch(self, certificateRequest, state, continueValidation): 35 | """ 36 | :type certificateRequest: CertificateRequest 37 | :type state: TValidationState 38 | :type continueValidation: function object 39 | """ 40 | state.fail(ValidationError 41 | (ValidationError.CANNOT_RETRIEVE_CERTIFICATE, 42 | "Cannot fetch certificate " + 43 | certificateRequest._interest.getName().toUri() + " in offline mode")) 44 | -------------------------------------------------------------------------------- /python/pyndn/encoding/oid.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2015-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From code in ndn-cxx by Yingdi Yu 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | class OID(object): 22 | def __init__(self, oid = None): 23 | if oid is None: 24 | self._oid = [] 25 | elif type(oid) is str: 26 | self._oid = [int(p) for p in oid.split('.')] 27 | else: 28 | # Assume oid is an array of int. Make a copy. 29 | self._oid = oid[:] 30 | 31 | def getIntegerList(self): 32 | return self._oid 33 | 34 | def setIntegerList(self, oid): 35 | # Make a copy. 36 | self._oid = oid[:] 37 | 38 | def __str__(self): 39 | result = "" 40 | for i in range(len(self._oid)): 41 | if i != 0: 42 | result += "." 43 | result += repr(self._oid[i]) 44 | 45 | return result 46 | 47 | def __eq__(self, other): 48 | if isinstance(other, OID): 49 | return False 50 | if len(self._oid) != len(other._oid): 51 | return False 52 | 53 | for i in range(len(self._oid)): 54 | if self._oid[i] != other._oid[i]: 55 | return False 56 | 57 | return True 58 | -------------------------------------------------------------------------------- /src/lite/security/validity-period-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2016-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/security/validity-period.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | ValidityPeriodLite::ValidityPeriodLite() 28 | { 29 | ndn_ValidityPeriod_initialize(this); 30 | } 31 | 32 | bool 33 | ValidityPeriodLite::hasPeriod() const 34 | { 35 | return ndn_ValidityPeriod_hasPeriod(this) != 0; 36 | } 37 | 38 | void 39 | ValidityPeriodLite::clear() 40 | { 41 | ndn_ValidityPeriod_clear(this); 42 | } 43 | 44 | ValidityPeriodLite& 45 | ValidityPeriodLite::setPeriod 46 | (ndn_MillisecondsSince1970 notBefore, ndn_MillisecondsSince1970 notAfter) 47 | { 48 | ndn_ValidityPeriod_setPeriod(this, notBefore, notAfter); 49 | return *this; 50 | } 51 | 52 | bool 53 | ValidityPeriodLite::equals(const ValidityPeriodLite& other) const 54 | { 55 | return ndn_ValidityPeriod_equals(this, &other) != 0; 56 | } 57 | 58 | bool 59 | ValidityPeriodLite::isValid(ndn_MillisecondsSince1970 time) const 60 | { 61 | return ndn_ValidityPeriod_isValid(this, time) != 0; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/c/encoding/tlv-0_3-wire-format_c.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #include "tlv/tlv-interest.h" 22 | #include "tlv-0_3-wire-format.h" 23 | 24 | ndn_Error 25 | ndn_Tlv0_3WireFormat_encodeInterest 26 | (const struct ndn_Interest *interest, size_t *signedPortionBeginOffset, 27 | size_t *signedPortionEndOffset, struct ndn_DynamicUInt8Array *output, 28 | size_t *encodingLength) 29 | { 30 | ndn_Error error; 31 | struct ndn_TlvEncoder encoder; 32 | ndn_TlvEncoder_initialize(&encoder, output); 33 | error = ndn_encodeTlvInterestV0_3 34 | (interest, signedPortionBeginOffset, signedPortionEndOffset, &encoder); 35 | *encodingLength = encoder.offset; 36 | 37 | return error; 38 | } 39 | 40 | ndn_Error 41 | ndn_Tlv0_3WireFormat_decodeInterest 42 | (struct ndn_Interest *interest, const uint8_t *input, size_t inputLength, 43 | size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset) 44 | { 45 | struct ndn_TlvDecoder decoder; 46 | ndn_TlvDecoder_initialize(&decoder, input, inputLength); 47 | // ndn_decodeTlvInterest decodes as v0.3, and as v0.2 if that fails. 48 | return ndn_decodeTlvInterest 49 | (interest, signedPortionBeginOffset, signedPortionEndOffset, &decoder); 50 | } 51 | -------------------------------------------------------------------------------- /python/pyndn/security/policy/validation_request.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # From ndn-cxx security by Yingdi Yu . 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the ValidationRequest class which is used to return 23 | information from PolicyManager.checkVerificationPolicy. 24 | """ 25 | 26 | class ValidationRequest(object): 27 | """ 28 | Create a new ValidationRequest with the given values. 29 | 30 | :param Interest interest: An interest for fetching more data. 31 | :param onVerified: If the signature is verified, this calls 32 | onVerified(data). 33 | :type onVerified: function object 34 | :param onValidationFailed: If the signature check fails, this calls 35 | onValidationFailed(data, reason). 36 | :type onValidationFailed: function object 37 | :param int retry: 38 | :param int stepCount: The number of verification steps that have been done, 39 | used to track the verification progress. 40 | """ 41 | def __init__(self, interest, onVerified, onValidationFailed, retry, stepCount): 42 | self.interest = interest 43 | self.onVerified = onVerified 44 | self.onValidationFailed = onValidationFailed 45 | self.retry = retry 46 | self.stepCount = stepCount 47 | -------------------------------------------------------------------------------- /python/pyndn/security/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.security import command_interest_signer 21 | from pyndn.security import key_chain, key_id_type, key_params, safe_bag 22 | from pyndn.security import security_exception, security_types, signing_info 23 | from pyndn.security import validator_config_error, validator_config, validator_null 24 | __all__ = ['command_interest_signer', 'key_chain', 'key_id_type', 'key_params', 25 | 'safe_bag', 'security_exception', 'security_types', 'signing_info', 26 | 'validator_config_error', 'validator_config', 'validator_null'] 27 | 28 | import sys as _sys 29 | 30 | try: 31 | from pyndn.security.command_interest_signer import * 32 | from pyndn.security.key_chain import * 33 | from pyndn.security.key_id_type import * 34 | from pyndn.security.key_params import * 35 | from pyndn.security.safe_bag import * 36 | from pyndn.security.security_exception import * 37 | from pyndn.security.security_types import * 38 | from pyndn.security.signing_info import * 39 | from pyndn.security.validator_config_error import * 40 | from pyndn.security.validator_config import * 41 | from pyndn.security.validator_null import * 42 | except ImportError: 43 | del _sys.modules[__name__] 44 | raise 45 | -------------------------------------------------------------------------------- /include/ndn-cpp/c/network-nack-types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * @author: From ndn-cxx nack.hpp https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/lp/nack.hpp 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #ifndef NDN_NETWORK_NACK_TYPES_H 23 | #define NDN_NETWORK_NACK_TYPES_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * ndn_NetworkNackReason specifies the reason in a NetworkNack packet. If the 31 | * reason code in the packet is not a recognized enum value, then we use 32 | * ndn_NetworkNackReason_OTHER_CODE and you can call getOtherReasonCode(). We do 33 | * this to keep the recognized reason values independent of packet encoding 34 | * formats. 35 | */ 36 | typedef enum { 37 | ndn_NetworkNackReason_NONE = 0, 38 | ndn_NetworkNackReason_CONGESTION = 50, 39 | ndn_NetworkNackReason_DUPLICATE = 100, 40 | ndn_NetworkNackReason_NO_ROUTE = 150, 41 | ndn_NetworkNackReason_OTHER_CODE = 0x7fff 42 | } ndn_NetworkNackReason; 43 | 44 | /** 45 | * An ndn_NetworkNack represents a network Nack packet and includes a Nack 46 | * reason. 47 | */ 48 | struct ndn_NetworkNack { 49 | ndn_NetworkNackReason reason; 50 | int otherReasonCode; 51 | }; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /python/pyndn/encoding/tlv_wire_format.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.encoding.wire_format import WireFormat 21 | from pyndn.encoding.tlv_0_3_wire_format import Tlv0_3WireFormat 22 | 23 | """ 24 | This module defines the TlvWireFormat class which extends WireFormat to override 25 | its methods to implement encoding and decoding using the preferred 26 | implementation of NDN-TLV. 27 | """ 28 | 29 | class TlvWireFormat(Tlv0_3WireFormat): 30 | _instance = None 31 | 32 | @classmethod 33 | def get(self): 34 | """ 35 | Get a singleton instance of a TlvWireFormat. Assuming that the default 36 | wire format was set with 37 | WireFormat.setDefaultWireFormat(TlvWireFormat.get()), you can check if 38 | this is the default wire encoding with 39 | if WireFormat.getDefaultWireFormat() == TlvWireFormat.get(). 40 | 41 | :return: The singleton instance. 42 | :rtype: TlvWireFormat 43 | """ 44 | if self._instance == None: 45 | self._instance = TlvWireFormat() 46 | return self._instance 47 | 48 | # On loading this module, make this the default wire format. 49 | # This module will be loaded because __init__.py loads it. 50 | WireFormat.setDefaultWireFormat(TlvWireFormat.get()) 51 | -------------------------------------------------------------------------------- /python/pyndn/security/v2/certificate_request.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # Author: From ndn-cxx security https://github.com/named-data/ndn-cxx/blob/master/ndn-cxx/security/v2/certificate-request.hpp 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | """ 22 | This module defines the CertificateRequest class which represents a request for 23 | a certificate, associated with the number of retries left. The _interest and 24 | _nRetriesLeft fields are public so that you can modify them. _interest is the 25 | Interest for the requested Data packet or Certificate, and _nRetriesLeft is the 26 | number of remaining retries after a timeout or NACK. 27 | """ 28 | 29 | from pyndn.interest import Interest 30 | 31 | class CertificateRequest(object): 32 | """ 33 | Create a CertificateRequest with an optional Interest. 34 | 35 | :param Interest interest: (optional) If supplied, create a 36 | CertificateRequest with a copy of the interest and 3 retries left. Of 37 | omitted, create a CertificateRequest with a default Interest object and 0 38 | retries left. 39 | """ 40 | def __init__(self, interest): 41 | if interest != None: 42 | self._interest = Interest(interest) 43 | self._nRetriesLeft = 3 44 | else: 45 | self._interest = Interest() 46 | self._nRetriesLeft = 0 47 | -------------------------------------------------------------------------------- /python/pyndn/security/identity/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2014-2019 Regents of the University of California. 4 | # Author: Jeff Thompson 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with this program. If not, see . 18 | # A copy of the GNU Lesser General Public License is in the file COPYING. 19 | 20 | from pyndn.security.identity import basic_identity_storage, file_private_key_storage 21 | from pyndn.security.identity import identity_manager, identity_storage, memory_identity_storage 22 | from pyndn.security.identity import memory_private_key_storage, osx_private_key_storage 23 | from pyndn.security.identity import private_key_storage 24 | __all__ = ['basic_identity_storage', 'file_private_key_storage', 25 | 'identity_manager', 'identity_storage', 'memory_identity_storage', 26 | 'memory_private_key_storage', 'osx_private_key_storage', 27 | 'private_key_storage'] 28 | 29 | import sys as _sys 30 | 31 | try: 32 | from pyndn.security.identity.basic_identity_storage import * 33 | from pyndn.security.identity.file_private_key_storage import * 34 | from pyndn.security.identity.identity_manager import * 35 | from pyndn.security.identity.identity_storage import * 36 | from pyndn.security.identity.memory_identity_storage import * 37 | from pyndn.security.identity.memory_private_key_storage import * 38 | from pyndn.security.identity.osx_private_key_storage import * 39 | from pyndn.security.identity.private_key_storage import * 40 | except ImportError: 41 | del _sys.modules[__name__] 42 | raise 43 | -------------------------------------------------------------------------------- /src/lite/util/dynamic-uint8-array-lite.cpp: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | /** 3 | * Copyright (C) 2015-2020 Regents of the University of California. 4 | * @author: Jeff Thompson 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version, with the additional exemption that 10 | * compiling, linking, and/or using OpenSSL is allowed. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program. If not, see . 19 | * A copy of the GNU Lesser General Public License is in the file COPYING. 20 | */ 21 | 22 | #include "../../c/util/dynamic-uint8-array.h" 23 | #include 24 | 25 | namespace ndn { 26 | 27 | DynamicUInt8ArrayLite::DynamicUInt8ArrayLite 28 | (uint8_t *array, size_t length, ndn_ReallocFunction reallocFunction) 29 | { 30 | ndn_DynamicUInt8Array_initialize(this, array, length, reallocFunction); 31 | } 32 | 33 | ndn_Error 34 | DynamicUInt8ArrayLite::ensureLength(size_t length) 35 | { 36 | return ndn_DynamicUInt8Array_ensureLength(this, length); 37 | } 38 | 39 | ndn_Error 40 | DynamicUInt8ArrayLite::copy 41 | (const uint8_t *value, size_t valueLength, size_t offset) 42 | { 43 | return ndn_DynamicUInt8Array_copy(this, value, valueLength, offset); 44 | } 45 | 46 | ndn_Error 47 | DynamicUInt8ArrayLite::ensureLengthFromBack(size_t length) 48 | { 49 | return ndn_DynamicUInt8Array_ensureLengthFromBack(this, length); 50 | } 51 | 52 | ndn_Error 53 | DynamicUInt8ArrayLite::copyFromBack 54 | (const uint8_t *value, size_t valueLength, size_t offsetFromBack) 55 | { 56 | return ndn_DynamicUInt8Array_copyFromBack 57 | (this, value, valueLength, offsetFromBack); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/c/encoding/tlv/tlv-signature-info.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014-2020 Regents of the University of California. 3 | * @author: Jeff Thompson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version, with the additional exemption that 9 | * compiling, linking, and/or using OpenSSL is allowed. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | * A copy of the GNU Lesser General Public License is in the file COPYING. 19 | */ 20 | 21 | #ifndef NDN_TLV_SIGNATURE_INFO_H 22 | #define NDN_TLV_SIGNATURE_INFO_H 23 | 24 | #include "../../data.h" 25 | #include "tlv-encoder.h" 26 | #include "tlv-decoder.h" 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /** 33 | * Encode signatureInfo as an NDN-TLV SignatureInfo. 34 | * @param signatureInfo A pointer to the ndn_Signature struct to encode. 35 | * @param encoder A pointer to the ndn_TlvEncoder struct which receives the 36 | * encoding. 37 | * @return 0 for success, else an error code. 38 | */ 39 | ndn_Error 40 | ndn_encodeTlvSignatureInfo 41 | (const struct ndn_Signature *signatureInfo, struct ndn_TlvEncoder *encoder); 42 | 43 | /** 44 | * Decode as an NDN-TLV SignatureInfo and set the fields in signatureInfo. 45 | * @param signatureInfo A pointer to the ndn_Signature struct to receive the 46 | * values. 47 | * @param decoder A pointer to the ndn_TlvDecoder struct which has been 48 | * initialized with the buffer to decode. 49 | * @return 0 for success, else an error code. 50 | */ 51 | ndn_Error 52 | ndn_decodeTlvSignatureInfo 53 | (struct ndn_Signature *signatureInfo, struct ndn_TlvDecoder *decoder); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /python/pyndn/util/regex/ndn_regex_backref_matcher.py: -------------------------------------------------------------------------------- 1 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ 2 | # 3 | # Copyright (C) 2017-2019 Regents of the University of California. 4 | # Author: Yingdi Yu 5 | # Author: Jeff Thompson 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see . 19 | # A copy of the GNU Lesser General Public License is in the file COPYING. 20 | 21 | from pyndn.util.regex.ndn_regex_matcher_base import NdnRegexMatcherBase 22 | 23 | class NdnRegexBackrefMatcher(NdnRegexMatcherBase): 24 | """ 25 | Create an NdnRegexBackrefMatcher. 26 | 27 | :param str expr: 28 | :param NdnRegexBackrefManager backrefManager: 29 | """ 30 | def __init__(self, expr, backrefManager): 31 | super(NdnRegexBackrefMatcher, self).__init__( 32 | expr, NdnRegexMatcherBase.NdnRegexExprType.BACKREF, backrefManager) 33 | 34 | def lateCompile(self): 35 | self._compile() 36 | 37 | def _compile(self): 38 | if len(self._expr) < 2: 39 | raise NdnRegexMatcherBase.Error("Unrecognized format: " + self._expr) 40 | 41 | lastIndex = len(self._expr) - 1 42 | if '(' == self._expr[0] and ')' == self._expr[lastIndex]: 43 | matcher = NdnRegexPatternListMatcher( 44 | self._expr[1:lastIndex], self._backrefManager) 45 | self._matchers.append(matcher) 46 | else: 47 | raise NdnRegexMatcherBase.Error("Unrecognized format: " + self._expr) 48 | 49 | # Put this last to avoid an import loop. 50 | from pyndn.util.regex.ndn_regex_pattern_list_matcher import NdnRegexPatternListMatcher 51 | --------------------------------------------------------------------------------