├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── PULL_REQUEST_TEMPLATE.md └── stale.yml ├── .gitignore ├── .travis.yml ├── CERTIFICATE ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── build.rs ├── protos └── lib.proto ├── rustfmt.toml └── src └── lib.rs /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of 9 | experience, 10 | education, socio-economic status, nationality, personal appearance, race, 11 | religion, or sexual identity and orientation. 12 | 13 | ## Our Standards 14 | 15 | Examples of behavior that contributes to creating a positive environment 16 | include: 17 | 18 | - Using welcoming and inclusive language 19 | - Being respectful of differing viewpoints and experiences 20 | - Gracefully accepting constructive criticism 21 | - Focusing on what is best for the community 22 | - Showing empathy towards other community members 23 | 24 | Examples of unacceptable behavior by participants include: 25 | 26 | - The use of sexualized language or imagery and unwelcome sexual attention or 27 | advances 28 | - Trolling, insulting/derogatory comments, and personal or political attacks 29 | - Public or private harassment 30 | - Publishing others' private information, such as a physical or electronic 31 | address, without explicit permission 32 | - Other conduct which could reasonably be considered inappropriate in a 33 | professional setting 34 | 35 | 36 | ## Our Responsibilities 37 | 38 | Project maintainers are responsible for clarifying the standards of acceptable 39 | behavior and are expected to take appropriate and fair corrective action in 40 | response to any instances of unacceptable behavior. 41 | 42 | Project maintainers have the right and responsibility to remove, edit, or 43 | reject comments, commits, code, wiki edits, issues, and other contributions 44 | that are not aligned to this Code of Conduct, or to ban temporarily or 45 | permanently any contributor for other behaviors that they deem inappropriate, 46 | threatening, offensive, or harmful. 47 | 48 | ## Scope 49 | 50 | This Code of Conduct applies both within project spaces and in public spaces 51 | when an individual is representing the project or its community. Examples of 52 | representing a project or community include using an official project e-mail 53 | address, posting via an official social media account, or acting as an appointed 54 | representative at an online or offline event. Representation of a project may be 55 | further defined and clarified by project maintainers. 56 | 57 | ## Enforcement 58 | 59 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 60 | reported by contacting the project team at yoshuawuyts@gmail.com, or through 61 | IRC. All complaints will be reviewed and investigated and will result in a 62 | response that is deemed necessary and appropriate to the circumstances. The 63 | project team is obligated to maintain confidentiality with regard to the 64 | reporter of an incident. 65 | Further details of specific enforcement policies may be posted separately. 66 | 67 | Project maintainers who do not follow or enforce the Code of Conduct in good 68 | faith may face temporary or permanent repercussions as determined by other 69 | members of the project's leadership. 70 | 71 | ## Attribution 72 | 73 | This Code of Conduct is adapted from the Contributor Covenant, version 1.4, 74 | available at 75 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 76 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | Contributions include code, documentation, answering user questions, running the 3 | project's infrastructure, and advocating for all types of users. 4 | 5 | The project welcomes all contributions from anyone willing to work in good faith 6 | with other contributors and the community. No contribution is too small and all 7 | contributions are valued. 8 | 9 | This guide explains the process for contributing to the project's GitHub 10 | Repository. 11 | 12 | - [Code of Conduct](#code-of-conduct) 13 | - [Bad Actors](#bad-actors) 14 | - [Developer Certificate of Origin](#developer-certificate-of-origin) 15 | 16 | ## Code of Conduct 17 | The project has a [Code of Conduct][./CODE_OF_CONDUCT.md] that *all* 18 | contributors are expected to follow. This code describes the *minimum* behavior 19 | expectations for all contributors. 20 | 21 | As a contributor, how you choose to act and interact towards your 22 | fellow contributors, as well as to the community, will reflect back not only 23 | on yourself but on the project as a whole. The Code of Conduct is designed and 24 | intended, above all else, to help establish a culture within the project that 25 | allows anyone and everyone who wants to contribute to feel safe doing so. 26 | 27 | Should any individual act in any way that is considered in violation of the 28 | [Code of Conduct][./CODE_OF_CONDUCT.md], corrective actions will be taken. It is 29 | possible, however, for any individual to *act* in such a manner that is not in 30 | violation of the strict letter of the Code of Conduct guidelines while still 31 | going completely against the spirit of what that Code is intended to accomplish. 32 | 33 | Open, diverse, and inclusive communities live and die on the basis of trust. 34 | Contributors can disagree with one another so long as they trust that those 35 | disagreements are in good faith and everyone is working towards a common 36 | goal. 37 | 38 | ## Bad Actors 39 | All contributors to tacitly agree to abide by both the letter and 40 | spirit of the [Code of Conduct][./CODE_OF_CONDUCT.md]. Failure, or 41 | unwillingness, to do so will result in contributions being respectfully 42 | declined. 43 | 44 | A *bad actor* is someone who repeatedly violates the *spirit* of the Code of 45 | Conduct through consistent failure to self-regulate the way in which they 46 | interact with other contributors in the project. In doing so, bad actors 47 | alienate other contributors, discourage collaboration, and generally reflect 48 | poorly on the project as a whole. 49 | 50 | Being a bad actor may be intentional or unintentional. Typically, unintentional 51 | bad behavior can be easily corrected by being quick to apologize and correct 52 | course *even if you are not entirely convinced you need to*. Giving other 53 | contributors the benefit of the doubt and having a sincere willingness to admit 54 | that you *might* be wrong is critical for any successful open collaboration. 55 | 56 | Don't be a bad actor. 57 | 58 | ## Developer Certificate of Origin 59 | All contributors must read and agree to the [Developer Certificate of 60 | Origin (DCO)](../CERTIFICATE). 61 | 62 | The DCO allows us to accept contributions from people to the project, similarly 63 | to how a license allows us to distribute our code. 64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Summary 2 | Explain what is going on. 3 | 4 | ## Your Environment 5 | | Software | Version(s) | 6 | | ---------------- | ---------- | 7 | | dat-network-protocol | 8 | | Rustc | 9 | | Operating System | 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Did something not work as expected? 4 | --- 5 | 6 | # Bug Report 7 | ## Your Environment 8 | | Software | Version(s) | 9 | | ---------------- | ---------- | 10 | | dat-network-protocol | 11 | | Rustc | 12 | | Operating System | 13 | 14 | ## Expected Behavior 15 | Tell us what should have happened. 16 | 17 | ## Current Behavior 18 | Tell us what happens instead of the expected behavior. If you are seeing an 19 | error, please include the full error message and stack trace. 20 | 21 | ## Code Sample 22 | Please provide a code repository, gist, code snippet or sample files to 23 | reproduce the issue. 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Want us to add something to dat-network-protocol? 4 | --- 5 | 6 | # Feature Request 7 | ## Summary 8 | One paragraph explanation of the feature. 9 | 10 | ## Motivation 11 | Why are we doing this? What use cases does it support? What is the expected 12 | outcome? 13 | 14 | ## Expected Behavior 15 | Tell us how the feature should work. Explain the feature largely in terms of 16 | examples. 17 | 18 | ## Drawbacks 19 | Why should we _not_ do this? 20 | 21 | ## Rationale and alternatives 22 | - Why is this design the best in the space of possible designs? 23 | - What other designs have been considered and what is the rationale for not 24 | choosing them? 25 | - What is the impact of not doing this? 26 | 27 | ## Unresolved Questions 28 | What related issues do you consider out of scope for this feature that could be 29 | addressed in the future independently of the solution that comes out of this 30 | feature? 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Have any questions regarding how dat-network-protocol works? 4 | --- 5 | 6 | # Question 7 | ## Your Environment 8 | | Software | Version(s) | 9 | | ---------------- | ---------- | 10 | | dat-network-protocol | 11 | | Rustc | 12 | | Operating System | 13 | 14 | ## Question 15 | Provide your question here. 16 | 17 | ## Context 18 | How has this issue affected you? What are you trying to accomplish? 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | **Choose one:** is this a 🐛 bug fix, a 🙋 feature, or a 🔦 documentation change? 8 | 9 | 10 | 11 | ## Checklist 12 | 13 | - [ ] tests pass 14 | - [ ] tests and/or benchmarks are included 15 | - [ ] documentation is changed or added 16 | 17 | ## Context 18 | 19 | 20 | ## Semver Changes 21 | 22 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | daysUntilStale: 90 4 | daysUntilClose: 7 5 | exemptLabels: 6 | - pinned 7 | - security 8 | exemptProjects: false 9 | exemptMilestones: false 10 | staleLabel: wontfix 11 | markComment: > 12 | This issue has been automatically marked as stale because it has not had 13 | recent activity. It will be closed if no further activity occurs. Thank you 14 | for your contributions. 15 | unmarkComment: false 16 | closeComment: false 17 | limitPerRun: 30 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | tmp/ 4 | dist/ 5 | npm-debug.log* 6 | .DS_Store 7 | .nyc_output 8 | target/ 9 | Cargo.lock 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | rust: 3 | - stable 4 | 5 | before_script: | 6 | rustup component add rustfmt && 7 | rustup component add clippy 8 | script: | 9 | cargo fmt -- --check && 10 | cargo clippy -- -D clippy::all && 11 | cargo build --verbose && 12 | cargo test --verbose 13 | cache: cargo 14 | -------------------------------------------------------------------------------- /CERTIFICATE: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 1 Letterman Drive 6 | Suite D4700 7 | San Francisco, CA, 94129 8 | 9 | Everyone is permitted to copy and distribute verbatim copies of this 10 | license document, but changing it is not allowed. 11 | 12 | 13 | Developer's Certificate of Origin 1.1 14 | 15 | By making a contribution to this project, I certify that: 16 | 17 | (a) The contribution was created in whole or in part by me and I 18 | have the right to submit it under the open source license 19 | indicated in the file; or 20 | 21 | (b) The contribution is based upon previous work that, to the best 22 | of my knowledge, is covered under an appropriate open source 23 | license and I have the right under that license to submit that 24 | work with modifications, whether created in whole or in part 25 | by me, under the same open source license (unless I am 26 | permitted to submit under a different license), as indicated 27 | in the file; or 28 | 29 | (c) The contribution was provided directly to me by some other 30 | person who certified (a), (b) or (c) and I have not modified 31 | it. 32 | 33 | (d) I understand and agree that this project and the contribution 34 | are public and that a record of the contribution (including all 35 | personal information I submit with it, including my sign-off) is 36 | maintained indefinitely and may be redistributed consistent with 37 | this project or the open source license(s) involved. 38 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2020-02-19, Version 0.3.0 2 | ### Commits 3 | - [[`868fcc3c7b`](https://github.com/datrs/dat-network-protocol/commit/868fcc3c7b2d87fb8fac24dd6b08b1324912f281)] (cargo-release) version 0.3.0 (Bruno Tavares) 4 | - [[`68addf1b83`](https://github.com/datrs/dat-network-protocol/commit/68addf1b83eb4a378496633a514b725fbd859cd3)] Merge pull request #9 from bltavares/update-schema (Bruno Tavares) 5 | - [[`4186bb6c61`](https://github.com/datrs/dat-network-protocol/commit/4186bb6c61bd95185f6427e498787dd5c7f392e8)] Update schema proto file (Bruno Tavares) 6 | - [[`ed9b1dfdda`](https://github.com/datrs/dat-network-protocol/commit/ed9b1dfddad5e23d82f4b54019b64dba6e2661d7)] Update changelog (Bruno Tavares) 7 | 8 | ### Stats 9 | ```diff 10 | CHANGELOG.md | 29 +- 11 | Cargo.toml | 3 +- 12 | README.md | 2 +- 13 | build.rs | 28 +- 14 | protos/cancel.proto | 5 +- 15 | protos/data.proto | 12 +- 16 | protos/feed.proto | 4 +- 17 | protos/handshake.proto | 8 +- 18 | protos/have.proto | 5 +- 19 | protos/info.proto | 4 +- 20 | protos/lib.proto | 87 +- 21 | protos/request.proto | 6 +- 22 | protos/unhave.proto | 4 +- 23 | protos/unwant.proto | 4 +- 24 | protos/want.proto | 4 +- 25 | src/cancel.rs | 297 +----- 26 | src/data.rs | 641 +---------- 27 | src/feed.rs | 283 +---- 28 | src/handshake.rs | 362 +------ 29 | src/have.rs | 310 +----- 30 | src/info.rs | 255 +---- 31 | src/lib.rs | 3140 ++++++++++++++++++++++++++++++++++++++++++++++++- 32 | src/request.rs | 337 +----- 33 | src/unhave.rs | 258 +---- 34 | src/unwant.rs | 258 +---- 35 | src/want.rs | 257 +---- 36 | 26 files changed, 3250 insertions(+), 3353 deletions(-) 37 | ``` 38 | 39 | 40 | ## 2020-02-19, Version 0.2.0 41 | ### Commits 42 | - [[`965338ae75`](https://github.com/datrs/dat-network-protocol/commit/965338ae75b36274c6c888ea69565a172cee8e1b)] Merge pull request #8 from bltavares/bump (Bruno Tavares) 43 | - [[`ed44347713`](https://github.com/datrs/dat-network-protocol/commit/ed4434771306b515f9010dc1ed79e9b153e887ac)] Bump to 2018 edition (Bruno Tavares) 44 | - [[`2de6266452`](https://github.com/datrs/dat-network-protocol/commit/2de626645211ac9db23666388df1a07d95f60ec1)] Fix travis build (Bruno Tavares) 45 | - [[`50d68e3f30`](https://github.com/datrs/dat-network-protocol/commit/50d68e3f30422740168bf5c5b2e84b6de952b6bb)] Migrate codegen to pure-rust generator (Bruno Tavares) 46 | - [[`808778d352`](https://github.com/datrs/dat-network-protocol/commit/808778d3525c70ba3798c63f9059eb02a7533b72)] Update protobuf requirement from ~1.5 to ~2.0 (#5) (dependabot[bot]) 47 | 48 | ### Stats 49 | ```diff 50 | .travis.yml | 6 +- 51 | Cargo.toml | 7 +- 52 | build.rs | 12 +- 53 | protos/feed.proto | 2 +- 54 | src/cancel.rs | 134 ++++++++++--------------- 55 | src/data.rs | 295 ++++++++++++++++++++++--------------------------------- 56 | src/feed.rs | 122 ++++++++++------------- 57 | src/handshake.rs | 168 +++++++++++++------------------ 58 | src/have.rs | 140 +++++++++++--------------- 59 | src/info.rs | 113 +++++++++------------ 60 | src/lib.rs | 2 +- 61 | src/request.rs | 156 ++++++++++++----------------- 62 | src/unhave.rs | 113 +++++++++------------ 63 | src/unwant.rs | 113 +++++++++------------ 64 | src/want.rs | 112 +++++++++------------ 65 | 15 files changed, 657 insertions(+), 838 deletions(-) 66 | ``` 67 | 68 | 69 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dat-network-protocol" 3 | description = "Dat Network Protocol protobuf definitions." 4 | version = "0.3.0" 5 | repository = "https://github.com/datrs/dat-network-protocol" 6 | authors = ["Yoshua Wuyts "] 7 | license = "MIT OR Apache-2.0" 8 | readme = "README.md" 9 | edition = "2018" 10 | 11 | [dependencies] 12 | protobuf = "=2.10.1" 13 | 14 | [build-dependencies] 15 | protobuf-codegen-pure = "=2.10.1" 16 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2018 Yoshua Wuyts 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Yoshua Wuyts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dat-network-protocol 2 | [![crates.io version][1]][2] [![build status][3]][4] 3 | [![downloads][5]][6] [![docs.rs docs][7]][8] 4 | 5 | Dat Network Protocol protobuf definitions. 6 | 7 | Includes a Noise handshake, and is not backwards compatible with Hypercore <= 7 8 | 9 | ## Installation 10 | ```sh 11 | $ cargo add dat-network-protocol 12 | ``` 13 | 14 | ## Links 15 | - [documentation][8] 16 | - [crate][2] 17 | 18 | ## Further Reading 19 | - https://github.com/datproject/docs/blob/master/papers/dat-paper.md 20 | 21 | ## License 22 | [MIT](./LICENSE-MIT) OR [Apache-2.0](./LICENSE-APACHE) 23 | 24 | [1]: https://img.shields.io/crates/v/dat-network-protocol.svg?style=flat-square 25 | [2]: https://crates.io/crate/dat-network-protocol 26 | [3]: https://img.shields.io/travis/datrs/dat-network-protocol.svg?style=flat-square 27 | [4]: https://travis-ci.org/datrs/dat-network-protocol 28 | [5]: https://img.shields.io/crates/d/dat-network-protocol.svg?style=flat-square 29 | [6]: https://crates.io/crates/dat-network-protocol 30 | [7]: https://docs.rs/dat-network-protocol/badge.svg 31 | [8]: https://docs.rs/dat-network-protocol 32 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | // Uncomment method below for like local builds. 2 | fn main() -> Result<(), Box> { 3 | // protobuf_codegen_pure::run(protobuf_codegen_pure::Args { 4 | // out_dir: "src", 5 | // input: &["protos/lib.proto"], 6 | // customize: protobuf_codegen_pure::Customize { 7 | // ..Default::default() 8 | // }, 9 | // includes: &["protos"], 10 | // })?; 11 | Ok(()) 12 | } 13 | -------------------------------------------------------------------------------- /protos/lib.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | // Sent as part of the noise protocol. 4 | message NoisePayload { 5 | required bytes nonce = 1; 6 | } 7 | 8 | // type=0 9 | message Open { 10 | required bytes discoveryKey = 1; 11 | optional bytes capability = 2; 12 | } 13 | 14 | // type=1, overall feed options. can be sent multiple times 15 | message Options { 16 | repeated string extensions = 1; // Should be sorted lexicographically 17 | optional bool ack = 2; // Should all blocks be explicitly acknowledged? 18 | } 19 | 20 | // type=2, message indicating state changes etc. 21 | // initial state for uploading/downloading is true 22 | message Status { 23 | optional bool uploading = 1; 24 | optional bool downloading = 2; 25 | } 26 | 27 | // type=3, what do we have? 28 | message Have { 29 | required uint64 start = 1; 30 | optional uint64 length = 2 [default = 1]; // defaults to 1 31 | optional bytes bitfield = 3; 32 | optional bool ack = 4; // when true, this Have message is an acknowledgement 33 | } 34 | 35 | // type=4, what did we lose? 36 | message Unhave { 37 | required uint64 start = 1; 38 | optional uint64 length = 2 [default = 1]; // defaults to 1 39 | } 40 | 41 | // type=5, what do we want? remote should start sending have messages in this range 42 | message Want { 43 | required uint64 start = 1; 44 | optional uint64 length = 2; // defaults to Infinity or feed.length (if not live) 45 | } 46 | 47 | // type=6, what don't we want anymore? 48 | message Unwant { 49 | required uint64 start = 1; 50 | optional uint64 length = 2; // defaults to Infinity or feed.length (if not live) 51 | } 52 | 53 | // type=7, ask for data 54 | message Request { 55 | required uint64 index = 1; 56 | optional uint64 bytes = 2; 57 | optional bool hash = 3; 58 | optional uint64 nodes = 4; 59 | } 60 | 61 | // type=8, cancel a request 62 | message Cancel { 63 | required uint64 index = 1; 64 | optional uint64 bytes = 2; 65 | optional bool hash = 3; 66 | } 67 | 68 | // type=9, get some data 69 | message Data { 70 | message Node { 71 | required uint64 index = 1; 72 | required bytes hash = 2; 73 | required uint64 size = 3; 74 | } 75 | 76 | required uint64 index = 1; 77 | optional bytes value = 2; 78 | repeated Node nodes = 3; 79 | optional bytes signature = 4; 80 | } 81 | 82 | // type=10, explicitly close a channel. 83 | message Close { 84 | optional bytes discoveryKey = 1; // only send this if you did not do an open 85 | } 86 | 87 | // type=15, extension message -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 80 2 | tab_spaces = 2 3 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.10.1. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `lib.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct NoisePayload { 31 | // message fields 32 | nonce: ::protobuf::SingularField<::std::vec::Vec>, 33 | // special fields 34 | pub unknown_fields: ::protobuf::UnknownFields, 35 | pub cached_size: ::protobuf::CachedSize, 36 | } 37 | 38 | impl<'a> ::std::default::Default for &'a NoisePayload { 39 | fn default() -> &'a NoisePayload { 40 | ::default_instance() 41 | } 42 | } 43 | 44 | impl NoisePayload { 45 | pub fn new() -> NoisePayload { 46 | ::std::default::Default::default() 47 | } 48 | 49 | // required bytes nonce = 1; 50 | 51 | 52 | pub fn get_nonce(&self) -> &[u8] { 53 | match self.nonce.as_ref() { 54 | Some(v) => &v, 55 | None => &[], 56 | } 57 | } 58 | pub fn clear_nonce(&mut self) { 59 | self.nonce.clear(); 60 | } 61 | 62 | pub fn has_nonce(&self) -> bool { 63 | self.nonce.is_some() 64 | } 65 | 66 | // Param is passed by value, moved 67 | pub fn set_nonce(&mut self, v: ::std::vec::Vec) { 68 | self.nonce = ::protobuf::SingularField::some(v); 69 | } 70 | 71 | // Mutable pointer to the field. 72 | // If field is not initialized, it is initialized with default value first. 73 | pub fn mut_nonce(&mut self) -> &mut ::std::vec::Vec { 74 | if self.nonce.is_none() { 75 | self.nonce.set_default(); 76 | } 77 | self.nonce.as_mut().unwrap() 78 | } 79 | 80 | // Take field 81 | pub fn take_nonce(&mut self) -> ::std::vec::Vec { 82 | self.nonce.take().unwrap_or_else(|| ::std::vec::Vec::new()) 83 | } 84 | } 85 | 86 | impl ::protobuf::Message for NoisePayload { 87 | fn is_initialized(&self) -> bool { 88 | if self.nonce.is_none() { 89 | return false; 90 | } 91 | true 92 | } 93 | 94 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 95 | while !is.eof()? { 96 | let (field_number, wire_type) = is.read_tag_unpack()?; 97 | match field_number { 98 | 1 => { 99 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.nonce)?; 100 | }, 101 | _ => { 102 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 103 | }, 104 | }; 105 | } 106 | ::std::result::Result::Ok(()) 107 | } 108 | 109 | // Compute sizes of nested messages 110 | #[allow(unused_variables)] 111 | fn compute_size(&self) -> u32 { 112 | let mut my_size = 0; 113 | if let Some(ref v) = self.nonce.as_ref() { 114 | my_size += ::protobuf::rt::bytes_size(1, &v); 115 | } 116 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 117 | self.cached_size.set(my_size); 118 | my_size 119 | } 120 | 121 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 122 | if let Some(ref v) = self.nonce.as_ref() { 123 | os.write_bytes(1, &v)?; 124 | } 125 | os.write_unknown_fields(self.get_unknown_fields())?; 126 | ::std::result::Result::Ok(()) 127 | } 128 | 129 | fn get_cached_size(&self) -> u32 { 130 | self.cached_size.get() 131 | } 132 | 133 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 134 | &self.unknown_fields 135 | } 136 | 137 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 138 | &mut self.unknown_fields 139 | } 140 | 141 | fn as_any(&self) -> &dyn (::std::any::Any) { 142 | self as &dyn (::std::any::Any) 143 | } 144 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 145 | self as &mut dyn (::std::any::Any) 146 | } 147 | fn into_any(self: Box) -> ::std::boxed::Box { 148 | self 149 | } 150 | 151 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 152 | Self::descriptor_static() 153 | } 154 | 155 | fn new() -> NoisePayload { 156 | NoisePayload::new() 157 | } 158 | 159 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 160 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 161 | lock: ::protobuf::lazy::ONCE_INIT, 162 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 163 | }; 164 | unsafe { 165 | descriptor.get(|| { 166 | let mut fields = ::std::vec::Vec::new(); 167 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 168 | "nonce", 169 | |m: &NoisePayload| { &m.nonce }, 170 | |m: &mut NoisePayload| { &mut m.nonce }, 171 | )); 172 | ::protobuf::reflect::MessageDescriptor::new::( 173 | "NoisePayload", 174 | fields, 175 | file_descriptor_proto() 176 | ) 177 | }) 178 | } 179 | } 180 | 181 | fn default_instance() -> &'static NoisePayload { 182 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 183 | lock: ::protobuf::lazy::ONCE_INIT, 184 | ptr: 0 as *const NoisePayload, 185 | }; 186 | unsafe { 187 | instance.get(NoisePayload::new) 188 | } 189 | } 190 | } 191 | 192 | impl ::protobuf::Clear for NoisePayload { 193 | fn clear(&mut self) { 194 | self.nonce.clear(); 195 | self.unknown_fields.clear(); 196 | } 197 | } 198 | 199 | impl ::std::fmt::Debug for NoisePayload { 200 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 201 | ::protobuf::text_format::fmt(self, f) 202 | } 203 | } 204 | 205 | impl ::protobuf::reflect::ProtobufValue for NoisePayload { 206 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 207 | ::protobuf::reflect::ProtobufValueRef::Message(self) 208 | } 209 | } 210 | 211 | #[derive(PartialEq,Clone,Default)] 212 | pub struct Open { 213 | // message fields 214 | discoveryKey: ::protobuf::SingularField<::std::vec::Vec>, 215 | capability: ::protobuf::SingularField<::std::vec::Vec>, 216 | // special fields 217 | pub unknown_fields: ::protobuf::UnknownFields, 218 | pub cached_size: ::protobuf::CachedSize, 219 | } 220 | 221 | impl<'a> ::std::default::Default for &'a Open { 222 | fn default() -> &'a Open { 223 | ::default_instance() 224 | } 225 | } 226 | 227 | impl Open { 228 | pub fn new() -> Open { 229 | ::std::default::Default::default() 230 | } 231 | 232 | // required bytes discoveryKey = 1; 233 | 234 | 235 | pub fn get_discoveryKey(&self) -> &[u8] { 236 | match self.discoveryKey.as_ref() { 237 | Some(v) => &v, 238 | None => &[], 239 | } 240 | } 241 | pub fn clear_discoveryKey(&mut self) { 242 | self.discoveryKey.clear(); 243 | } 244 | 245 | pub fn has_discoveryKey(&self) -> bool { 246 | self.discoveryKey.is_some() 247 | } 248 | 249 | // Param is passed by value, moved 250 | pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec) { 251 | self.discoveryKey = ::protobuf::SingularField::some(v); 252 | } 253 | 254 | // Mutable pointer to the field. 255 | // If field is not initialized, it is initialized with default value first. 256 | pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec { 257 | if self.discoveryKey.is_none() { 258 | self.discoveryKey.set_default(); 259 | } 260 | self.discoveryKey.as_mut().unwrap() 261 | } 262 | 263 | // Take field 264 | pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec { 265 | self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) 266 | } 267 | 268 | // optional bytes capability = 2; 269 | 270 | 271 | pub fn get_capability(&self) -> &[u8] { 272 | match self.capability.as_ref() { 273 | Some(v) => &v, 274 | None => &[], 275 | } 276 | } 277 | pub fn clear_capability(&mut self) { 278 | self.capability.clear(); 279 | } 280 | 281 | pub fn has_capability(&self) -> bool { 282 | self.capability.is_some() 283 | } 284 | 285 | // Param is passed by value, moved 286 | pub fn set_capability(&mut self, v: ::std::vec::Vec) { 287 | self.capability = ::protobuf::SingularField::some(v); 288 | } 289 | 290 | // Mutable pointer to the field. 291 | // If field is not initialized, it is initialized with default value first. 292 | pub fn mut_capability(&mut self) -> &mut ::std::vec::Vec { 293 | if self.capability.is_none() { 294 | self.capability.set_default(); 295 | } 296 | self.capability.as_mut().unwrap() 297 | } 298 | 299 | // Take field 300 | pub fn take_capability(&mut self) -> ::std::vec::Vec { 301 | self.capability.take().unwrap_or_else(|| ::std::vec::Vec::new()) 302 | } 303 | } 304 | 305 | impl ::protobuf::Message for Open { 306 | fn is_initialized(&self) -> bool { 307 | if self.discoveryKey.is_none() { 308 | return false; 309 | } 310 | true 311 | } 312 | 313 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 314 | while !is.eof()? { 315 | let (field_number, wire_type) = is.read_tag_unpack()?; 316 | match field_number { 317 | 1 => { 318 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?; 319 | }, 320 | 2 => { 321 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.capability)?; 322 | }, 323 | _ => { 324 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 325 | }, 326 | }; 327 | } 328 | ::std::result::Result::Ok(()) 329 | } 330 | 331 | // Compute sizes of nested messages 332 | #[allow(unused_variables)] 333 | fn compute_size(&self) -> u32 { 334 | let mut my_size = 0; 335 | if let Some(ref v) = self.discoveryKey.as_ref() { 336 | my_size += ::protobuf::rt::bytes_size(1, &v); 337 | } 338 | if let Some(ref v) = self.capability.as_ref() { 339 | my_size += ::protobuf::rt::bytes_size(2, &v); 340 | } 341 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 342 | self.cached_size.set(my_size); 343 | my_size 344 | } 345 | 346 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 347 | if let Some(ref v) = self.discoveryKey.as_ref() { 348 | os.write_bytes(1, &v)?; 349 | } 350 | if let Some(ref v) = self.capability.as_ref() { 351 | os.write_bytes(2, &v)?; 352 | } 353 | os.write_unknown_fields(self.get_unknown_fields())?; 354 | ::std::result::Result::Ok(()) 355 | } 356 | 357 | fn get_cached_size(&self) -> u32 { 358 | self.cached_size.get() 359 | } 360 | 361 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 362 | &self.unknown_fields 363 | } 364 | 365 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 366 | &mut self.unknown_fields 367 | } 368 | 369 | fn as_any(&self) -> &dyn (::std::any::Any) { 370 | self as &dyn (::std::any::Any) 371 | } 372 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 373 | self as &mut dyn (::std::any::Any) 374 | } 375 | fn into_any(self: Box) -> ::std::boxed::Box { 376 | self 377 | } 378 | 379 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 380 | Self::descriptor_static() 381 | } 382 | 383 | fn new() -> Open { 384 | Open::new() 385 | } 386 | 387 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 388 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 389 | lock: ::protobuf::lazy::ONCE_INIT, 390 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 391 | }; 392 | unsafe { 393 | descriptor.get(|| { 394 | let mut fields = ::std::vec::Vec::new(); 395 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 396 | "discoveryKey", 397 | |m: &Open| { &m.discoveryKey }, 398 | |m: &mut Open| { &mut m.discoveryKey }, 399 | )); 400 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 401 | "capability", 402 | |m: &Open| { &m.capability }, 403 | |m: &mut Open| { &mut m.capability }, 404 | )); 405 | ::protobuf::reflect::MessageDescriptor::new::( 406 | "Open", 407 | fields, 408 | file_descriptor_proto() 409 | ) 410 | }) 411 | } 412 | } 413 | 414 | fn default_instance() -> &'static Open { 415 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 416 | lock: ::protobuf::lazy::ONCE_INIT, 417 | ptr: 0 as *const Open, 418 | }; 419 | unsafe { 420 | instance.get(Open::new) 421 | } 422 | } 423 | } 424 | 425 | impl ::protobuf::Clear for Open { 426 | fn clear(&mut self) { 427 | self.discoveryKey.clear(); 428 | self.capability.clear(); 429 | self.unknown_fields.clear(); 430 | } 431 | } 432 | 433 | impl ::std::fmt::Debug for Open { 434 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 435 | ::protobuf::text_format::fmt(self, f) 436 | } 437 | } 438 | 439 | impl ::protobuf::reflect::ProtobufValue for Open { 440 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 441 | ::protobuf::reflect::ProtobufValueRef::Message(self) 442 | } 443 | } 444 | 445 | #[derive(PartialEq,Clone,Default)] 446 | pub struct Options { 447 | // message fields 448 | extensions: ::protobuf::RepeatedField<::std::string::String>, 449 | ack: ::std::option::Option, 450 | // special fields 451 | pub unknown_fields: ::protobuf::UnknownFields, 452 | pub cached_size: ::protobuf::CachedSize, 453 | } 454 | 455 | impl<'a> ::std::default::Default for &'a Options { 456 | fn default() -> &'a Options { 457 | ::default_instance() 458 | } 459 | } 460 | 461 | impl Options { 462 | pub fn new() -> Options { 463 | ::std::default::Default::default() 464 | } 465 | 466 | // repeated string extensions = 1; 467 | 468 | 469 | pub fn get_extensions(&self) -> &[::std::string::String] { 470 | &self.extensions 471 | } 472 | pub fn clear_extensions(&mut self) { 473 | self.extensions.clear(); 474 | } 475 | 476 | // Param is passed by value, moved 477 | pub fn set_extensions(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { 478 | self.extensions = v; 479 | } 480 | 481 | // Mutable pointer to the field. 482 | pub fn mut_extensions(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { 483 | &mut self.extensions 484 | } 485 | 486 | // Take field 487 | pub fn take_extensions(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { 488 | ::std::mem::replace(&mut self.extensions, ::protobuf::RepeatedField::new()) 489 | } 490 | 491 | // optional bool ack = 2; 492 | 493 | 494 | pub fn get_ack(&self) -> bool { 495 | self.ack.unwrap_or(false) 496 | } 497 | pub fn clear_ack(&mut self) { 498 | self.ack = ::std::option::Option::None; 499 | } 500 | 501 | pub fn has_ack(&self) -> bool { 502 | self.ack.is_some() 503 | } 504 | 505 | // Param is passed by value, moved 506 | pub fn set_ack(&mut self, v: bool) { 507 | self.ack = ::std::option::Option::Some(v); 508 | } 509 | } 510 | 511 | impl ::protobuf::Message for Options { 512 | fn is_initialized(&self) -> bool { 513 | true 514 | } 515 | 516 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 517 | while !is.eof()? { 518 | let (field_number, wire_type) = is.read_tag_unpack()?; 519 | match field_number { 520 | 1 => { 521 | ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.extensions)?; 522 | }, 523 | 2 => { 524 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 525 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 526 | } 527 | let tmp = is.read_bool()?; 528 | self.ack = ::std::option::Option::Some(tmp); 529 | }, 530 | _ => { 531 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 532 | }, 533 | }; 534 | } 535 | ::std::result::Result::Ok(()) 536 | } 537 | 538 | // Compute sizes of nested messages 539 | #[allow(unused_variables)] 540 | fn compute_size(&self) -> u32 { 541 | let mut my_size = 0; 542 | for value in &self.extensions { 543 | my_size += ::protobuf::rt::string_size(1, &value); 544 | }; 545 | if let Some(v) = self.ack { 546 | my_size += 2; 547 | } 548 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 549 | self.cached_size.set(my_size); 550 | my_size 551 | } 552 | 553 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 554 | for v in &self.extensions { 555 | os.write_string(1, &v)?; 556 | }; 557 | if let Some(v) = self.ack { 558 | os.write_bool(2, v)?; 559 | } 560 | os.write_unknown_fields(self.get_unknown_fields())?; 561 | ::std::result::Result::Ok(()) 562 | } 563 | 564 | fn get_cached_size(&self) -> u32 { 565 | self.cached_size.get() 566 | } 567 | 568 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 569 | &self.unknown_fields 570 | } 571 | 572 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 573 | &mut self.unknown_fields 574 | } 575 | 576 | fn as_any(&self) -> &dyn (::std::any::Any) { 577 | self as &dyn (::std::any::Any) 578 | } 579 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 580 | self as &mut dyn (::std::any::Any) 581 | } 582 | fn into_any(self: Box) -> ::std::boxed::Box { 583 | self 584 | } 585 | 586 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 587 | Self::descriptor_static() 588 | } 589 | 590 | fn new() -> Options { 591 | Options::new() 592 | } 593 | 594 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 595 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 596 | lock: ::protobuf::lazy::ONCE_INIT, 597 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 598 | }; 599 | unsafe { 600 | descriptor.get(|| { 601 | let mut fields = ::std::vec::Vec::new(); 602 | fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 603 | "extensions", 604 | |m: &Options| { &m.extensions }, 605 | |m: &mut Options| { &mut m.extensions }, 606 | )); 607 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 608 | "ack", 609 | |m: &Options| { &m.ack }, 610 | |m: &mut Options| { &mut m.ack }, 611 | )); 612 | ::protobuf::reflect::MessageDescriptor::new::( 613 | "Options", 614 | fields, 615 | file_descriptor_proto() 616 | ) 617 | }) 618 | } 619 | } 620 | 621 | fn default_instance() -> &'static Options { 622 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 623 | lock: ::protobuf::lazy::ONCE_INIT, 624 | ptr: 0 as *const Options, 625 | }; 626 | unsafe { 627 | instance.get(Options::new) 628 | } 629 | } 630 | } 631 | 632 | impl ::protobuf::Clear for Options { 633 | fn clear(&mut self) { 634 | self.extensions.clear(); 635 | self.ack = ::std::option::Option::None; 636 | self.unknown_fields.clear(); 637 | } 638 | } 639 | 640 | impl ::std::fmt::Debug for Options { 641 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 642 | ::protobuf::text_format::fmt(self, f) 643 | } 644 | } 645 | 646 | impl ::protobuf::reflect::ProtobufValue for Options { 647 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 648 | ::protobuf::reflect::ProtobufValueRef::Message(self) 649 | } 650 | } 651 | 652 | #[derive(PartialEq,Clone,Default)] 653 | pub struct Status { 654 | // message fields 655 | uploading: ::std::option::Option, 656 | downloading: ::std::option::Option, 657 | // special fields 658 | pub unknown_fields: ::protobuf::UnknownFields, 659 | pub cached_size: ::protobuf::CachedSize, 660 | } 661 | 662 | impl<'a> ::std::default::Default for &'a Status { 663 | fn default() -> &'a Status { 664 | ::default_instance() 665 | } 666 | } 667 | 668 | impl Status { 669 | pub fn new() -> Status { 670 | ::std::default::Default::default() 671 | } 672 | 673 | // optional bool uploading = 1; 674 | 675 | 676 | pub fn get_uploading(&self) -> bool { 677 | self.uploading.unwrap_or(false) 678 | } 679 | pub fn clear_uploading(&mut self) { 680 | self.uploading = ::std::option::Option::None; 681 | } 682 | 683 | pub fn has_uploading(&self) -> bool { 684 | self.uploading.is_some() 685 | } 686 | 687 | // Param is passed by value, moved 688 | pub fn set_uploading(&mut self, v: bool) { 689 | self.uploading = ::std::option::Option::Some(v); 690 | } 691 | 692 | // optional bool downloading = 2; 693 | 694 | 695 | pub fn get_downloading(&self) -> bool { 696 | self.downloading.unwrap_or(false) 697 | } 698 | pub fn clear_downloading(&mut self) { 699 | self.downloading = ::std::option::Option::None; 700 | } 701 | 702 | pub fn has_downloading(&self) -> bool { 703 | self.downloading.is_some() 704 | } 705 | 706 | // Param is passed by value, moved 707 | pub fn set_downloading(&mut self, v: bool) { 708 | self.downloading = ::std::option::Option::Some(v); 709 | } 710 | } 711 | 712 | impl ::protobuf::Message for Status { 713 | fn is_initialized(&self) -> bool { 714 | true 715 | } 716 | 717 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 718 | while !is.eof()? { 719 | let (field_number, wire_type) = is.read_tag_unpack()?; 720 | match field_number { 721 | 1 => { 722 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 723 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 724 | } 725 | let tmp = is.read_bool()?; 726 | self.uploading = ::std::option::Option::Some(tmp); 727 | }, 728 | 2 => { 729 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 730 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 731 | } 732 | let tmp = is.read_bool()?; 733 | self.downloading = ::std::option::Option::Some(tmp); 734 | }, 735 | _ => { 736 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 737 | }, 738 | }; 739 | } 740 | ::std::result::Result::Ok(()) 741 | } 742 | 743 | // Compute sizes of nested messages 744 | #[allow(unused_variables)] 745 | fn compute_size(&self) -> u32 { 746 | let mut my_size = 0; 747 | if let Some(v) = self.uploading { 748 | my_size += 2; 749 | } 750 | if let Some(v) = self.downloading { 751 | my_size += 2; 752 | } 753 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 754 | self.cached_size.set(my_size); 755 | my_size 756 | } 757 | 758 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 759 | if let Some(v) = self.uploading { 760 | os.write_bool(1, v)?; 761 | } 762 | if let Some(v) = self.downloading { 763 | os.write_bool(2, v)?; 764 | } 765 | os.write_unknown_fields(self.get_unknown_fields())?; 766 | ::std::result::Result::Ok(()) 767 | } 768 | 769 | fn get_cached_size(&self) -> u32 { 770 | self.cached_size.get() 771 | } 772 | 773 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 774 | &self.unknown_fields 775 | } 776 | 777 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 778 | &mut self.unknown_fields 779 | } 780 | 781 | fn as_any(&self) -> &dyn (::std::any::Any) { 782 | self as &dyn (::std::any::Any) 783 | } 784 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 785 | self as &mut dyn (::std::any::Any) 786 | } 787 | fn into_any(self: Box) -> ::std::boxed::Box { 788 | self 789 | } 790 | 791 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 792 | Self::descriptor_static() 793 | } 794 | 795 | fn new() -> Status { 796 | Status::new() 797 | } 798 | 799 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 800 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 801 | lock: ::protobuf::lazy::ONCE_INIT, 802 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 803 | }; 804 | unsafe { 805 | descriptor.get(|| { 806 | let mut fields = ::std::vec::Vec::new(); 807 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 808 | "uploading", 809 | |m: &Status| { &m.uploading }, 810 | |m: &mut Status| { &mut m.uploading }, 811 | )); 812 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 813 | "downloading", 814 | |m: &Status| { &m.downloading }, 815 | |m: &mut Status| { &mut m.downloading }, 816 | )); 817 | ::protobuf::reflect::MessageDescriptor::new::( 818 | "Status", 819 | fields, 820 | file_descriptor_proto() 821 | ) 822 | }) 823 | } 824 | } 825 | 826 | fn default_instance() -> &'static Status { 827 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 828 | lock: ::protobuf::lazy::ONCE_INIT, 829 | ptr: 0 as *const Status, 830 | }; 831 | unsafe { 832 | instance.get(Status::new) 833 | } 834 | } 835 | } 836 | 837 | impl ::protobuf::Clear for Status { 838 | fn clear(&mut self) { 839 | self.uploading = ::std::option::Option::None; 840 | self.downloading = ::std::option::Option::None; 841 | self.unknown_fields.clear(); 842 | } 843 | } 844 | 845 | impl ::std::fmt::Debug for Status { 846 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 847 | ::protobuf::text_format::fmt(self, f) 848 | } 849 | } 850 | 851 | impl ::protobuf::reflect::ProtobufValue for Status { 852 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 853 | ::protobuf::reflect::ProtobufValueRef::Message(self) 854 | } 855 | } 856 | 857 | #[derive(PartialEq,Clone,Default)] 858 | pub struct Have { 859 | // message fields 860 | start: ::std::option::Option, 861 | length: ::std::option::Option, 862 | bitfield: ::protobuf::SingularField<::std::vec::Vec>, 863 | ack: ::std::option::Option, 864 | // special fields 865 | pub unknown_fields: ::protobuf::UnknownFields, 866 | pub cached_size: ::protobuf::CachedSize, 867 | } 868 | 869 | impl<'a> ::std::default::Default for &'a Have { 870 | fn default() -> &'a Have { 871 | ::default_instance() 872 | } 873 | } 874 | 875 | impl Have { 876 | pub fn new() -> Have { 877 | ::std::default::Default::default() 878 | } 879 | 880 | // required uint64 start = 1; 881 | 882 | 883 | pub fn get_start(&self) -> u64 { 884 | self.start.unwrap_or(0) 885 | } 886 | pub fn clear_start(&mut self) { 887 | self.start = ::std::option::Option::None; 888 | } 889 | 890 | pub fn has_start(&self) -> bool { 891 | self.start.is_some() 892 | } 893 | 894 | // Param is passed by value, moved 895 | pub fn set_start(&mut self, v: u64) { 896 | self.start = ::std::option::Option::Some(v); 897 | } 898 | 899 | // optional uint64 length = 2; 900 | 901 | 902 | pub fn get_length(&self) -> u64 { 903 | self.length.unwrap_or(1u64) 904 | } 905 | pub fn clear_length(&mut self) { 906 | self.length = ::std::option::Option::None; 907 | } 908 | 909 | pub fn has_length(&self) -> bool { 910 | self.length.is_some() 911 | } 912 | 913 | // Param is passed by value, moved 914 | pub fn set_length(&mut self, v: u64) { 915 | self.length = ::std::option::Option::Some(v); 916 | } 917 | 918 | // optional bytes bitfield = 3; 919 | 920 | 921 | pub fn get_bitfield(&self) -> &[u8] { 922 | match self.bitfield.as_ref() { 923 | Some(v) => &v, 924 | None => &[], 925 | } 926 | } 927 | pub fn clear_bitfield(&mut self) { 928 | self.bitfield.clear(); 929 | } 930 | 931 | pub fn has_bitfield(&self) -> bool { 932 | self.bitfield.is_some() 933 | } 934 | 935 | // Param is passed by value, moved 936 | pub fn set_bitfield(&mut self, v: ::std::vec::Vec) { 937 | self.bitfield = ::protobuf::SingularField::some(v); 938 | } 939 | 940 | // Mutable pointer to the field. 941 | // If field is not initialized, it is initialized with default value first. 942 | pub fn mut_bitfield(&mut self) -> &mut ::std::vec::Vec { 943 | if self.bitfield.is_none() { 944 | self.bitfield.set_default(); 945 | } 946 | self.bitfield.as_mut().unwrap() 947 | } 948 | 949 | // Take field 950 | pub fn take_bitfield(&mut self) -> ::std::vec::Vec { 951 | self.bitfield.take().unwrap_or_else(|| ::std::vec::Vec::new()) 952 | } 953 | 954 | // optional bool ack = 4; 955 | 956 | 957 | pub fn get_ack(&self) -> bool { 958 | self.ack.unwrap_or(false) 959 | } 960 | pub fn clear_ack(&mut self) { 961 | self.ack = ::std::option::Option::None; 962 | } 963 | 964 | pub fn has_ack(&self) -> bool { 965 | self.ack.is_some() 966 | } 967 | 968 | // Param is passed by value, moved 969 | pub fn set_ack(&mut self, v: bool) { 970 | self.ack = ::std::option::Option::Some(v); 971 | } 972 | } 973 | 974 | impl ::protobuf::Message for Have { 975 | fn is_initialized(&self) -> bool { 976 | if self.start.is_none() { 977 | return false; 978 | } 979 | true 980 | } 981 | 982 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 983 | while !is.eof()? { 984 | let (field_number, wire_type) = is.read_tag_unpack()?; 985 | match field_number { 986 | 1 => { 987 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 988 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 989 | } 990 | let tmp = is.read_uint64()?; 991 | self.start = ::std::option::Option::Some(tmp); 992 | }, 993 | 2 => { 994 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 995 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 996 | } 997 | let tmp = is.read_uint64()?; 998 | self.length = ::std::option::Option::Some(tmp); 999 | }, 1000 | 3 => { 1001 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.bitfield)?; 1002 | }, 1003 | 4 => { 1004 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1005 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1006 | } 1007 | let tmp = is.read_bool()?; 1008 | self.ack = ::std::option::Option::Some(tmp); 1009 | }, 1010 | _ => { 1011 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 1012 | }, 1013 | }; 1014 | } 1015 | ::std::result::Result::Ok(()) 1016 | } 1017 | 1018 | // Compute sizes of nested messages 1019 | #[allow(unused_variables)] 1020 | fn compute_size(&self) -> u32 { 1021 | let mut my_size = 0; 1022 | if let Some(v) = self.start { 1023 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 1024 | } 1025 | if let Some(v) = self.length { 1026 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 1027 | } 1028 | if let Some(ref v) = self.bitfield.as_ref() { 1029 | my_size += ::protobuf::rt::bytes_size(3, &v); 1030 | } 1031 | if let Some(v) = self.ack { 1032 | my_size += 2; 1033 | } 1034 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 1035 | self.cached_size.set(my_size); 1036 | my_size 1037 | } 1038 | 1039 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1040 | if let Some(v) = self.start { 1041 | os.write_uint64(1, v)?; 1042 | } 1043 | if let Some(v) = self.length { 1044 | os.write_uint64(2, v)?; 1045 | } 1046 | if let Some(ref v) = self.bitfield.as_ref() { 1047 | os.write_bytes(3, &v)?; 1048 | } 1049 | if let Some(v) = self.ack { 1050 | os.write_bool(4, v)?; 1051 | } 1052 | os.write_unknown_fields(self.get_unknown_fields())?; 1053 | ::std::result::Result::Ok(()) 1054 | } 1055 | 1056 | fn get_cached_size(&self) -> u32 { 1057 | self.cached_size.get() 1058 | } 1059 | 1060 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 1061 | &self.unknown_fields 1062 | } 1063 | 1064 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 1065 | &mut self.unknown_fields 1066 | } 1067 | 1068 | fn as_any(&self) -> &dyn (::std::any::Any) { 1069 | self as &dyn (::std::any::Any) 1070 | } 1071 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 1072 | self as &mut dyn (::std::any::Any) 1073 | } 1074 | fn into_any(self: Box) -> ::std::boxed::Box { 1075 | self 1076 | } 1077 | 1078 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 1079 | Self::descriptor_static() 1080 | } 1081 | 1082 | fn new() -> Have { 1083 | Have::new() 1084 | } 1085 | 1086 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 1087 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 1088 | lock: ::protobuf::lazy::ONCE_INIT, 1089 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 1090 | }; 1091 | unsafe { 1092 | descriptor.get(|| { 1093 | let mut fields = ::std::vec::Vec::new(); 1094 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1095 | "start", 1096 | |m: &Have| { &m.start }, 1097 | |m: &mut Have| { &mut m.start }, 1098 | )); 1099 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1100 | "length", 1101 | |m: &Have| { &m.length }, 1102 | |m: &mut Have| { &mut m.length }, 1103 | )); 1104 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 1105 | "bitfield", 1106 | |m: &Have| { &m.bitfield }, 1107 | |m: &mut Have| { &mut m.bitfield }, 1108 | )); 1109 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 1110 | "ack", 1111 | |m: &Have| { &m.ack }, 1112 | |m: &mut Have| { &mut m.ack }, 1113 | )); 1114 | ::protobuf::reflect::MessageDescriptor::new::( 1115 | "Have", 1116 | fields, 1117 | file_descriptor_proto() 1118 | ) 1119 | }) 1120 | } 1121 | } 1122 | 1123 | fn default_instance() -> &'static Have { 1124 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 1125 | lock: ::protobuf::lazy::ONCE_INIT, 1126 | ptr: 0 as *const Have, 1127 | }; 1128 | unsafe { 1129 | instance.get(Have::new) 1130 | } 1131 | } 1132 | } 1133 | 1134 | impl ::protobuf::Clear for Have { 1135 | fn clear(&mut self) { 1136 | self.start = ::std::option::Option::None; 1137 | self.length = ::std::option::Option::None; 1138 | self.bitfield.clear(); 1139 | self.ack = ::std::option::Option::None; 1140 | self.unknown_fields.clear(); 1141 | } 1142 | } 1143 | 1144 | impl ::std::fmt::Debug for Have { 1145 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 1146 | ::protobuf::text_format::fmt(self, f) 1147 | } 1148 | } 1149 | 1150 | impl ::protobuf::reflect::ProtobufValue for Have { 1151 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 1152 | ::protobuf::reflect::ProtobufValueRef::Message(self) 1153 | } 1154 | } 1155 | 1156 | #[derive(PartialEq,Clone,Default)] 1157 | pub struct Unhave { 1158 | // message fields 1159 | start: ::std::option::Option, 1160 | length: ::std::option::Option, 1161 | // special fields 1162 | pub unknown_fields: ::protobuf::UnknownFields, 1163 | pub cached_size: ::protobuf::CachedSize, 1164 | } 1165 | 1166 | impl<'a> ::std::default::Default for &'a Unhave { 1167 | fn default() -> &'a Unhave { 1168 | ::default_instance() 1169 | } 1170 | } 1171 | 1172 | impl Unhave { 1173 | pub fn new() -> Unhave { 1174 | ::std::default::Default::default() 1175 | } 1176 | 1177 | // required uint64 start = 1; 1178 | 1179 | 1180 | pub fn get_start(&self) -> u64 { 1181 | self.start.unwrap_or(0) 1182 | } 1183 | pub fn clear_start(&mut self) { 1184 | self.start = ::std::option::Option::None; 1185 | } 1186 | 1187 | pub fn has_start(&self) -> bool { 1188 | self.start.is_some() 1189 | } 1190 | 1191 | // Param is passed by value, moved 1192 | pub fn set_start(&mut self, v: u64) { 1193 | self.start = ::std::option::Option::Some(v); 1194 | } 1195 | 1196 | // optional uint64 length = 2; 1197 | 1198 | 1199 | pub fn get_length(&self) -> u64 { 1200 | self.length.unwrap_or(1u64) 1201 | } 1202 | pub fn clear_length(&mut self) { 1203 | self.length = ::std::option::Option::None; 1204 | } 1205 | 1206 | pub fn has_length(&self) -> bool { 1207 | self.length.is_some() 1208 | } 1209 | 1210 | // Param is passed by value, moved 1211 | pub fn set_length(&mut self, v: u64) { 1212 | self.length = ::std::option::Option::Some(v); 1213 | } 1214 | } 1215 | 1216 | impl ::protobuf::Message for Unhave { 1217 | fn is_initialized(&self) -> bool { 1218 | if self.start.is_none() { 1219 | return false; 1220 | } 1221 | true 1222 | } 1223 | 1224 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1225 | while !is.eof()? { 1226 | let (field_number, wire_type) = is.read_tag_unpack()?; 1227 | match field_number { 1228 | 1 => { 1229 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1230 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1231 | } 1232 | let tmp = is.read_uint64()?; 1233 | self.start = ::std::option::Option::Some(tmp); 1234 | }, 1235 | 2 => { 1236 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1237 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1238 | } 1239 | let tmp = is.read_uint64()?; 1240 | self.length = ::std::option::Option::Some(tmp); 1241 | }, 1242 | _ => { 1243 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 1244 | }, 1245 | }; 1246 | } 1247 | ::std::result::Result::Ok(()) 1248 | } 1249 | 1250 | // Compute sizes of nested messages 1251 | #[allow(unused_variables)] 1252 | fn compute_size(&self) -> u32 { 1253 | let mut my_size = 0; 1254 | if let Some(v) = self.start { 1255 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 1256 | } 1257 | if let Some(v) = self.length { 1258 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 1259 | } 1260 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 1261 | self.cached_size.set(my_size); 1262 | my_size 1263 | } 1264 | 1265 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1266 | if let Some(v) = self.start { 1267 | os.write_uint64(1, v)?; 1268 | } 1269 | if let Some(v) = self.length { 1270 | os.write_uint64(2, v)?; 1271 | } 1272 | os.write_unknown_fields(self.get_unknown_fields())?; 1273 | ::std::result::Result::Ok(()) 1274 | } 1275 | 1276 | fn get_cached_size(&self) -> u32 { 1277 | self.cached_size.get() 1278 | } 1279 | 1280 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 1281 | &self.unknown_fields 1282 | } 1283 | 1284 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 1285 | &mut self.unknown_fields 1286 | } 1287 | 1288 | fn as_any(&self) -> &dyn (::std::any::Any) { 1289 | self as &dyn (::std::any::Any) 1290 | } 1291 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 1292 | self as &mut dyn (::std::any::Any) 1293 | } 1294 | fn into_any(self: Box) -> ::std::boxed::Box { 1295 | self 1296 | } 1297 | 1298 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 1299 | Self::descriptor_static() 1300 | } 1301 | 1302 | fn new() -> Unhave { 1303 | Unhave::new() 1304 | } 1305 | 1306 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 1307 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 1308 | lock: ::protobuf::lazy::ONCE_INIT, 1309 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 1310 | }; 1311 | unsafe { 1312 | descriptor.get(|| { 1313 | let mut fields = ::std::vec::Vec::new(); 1314 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1315 | "start", 1316 | |m: &Unhave| { &m.start }, 1317 | |m: &mut Unhave| { &mut m.start }, 1318 | )); 1319 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1320 | "length", 1321 | |m: &Unhave| { &m.length }, 1322 | |m: &mut Unhave| { &mut m.length }, 1323 | )); 1324 | ::protobuf::reflect::MessageDescriptor::new::( 1325 | "Unhave", 1326 | fields, 1327 | file_descriptor_proto() 1328 | ) 1329 | }) 1330 | } 1331 | } 1332 | 1333 | fn default_instance() -> &'static Unhave { 1334 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 1335 | lock: ::protobuf::lazy::ONCE_INIT, 1336 | ptr: 0 as *const Unhave, 1337 | }; 1338 | unsafe { 1339 | instance.get(Unhave::new) 1340 | } 1341 | } 1342 | } 1343 | 1344 | impl ::protobuf::Clear for Unhave { 1345 | fn clear(&mut self) { 1346 | self.start = ::std::option::Option::None; 1347 | self.length = ::std::option::Option::None; 1348 | self.unknown_fields.clear(); 1349 | } 1350 | } 1351 | 1352 | impl ::std::fmt::Debug for Unhave { 1353 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 1354 | ::protobuf::text_format::fmt(self, f) 1355 | } 1356 | } 1357 | 1358 | impl ::protobuf::reflect::ProtobufValue for Unhave { 1359 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 1360 | ::protobuf::reflect::ProtobufValueRef::Message(self) 1361 | } 1362 | } 1363 | 1364 | #[derive(PartialEq,Clone,Default)] 1365 | pub struct Want { 1366 | // message fields 1367 | start: ::std::option::Option, 1368 | length: ::std::option::Option, 1369 | // special fields 1370 | pub unknown_fields: ::protobuf::UnknownFields, 1371 | pub cached_size: ::protobuf::CachedSize, 1372 | } 1373 | 1374 | impl<'a> ::std::default::Default for &'a Want { 1375 | fn default() -> &'a Want { 1376 | ::default_instance() 1377 | } 1378 | } 1379 | 1380 | impl Want { 1381 | pub fn new() -> Want { 1382 | ::std::default::Default::default() 1383 | } 1384 | 1385 | // required uint64 start = 1; 1386 | 1387 | 1388 | pub fn get_start(&self) -> u64 { 1389 | self.start.unwrap_or(0) 1390 | } 1391 | pub fn clear_start(&mut self) { 1392 | self.start = ::std::option::Option::None; 1393 | } 1394 | 1395 | pub fn has_start(&self) -> bool { 1396 | self.start.is_some() 1397 | } 1398 | 1399 | // Param is passed by value, moved 1400 | pub fn set_start(&mut self, v: u64) { 1401 | self.start = ::std::option::Option::Some(v); 1402 | } 1403 | 1404 | // optional uint64 length = 2; 1405 | 1406 | 1407 | pub fn get_length(&self) -> u64 { 1408 | self.length.unwrap_or(0) 1409 | } 1410 | pub fn clear_length(&mut self) { 1411 | self.length = ::std::option::Option::None; 1412 | } 1413 | 1414 | pub fn has_length(&self) -> bool { 1415 | self.length.is_some() 1416 | } 1417 | 1418 | // Param is passed by value, moved 1419 | pub fn set_length(&mut self, v: u64) { 1420 | self.length = ::std::option::Option::Some(v); 1421 | } 1422 | } 1423 | 1424 | impl ::protobuf::Message for Want { 1425 | fn is_initialized(&self) -> bool { 1426 | if self.start.is_none() { 1427 | return false; 1428 | } 1429 | true 1430 | } 1431 | 1432 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1433 | while !is.eof()? { 1434 | let (field_number, wire_type) = is.read_tag_unpack()?; 1435 | match field_number { 1436 | 1 => { 1437 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1438 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1439 | } 1440 | let tmp = is.read_uint64()?; 1441 | self.start = ::std::option::Option::Some(tmp); 1442 | }, 1443 | 2 => { 1444 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1445 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1446 | } 1447 | let tmp = is.read_uint64()?; 1448 | self.length = ::std::option::Option::Some(tmp); 1449 | }, 1450 | _ => { 1451 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 1452 | }, 1453 | }; 1454 | } 1455 | ::std::result::Result::Ok(()) 1456 | } 1457 | 1458 | // Compute sizes of nested messages 1459 | #[allow(unused_variables)] 1460 | fn compute_size(&self) -> u32 { 1461 | let mut my_size = 0; 1462 | if let Some(v) = self.start { 1463 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 1464 | } 1465 | if let Some(v) = self.length { 1466 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 1467 | } 1468 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 1469 | self.cached_size.set(my_size); 1470 | my_size 1471 | } 1472 | 1473 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1474 | if let Some(v) = self.start { 1475 | os.write_uint64(1, v)?; 1476 | } 1477 | if let Some(v) = self.length { 1478 | os.write_uint64(2, v)?; 1479 | } 1480 | os.write_unknown_fields(self.get_unknown_fields())?; 1481 | ::std::result::Result::Ok(()) 1482 | } 1483 | 1484 | fn get_cached_size(&self) -> u32 { 1485 | self.cached_size.get() 1486 | } 1487 | 1488 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 1489 | &self.unknown_fields 1490 | } 1491 | 1492 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 1493 | &mut self.unknown_fields 1494 | } 1495 | 1496 | fn as_any(&self) -> &dyn (::std::any::Any) { 1497 | self as &dyn (::std::any::Any) 1498 | } 1499 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 1500 | self as &mut dyn (::std::any::Any) 1501 | } 1502 | fn into_any(self: Box) -> ::std::boxed::Box { 1503 | self 1504 | } 1505 | 1506 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 1507 | Self::descriptor_static() 1508 | } 1509 | 1510 | fn new() -> Want { 1511 | Want::new() 1512 | } 1513 | 1514 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 1515 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 1516 | lock: ::protobuf::lazy::ONCE_INIT, 1517 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 1518 | }; 1519 | unsafe { 1520 | descriptor.get(|| { 1521 | let mut fields = ::std::vec::Vec::new(); 1522 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1523 | "start", 1524 | |m: &Want| { &m.start }, 1525 | |m: &mut Want| { &mut m.start }, 1526 | )); 1527 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1528 | "length", 1529 | |m: &Want| { &m.length }, 1530 | |m: &mut Want| { &mut m.length }, 1531 | )); 1532 | ::protobuf::reflect::MessageDescriptor::new::( 1533 | "Want", 1534 | fields, 1535 | file_descriptor_proto() 1536 | ) 1537 | }) 1538 | } 1539 | } 1540 | 1541 | fn default_instance() -> &'static Want { 1542 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 1543 | lock: ::protobuf::lazy::ONCE_INIT, 1544 | ptr: 0 as *const Want, 1545 | }; 1546 | unsafe { 1547 | instance.get(Want::new) 1548 | } 1549 | } 1550 | } 1551 | 1552 | impl ::protobuf::Clear for Want { 1553 | fn clear(&mut self) { 1554 | self.start = ::std::option::Option::None; 1555 | self.length = ::std::option::Option::None; 1556 | self.unknown_fields.clear(); 1557 | } 1558 | } 1559 | 1560 | impl ::std::fmt::Debug for Want { 1561 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 1562 | ::protobuf::text_format::fmt(self, f) 1563 | } 1564 | } 1565 | 1566 | impl ::protobuf::reflect::ProtobufValue for Want { 1567 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 1568 | ::protobuf::reflect::ProtobufValueRef::Message(self) 1569 | } 1570 | } 1571 | 1572 | #[derive(PartialEq,Clone,Default)] 1573 | pub struct Unwant { 1574 | // message fields 1575 | start: ::std::option::Option, 1576 | length: ::std::option::Option, 1577 | // special fields 1578 | pub unknown_fields: ::protobuf::UnknownFields, 1579 | pub cached_size: ::protobuf::CachedSize, 1580 | } 1581 | 1582 | impl<'a> ::std::default::Default for &'a Unwant { 1583 | fn default() -> &'a Unwant { 1584 | ::default_instance() 1585 | } 1586 | } 1587 | 1588 | impl Unwant { 1589 | pub fn new() -> Unwant { 1590 | ::std::default::Default::default() 1591 | } 1592 | 1593 | // required uint64 start = 1; 1594 | 1595 | 1596 | pub fn get_start(&self) -> u64 { 1597 | self.start.unwrap_or(0) 1598 | } 1599 | pub fn clear_start(&mut self) { 1600 | self.start = ::std::option::Option::None; 1601 | } 1602 | 1603 | pub fn has_start(&self) -> bool { 1604 | self.start.is_some() 1605 | } 1606 | 1607 | // Param is passed by value, moved 1608 | pub fn set_start(&mut self, v: u64) { 1609 | self.start = ::std::option::Option::Some(v); 1610 | } 1611 | 1612 | // optional uint64 length = 2; 1613 | 1614 | 1615 | pub fn get_length(&self) -> u64 { 1616 | self.length.unwrap_or(0) 1617 | } 1618 | pub fn clear_length(&mut self) { 1619 | self.length = ::std::option::Option::None; 1620 | } 1621 | 1622 | pub fn has_length(&self) -> bool { 1623 | self.length.is_some() 1624 | } 1625 | 1626 | // Param is passed by value, moved 1627 | pub fn set_length(&mut self, v: u64) { 1628 | self.length = ::std::option::Option::Some(v); 1629 | } 1630 | } 1631 | 1632 | impl ::protobuf::Message for Unwant { 1633 | fn is_initialized(&self) -> bool { 1634 | if self.start.is_none() { 1635 | return false; 1636 | } 1637 | true 1638 | } 1639 | 1640 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1641 | while !is.eof()? { 1642 | let (field_number, wire_type) = is.read_tag_unpack()?; 1643 | match field_number { 1644 | 1 => { 1645 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1646 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1647 | } 1648 | let tmp = is.read_uint64()?; 1649 | self.start = ::std::option::Option::Some(tmp); 1650 | }, 1651 | 2 => { 1652 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1653 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1654 | } 1655 | let tmp = is.read_uint64()?; 1656 | self.length = ::std::option::Option::Some(tmp); 1657 | }, 1658 | _ => { 1659 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 1660 | }, 1661 | }; 1662 | } 1663 | ::std::result::Result::Ok(()) 1664 | } 1665 | 1666 | // Compute sizes of nested messages 1667 | #[allow(unused_variables)] 1668 | fn compute_size(&self) -> u32 { 1669 | let mut my_size = 0; 1670 | if let Some(v) = self.start { 1671 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 1672 | } 1673 | if let Some(v) = self.length { 1674 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 1675 | } 1676 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 1677 | self.cached_size.set(my_size); 1678 | my_size 1679 | } 1680 | 1681 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1682 | if let Some(v) = self.start { 1683 | os.write_uint64(1, v)?; 1684 | } 1685 | if let Some(v) = self.length { 1686 | os.write_uint64(2, v)?; 1687 | } 1688 | os.write_unknown_fields(self.get_unknown_fields())?; 1689 | ::std::result::Result::Ok(()) 1690 | } 1691 | 1692 | fn get_cached_size(&self) -> u32 { 1693 | self.cached_size.get() 1694 | } 1695 | 1696 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 1697 | &self.unknown_fields 1698 | } 1699 | 1700 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 1701 | &mut self.unknown_fields 1702 | } 1703 | 1704 | fn as_any(&self) -> &dyn (::std::any::Any) { 1705 | self as &dyn (::std::any::Any) 1706 | } 1707 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 1708 | self as &mut dyn (::std::any::Any) 1709 | } 1710 | fn into_any(self: Box) -> ::std::boxed::Box { 1711 | self 1712 | } 1713 | 1714 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 1715 | Self::descriptor_static() 1716 | } 1717 | 1718 | fn new() -> Unwant { 1719 | Unwant::new() 1720 | } 1721 | 1722 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 1723 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 1724 | lock: ::protobuf::lazy::ONCE_INIT, 1725 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 1726 | }; 1727 | unsafe { 1728 | descriptor.get(|| { 1729 | let mut fields = ::std::vec::Vec::new(); 1730 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1731 | "start", 1732 | |m: &Unwant| { &m.start }, 1733 | |m: &mut Unwant| { &mut m.start }, 1734 | )); 1735 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 1736 | "length", 1737 | |m: &Unwant| { &m.length }, 1738 | |m: &mut Unwant| { &mut m.length }, 1739 | )); 1740 | ::protobuf::reflect::MessageDescriptor::new::( 1741 | "Unwant", 1742 | fields, 1743 | file_descriptor_proto() 1744 | ) 1745 | }) 1746 | } 1747 | } 1748 | 1749 | fn default_instance() -> &'static Unwant { 1750 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 1751 | lock: ::protobuf::lazy::ONCE_INIT, 1752 | ptr: 0 as *const Unwant, 1753 | }; 1754 | unsafe { 1755 | instance.get(Unwant::new) 1756 | } 1757 | } 1758 | } 1759 | 1760 | impl ::protobuf::Clear for Unwant { 1761 | fn clear(&mut self) { 1762 | self.start = ::std::option::Option::None; 1763 | self.length = ::std::option::Option::None; 1764 | self.unknown_fields.clear(); 1765 | } 1766 | } 1767 | 1768 | impl ::std::fmt::Debug for Unwant { 1769 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 1770 | ::protobuf::text_format::fmt(self, f) 1771 | } 1772 | } 1773 | 1774 | impl ::protobuf::reflect::ProtobufValue for Unwant { 1775 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 1776 | ::protobuf::reflect::ProtobufValueRef::Message(self) 1777 | } 1778 | } 1779 | 1780 | #[derive(PartialEq,Clone,Default)] 1781 | pub struct Request { 1782 | // message fields 1783 | index: ::std::option::Option, 1784 | bytes: ::std::option::Option, 1785 | hash: ::std::option::Option, 1786 | nodes: ::std::option::Option, 1787 | // special fields 1788 | pub unknown_fields: ::protobuf::UnknownFields, 1789 | pub cached_size: ::protobuf::CachedSize, 1790 | } 1791 | 1792 | impl<'a> ::std::default::Default for &'a Request { 1793 | fn default() -> &'a Request { 1794 | ::default_instance() 1795 | } 1796 | } 1797 | 1798 | impl Request { 1799 | pub fn new() -> Request { 1800 | ::std::default::Default::default() 1801 | } 1802 | 1803 | // required uint64 index = 1; 1804 | 1805 | 1806 | pub fn get_index(&self) -> u64 { 1807 | self.index.unwrap_or(0) 1808 | } 1809 | pub fn clear_index(&mut self) { 1810 | self.index = ::std::option::Option::None; 1811 | } 1812 | 1813 | pub fn has_index(&self) -> bool { 1814 | self.index.is_some() 1815 | } 1816 | 1817 | // Param is passed by value, moved 1818 | pub fn set_index(&mut self, v: u64) { 1819 | self.index = ::std::option::Option::Some(v); 1820 | } 1821 | 1822 | // optional uint64 bytes = 2; 1823 | 1824 | 1825 | pub fn get_bytes(&self) -> u64 { 1826 | self.bytes.unwrap_or(0) 1827 | } 1828 | pub fn clear_bytes(&mut self) { 1829 | self.bytes = ::std::option::Option::None; 1830 | } 1831 | 1832 | pub fn has_bytes(&self) -> bool { 1833 | self.bytes.is_some() 1834 | } 1835 | 1836 | // Param is passed by value, moved 1837 | pub fn set_bytes(&mut self, v: u64) { 1838 | self.bytes = ::std::option::Option::Some(v); 1839 | } 1840 | 1841 | // optional bool hash = 3; 1842 | 1843 | 1844 | pub fn get_hash(&self) -> bool { 1845 | self.hash.unwrap_or(false) 1846 | } 1847 | pub fn clear_hash(&mut self) { 1848 | self.hash = ::std::option::Option::None; 1849 | } 1850 | 1851 | pub fn has_hash(&self) -> bool { 1852 | self.hash.is_some() 1853 | } 1854 | 1855 | // Param is passed by value, moved 1856 | pub fn set_hash(&mut self, v: bool) { 1857 | self.hash = ::std::option::Option::Some(v); 1858 | } 1859 | 1860 | // optional uint64 nodes = 4; 1861 | 1862 | 1863 | pub fn get_nodes(&self) -> u64 { 1864 | self.nodes.unwrap_or(0) 1865 | } 1866 | pub fn clear_nodes(&mut self) { 1867 | self.nodes = ::std::option::Option::None; 1868 | } 1869 | 1870 | pub fn has_nodes(&self) -> bool { 1871 | self.nodes.is_some() 1872 | } 1873 | 1874 | // Param is passed by value, moved 1875 | pub fn set_nodes(&mut self, v: u64) { 1876 | self.nodes = ::std::option::Option::Some(v); 1877 | } 1878 | } 1879 | 1880 | impl ::protobuf::Message for Request { 1881 | fn is_initialized(&self) -> bool { 1882 | if self.index.is_none() { 1883 | return false; 1884 | } 1885 | true 1886 | } 1887 | 1888 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1889 | while !is.eof()? { 1890 | let (field_number, wire_type) = is.read_tag_unpack()?; 1891 | match field_number { 1892 | 1 => { 1893 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1894 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1895 | } 1896 | let tmp = is.read_uint64()?; 1897 | self.index = ::std::option::Option::Some(tmp); 1898 | }, 1899 | 2 => { 1900 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1901 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1902 | } 1903 | let tmp = is.read_uint64()?; 1904 | self.bytes = ::std::option::Option::Some(tmp); 1905 | }, 1906 | 3 => { 1907 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1908 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1909 | } 1910 | let tmp = is.read_bool()?; 1911 | self.hash = ::std::option::Option::Some(tmp); 1912 | }, 1913 | 4 => { 1914 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 1915 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 1916 | } 1917 | let tmp = is.read_uint64()?; 1918 | self.nodes = ::std::option::Option::Some(tmp); 1919 | }, 1920 | _ => { 1921 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 1922 | }, 1923 | }; 1924 | } 1925 | ::std::result::Result::Ok(()) 1926 | } 1927 | 1928 | // Compute sizes of nested messages 1929 | #[allow(unused_variables)] 1930 | fn compute_size(&self) -> u32 { 1931 | let mut my_size = 0; 1932 | if let Some(v) = self.index { 1933 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 1934 | } 1935 | if let Some(v) = self.bytes { 1936 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 1937 | } 1938 | if let Some(v) = self.hash { 1939 | my_size += 2; 1940 | } 1941 | if let Some(v) = self.nodes { 1942 | my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); 1943 | } 1944 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 1945 | self.cached_size.set(my_size); 1946 | my_size 1947 | } 1948 | 1949 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 1950 | if let Some(v) = self.index { 1951 | os.write_uint64(1, v)?; 1952 | } 1953 | if let Some(v) = self.bytes { 1954 | os.write_uint64(2, v)?; 1955 | } 1956 | if let Some(v) = self.hash { 1957 | os.write_bool(3, v)?; 1958 | } 1959 | if let Some(v) = self.nodes { 1960 | os.write_uint64(4, v)?; 1961 | } 1962 | os.write_unknown_fields(self.get_unknown_fields())?; 1963 | ::std::result::Result::Ok(()) 1964 | } 1965 | 1966 | fn get_cached_size(&self) -> u32 { 1967 | self.cached_size.get() 1968 | } 1969 | 1970 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 1971 | &self.unknown_fields 1972 | } 1973 | 1974 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 1975 | &mut self.unknown_fields 1976 | } 1977 | 1978 | fn as_any(&self) -> &dyn (::std::any::Any) { 1979 | self as &dyn (::std::any::Any) 1980 | } 1981 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 1982 | self as &mut dyn (::std::any::Any) 1983 | } 1984 | fn into_any(self: Box) -> ::std::boxed::Box { 1985 | self 1986 | } 1987 | 1988 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 1989 | Self::descriptor_static() 1990 | } 1991 | 1992 | fn new() -> Request { 1993 | Request::new() 1994 | } 1995 | 1996 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 1997 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 1998 | lock: ::protobuf::lazy::ONCE_INIT, 1999 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 2000 | }; 2001 | unsafe { 2002 | descriptor.get(|| { 2003 | let mut fields = ::std::vec::Vec::new(); 2004 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2005 | "index", 2006 | |m: &Request| { &m.index }, 2007 | |m: &mut Request| { &mut m.index }, 2008 | )); 2009 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2010 | "bytes", 2011 | |m: &Request| { &m.bytes }, 2012 | |m: &mut Request| { &mut m.bytes }, 2013 | )); 2014 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 2015 | "hash", 2016 | |m: &Request| { &m.hash }, 2017 | |m: &mut Request| { &mut m.hash }, 2018 | )); 2019 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2020 | "nodes", 2021 | |m: &Request| { &m.nodes }, 2022 | |m: &mut Request| { &mut m.nodes }, 2023 | )); 2024 | ::protobuf::reflect::MessageDescriptor::new::( 2025 | "Request", 2026 | fields, 2027 | file_descriptor_proto() 2028 | ) 2029 | }) 2030 | } 2031 | } 2032 | 2033 | fn default_instance() -> &'static Request { 2034 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 2035 | lock: ::protobuf::lazy::ONCE_INIT, 2036 | ptr: 0 as *const Request, 2037 | }; 2038 | unsafe { 2039 | instance.get(Request::new) 2040 | } 2041 | } 2042 | } 2043 | 2044 | impl ::protobuf::Clear for Request { 2045 | fn clear(&mut self) { 2046 | self.index = ::std::option::Option::None; 2047 | self.bytes = ::std::option::Option::None; 2048 | self.hash = ::std::option::Option::None; 2049 | self.nodes = ::std::option::Option::None; 2050 | self.unknown_fields.clear(); 2051 | } 2052 | } 2053 | 2054 | impl ::std::fmt::Debug for Request { 2055 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 2056 | ::protobuf::text_format::fmt(self, f) 2057 | } 2058 | } 2059 | 2060 | impl ::protobuf::reflect::ProtobufValue for Request { 2061 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 2062 | ::protobuf::reflect::ProtobufValueRef::Message(self) 2063 | } 2064 | } 2065 | 2066 | #[derive(PartialEq,Clone,Default)] 2067 | pub struct Cancel { 2068 | // message fields 2069 | index: ::std::option::Option, 2070 | bytes: ::std::option::Option, 2071 | hash: ::std::option::Option, 2072 | // special fields 2073 | pub unknown_fields: ::protobuf::UnknownFields, 2074 | pub cached_size: ::protobuf::CachedSize, 2075 | } 2076 | 2077 | impl<'a> ::std::default::Default for &'a Cancel { 2078 | fn default() -> &'a Cancel { 2079 | ::default_instance() 2080 | } 2081 | } 2082 | 2083 | impl Cancel { 2084 | pub fn new() -> Cancel { 2085 | ::std::default::Default::default() 2086 | } 2087 | 2088 | // required uint64 index = 1; 2089 | 2090 | 2091 | pub fn get_index(&self) -> u64 { 2092 | self.index.unwrap_or(0) 2093 | } 2094 | pub fn clear_index(&mut self) { 2095 | self.index = ::std::option::Option::None; 2096 | } 2097 | 2098 | pub fn has_index(&self) -> bool { 2099 | self.index.is_some() 2100 | } 2101 | 2102 | // Param is passed by value, moved 2103 | pub fn set_index(&mut self, v: u64) { 2104 | self.index = ::std::option::Option::Some(v); 2105 | } 2106 | 2107 | // optional uint64 bytes = 2; 2108 | 2109 | 2110 | pub fn get_bytes(&self) -> u64 { 2111 | self.bytes.unwrap_or(0) 2112 | } 2113 | pub fn clear_bytes(&mut self) { 2114 | self.bytes = ::std::option::Option::None; 2115 | } 2116 | 2117 | pub fn has_bytes(&self) -> bool { 2118 | self.bytes.is_some() 2119 | } 2120 | 2121 | // Param is passed by value, moved 2122 | pub fn set_bytes(&mut self, v: u64) { 2123 | self.bytes = ::std::option::Option::Some(v); 2124 | } 2125 | 2126 | // optional bool hash = 3; 2127 | 2128 | 2129 | pub fn get_hash(&self) -> bool { 2130 | self.hash.unwrap_or(false) 2131 | } 2132 | pub fn clear_hash(&mut self) { 2133 | self.hash = ::std::option::Option::None; 2134 | } 2135 | 2136 | pub fn has_hash(&self) -> bool { 2137 | self.hash.is_some() 2138 | } 2139 | 2140 | // Param is passed by value, moved 2141 | pub fn set_hash(&mut self, v: bool) { 2142 | self.hash = ::std::option::Option::Some(v); 2143 | } 2144 | } 2145 | 2146 | impl ::protobuf::Message for Cancel { 2147 | fn is_initialized(&self) -> bool { 2148 | if self.index.is_none() { 2149 | return false; 2150 | } 2151 | true 2152 | } 2153 | 2154 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2155 | while !is.eof()? { 2156 | let (field_number, wire_type) = is.read_tag_unpack()?; 2157 | match field_number { 2158 | 1 => { 2159 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2160 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2161 | } 2162 | let tmp = is.read_uint64()?; 2163 | self.index = ::std::option::Option::Some(tmp); 2164 | }, 2165 | 2 => { 2166 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2167 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2168 | } 2169 | let tmp = is.read_uint64()?; 2170 | self.bytes = ::std::option::Option::Some(tmp); 2171 | }, 2172 | 3 => { 2173 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2174 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2175 | } 2176 | let tmp = is.read_bool()?; 2177 | self.hash = ::std::option::Option::Some(tmp); 2178 | }, 2179 | _ => { 2180 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 2181 | }, 2182 | }; 2183 | } 2184 | ::std::result::Result::Ok(()) 2185 | } 2186 | 2187 | // Compute sizes of nested messages 2188 | #[allow(unused_variables)] 2189 | fn compute_size(&self) -> u32 { 2190 | let mut my_size = 0; 2191 | if let Some(v) = self.index { 2192 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 2193 | } 2194 | if let Some(v) = self.bytes { 2195 | my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); 2196 | } 2197 | if let Some(v) = self.hash { 2198 | my_size += 2; 2199 | } 2200 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 2201 | self.cached_size.set(my_size); 2202 | my_size 2203 | } 2204 | 2205 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2206 | if let Some(v) = self.index { 2207 | os.write_uint64(1, v)?; 2208 | } 2209 | if let Some(v) = self.bytes { 2210 | os.write_uint64(2, v)?; 2211 | } 2212 | if let Some(v) = self.hash { 2213 | os.write_bool(3, v)?; 2214 | } 2215 | os.write_unknown_fields(self.get_unknown_fields())?; 2216 | ::std::result::Result::Ok(()) 2217 | } 2218 | 2219 | fn get_cached_size(&self) -> u32 { 2220 | self.cached_size.get() 2221 | } 2222 | 2223 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 2224 | &self.unknown_fields 2225 | } 2226 | 2227 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 2228 | &mut self.unknown_fields 2229 | } 2230 | 2231 | fn as_any(&self) -> &dyn (::std::any::Any) { 2232 | self as &dyn (::std::any::Any) 2233 | } 2234 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 2235 | self as &mut dyn (::std::any::Any) 2236 | } 2237 | fn into_any(self: Box) -> ::std::boxed::Box { 2238 | self 2239 | } 2240 | 2241 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 2242 | Self::descriptor_static() 2243 | } 2244 | 2245 | fn new() -> Cancel { 2246 | Cancel::new() 2247 | } 2248 | 2249 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 2250 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 2251 | lock: ::protobuf::lazy::ONCE_INIT, 2252 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 2253 | }; 2254 | unsafe { 2255 | descriptor.get(|| { 2256 | let mut fields = ::std::vec::Vec::new(); 2257 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2258 | "index", 2259 | |m: &Cancel| { &m.index }, 2260 | |m: &mut Cancel| { &mut m.index }, 2261 | )); 2262 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2263 | "bytes", 2264 | |m: &Cancel| { &m.bytes }, 2265 | |m: &mut Cancel| { &mut m.bytes }, 2266 | )); 2267 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 2268 | "hash", 2269 | |m: &Cancel| { &m.hash }, 2270 | |m: &mut Cancel| { &mut m.hash }, 2271 | )); 2272 | ::protobuf::reflect::MessageDescriptor::new::( 2273 | "Cancel", 2274 | fields, 2275 | file_descriptor_proto() 2276 | ) 2277 | }) 2278 | } 2279 | } 2280 | 2281 | fn default_instance() -> &'static Cancel { 2282 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 2283 | lock: ::protobuf::lazy::ONCE_INIT, 2284 | ptr: 0 as *const Cancel, 2285 | }; 2286 | unsafe { 2287 | instance.get(Cancel::new) 2288 | } 2289 | } 2290 | } 2291 | 2292 | impl ::protobuf::Clear for Cancel { 2293 | fn clear(&mut self) { 2294 | self.index = ::std::option::Option::None; 2295 | self.bytes = ::std::option::Option::None; 2296 | self.hash = ::std::option::Option::None; 2297 | self.unknown_fields.clear(); 2298 | } 2299 | } 2300 | 2301 | impl ::std::fmt::Debug for Cancel { 2302 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 2303 | ::protobuf::text_format::fmt(self, f) 2304 | } 2305 | } 2306 | 2307 | impl ::protobuf::reflect::ProtobufValue for Cancel { 2308 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 2309 | ::protobuf::reflect::ProtobufValueRef::Message(self) 2310 | } 2311 | } 2312 | 2313 | #[derive(PartialEq,Clone,Default)] 2314 | pub struct Data { 2315 | // message fields 2316 | index: ::std::option::Option, 2317 | value: ::protobuf::SingularField<::std::vec::Vec>, 2318 | nodes: ::protobuf::RepeatedField, 2319 | signature: ::protobuf::SingularField<::std::vec::Vec>, 2320 | // special fields 2321 | pub unknown_fields: ::protobuf::UnknownFields, 2322 | pub cached_size: ::protobuf::CachedSize, 2323 | } 2324 | 2325 | impl<'a> ::std::default::Default for &'a Data { 2326 | fn default() -> &'a Data { 2327 | ::default_instance() 2328 | } 2329 | } 2330 | 2331 | impl Data { 2332 | pub fn new() -> Data { 2333 | ::std::default::Default::default() 2334 | } 2335 | 2336 | // required uint64 index = 1; 2337 | 2338 | 2339 | pub fn get_index(&self) -> u64 { 2340 | self.index.unwrap_or(0) 2341 | } 2342 | pub fn clear_index(&mut self) { 2343 | self.index = ::std::option::Option::None; 2344 | } 2345 | 2346 | pub fn has_index(&self) -> bool { 2347 | self.index.is_some() 2348 | } 2349 | 2350 | // Param is passed by value, moved 2351 | pub fn set_index(&mut self, v: u64) { 2352 | self.index = ::std::option::Option::Some(v); 2353 | } 2354 | 2355 | // optional bytes value = 2; 2356 | 2357 | 2358 | pub fn get_value(&self) -> &[u8] { 2359 | match self.value.as_ref() { 2360 | Some(v) => &v, 2361 | None => &[], 2362 | } 2363 | } 2364 | pub fn clear_value(&mut self) { 2365 | self.value.clear(); 2366 | } 2367 | 2368 | pub fn has_value(&self) -> bool { 2369 | self.value.is_some() 2370 | } 2371 | 2372 | // Param is passed by value, moved 2373 | pub fn set_value(&mut self, v: ::std::vec::Vec) { 2374 | self.value = ::protobuf::SingularField::some(v); 2375 | } 2376 | 2377 | // Mutable pointer to the field. 2378 | // If field is not initialized, it is initialized with default value first. 2379 | pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { 2380 | if self.value.is_none() { 2381 | self.value.set_default(); 2382 | } 2383 | self.value.as_mut().unwrap() 2384 | } 2385 | 2386 | // Take field 2387 | pub fn take_value(&mut self) -> ::std::vec::Vec { 2388 | self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) 2389 | } 2390 | 2391 | // repeated .Data.Node nodes = 3; 2392 | 2393 | 2394 | pub fn get_nodes(&self) -> &[Data_Node] { 2395 | &self.nodes 2396 | } 2397 | pub fn clear_nodes(&mut self) { 2398 | self.nodes.clear(); 2399 | } 2400 | 2401 | // Param is passed by value, moved 2402 | pub fn set_nodes(&mut self, v: ::protobuf::RepeatedField) { 2403 | self.nodes = v; 2404 | } 2405 | 2406 | // Mutable pointer to the field. 2407 | pub fn mut_nodes(&mut self) -> &mut ::protobuf::RepeatedField { 2408 | &mut self.nodes 2409 | } 2410 | 2411 | // Take field 2412 | pub fn take_nodes(&mut self) -> ::protobuf::RepeatedField { 2413 | ::std::mem::replace(&mut self.nodes, ::protobuf::RepeatedField::new()) 2414 | } 2415 | 2416 | // optional bytes signature = 4; 2417 | 2418 | 2419 | pub fn get_signature(&self) -> &[u8] { 2420 | match self.signature.as_ref() { 2421 | Some(v) => &v, 2422 | None => &[], 2423 | } 2424 | } 2425 | pub fn clear_signature(&mut self) { 2426 | self.signature.clear(); 2427 | } 2428 | 2429 | pub fn has_signature(&self) -> bool { 2430 | self.signature.is_some() 2431 | } 2432 | 2433 | // Param is passed by value, moved 2434 | pub fn set_signature(&mut self, v: ::std::vec::Vec) { 2435 | self.signature = ::protobuf::SingularField::some(v); 2436 | } 2437 | 2438 | // Mutable pointer to the field. 2439 | // If field is not initialized, it is initialized with default value first. 2440 | pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { 2441 | if self.signature.is_none() { 2442 | self.signature.set_default(); 2443 | } 2444 | self.signature.as_mut().unwrap() 2445 | } 2446 | 2447 | // Take field 2448 | pub fn take_signature(&mut self) -> ::std::vec::Vec { 2449 | self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) 2450 | } 2451 | } 2452 | 2453 | impl ::protobuf::Message for Data { 2454 | fn is_initialized(&self) -> bool { 2455 | if self.index.is_none() { 2456 | return false; 2457 | } 2458 | for v in &self.nodes { 2459 | if !v.is_initialized() { 2460 | return false; 2461 | } 2462 | }; 2463 | true 2464 | } 2465 | 2466 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2467 | while !is.eof()? { 2468 | let (field_number, wire_type) = is.read_tag_unpack()?; 2469 | match field_number { 2470 | 1 => { 2471 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2472 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2473 | } 2474 | let tmp = is.read_uint64()?; 2475 | self.index = ::std::option::Option::Some(tmp); 2476 | }, 2477 | 2 => { 2478 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; 2479 | }, 2480 | 3 => { 2481 | ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.nodes)?; 2482 | }, 2483 | 4 => { 2484 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?; 2485 | }, 2486 | _ => { 2487 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 2488 | }, 2489 | }; 2490 | } 2491 | ::std::result::Result::Ok(()) 2492 | } 2493 | 2494 | // Compute sizes of nested messages 2495 | #[allow(unused_variables)] 2496 | fn compute_size(&self) -> u32 { 2497 | let mut my_size = 0; 2498 | if let Some(v) = self.index { 2499 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 2500 | } 2501 | if let Some(ref v) = self.value.as_ref() { 2502 | my_size += ::protobuf::rt::bytes_size(2, &v); 2503 | } 2504 | for value in &self.nodes { 2505 | let len = value.compute_size(); 2506 | my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; 2507 | }; 2508 | if let Some(ref v) = self.signature.as_ref() { 2509 | my_size += ::protobuf::rt::bytes_size(4, &v); 2510 | } 2511 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 2512 | self.cached_size.set(my_size); 2513 | my_size 2514 | } 2515 | 2516 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2517 | if let Some(v) = self.index { 2518 | os.write_uint64(1, v)?; 2519 | } 2520 | if let Some(ref v) = self.value.as_ref() { 2521 | os.write_bytes(2, &v)?; 2522 | } 2523 | for v in &self.nodes { 2524 | os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; 2525 | os.write_raw_varint32(v.get_cached_size())?; 2526 | v.write_to_with_cached_sizes(os)?; 2527 | }; 2528 | if let Some(ref v) = self.signature.as_ref() { 2529 | os.write_bytes(4, &v)?; 2530 | } 2531 | os.write_unknown_fields(self.get_unknown_fields())?; 2532 | ::std::result::Result::Ok(()) 2533 | } 2534 | 2535 | fn get_cached_size(&self) -> u32 { 2536 | self.cached_size.get() 2537 | } 2538 | 2539 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 2540 | &self.unknown_fields 2541 | } 2542 | 2543 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 2544 | &mut self.unknown_fields 2545 | } 2546 | 2547 | fn as_any(&self) -> &dyn (::std::any::Any) { 2548 | self as &dyn (::std::any::Any) 2549 | } 2550 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 2551 | self as &mut dyn (::std::any::Any) 2552 | } 2553 | fn into_any(self: Box) -> ::std::boxed::Box { 2554 | self 2555 | } 2556 | 2557 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 2558 | Self::descriptor_static() 2559 | } 2560 | 2561 | fn new() -> Data { 2562 | Data::new() 2563 | } 2564 | 2565 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 2566 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 2567 | lock: ::protobuf::lazy::ONCE_INIT, 2568 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 2569 | }; 2570 | unsafe { 2571 | descriptor.get(|| { 2572 | let mut fields = ::std::vec::Vec::new(); 2573 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2574 | "index", 2575 | |m: &Data| { &m.index }, 2576 | |m: &mut Data| { &mut m.index }, 2577 | )); 2578 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 2579 | "value", 2580 | |m: &Data| { &m.value }, 2581 | |m: &mut Data| { &mut m.value }, 2582 | )); 2583 | fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( 2584 | "nodes", 2585 | |m: &Data| { &m.nodes }, 2586 | |m: &mut Data| { &mut m.nodes }, 2587 | )); 2588 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 2589 | "signature", 2590 | |m: &Data| { &m.signature }, 2591 | |m: &mut Data| { &mut m.signature }, 2592 | )); 2593 | ::protobuf::reflect::MessageDescriptor::new::( 2594 | "Data", 2595 | fields, 2596 | file_descriptor_proto() 2597 | ) 2598 | }) 2599 | } 2600 | } 2601 | 2602 | fn default_instance() -> &'static Data { 2603 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 2604 | lock: ::protobuf::lazy::ONCE_INIT, 2605 | ptr: 0 as *const Data, 2606 | }; 2607 | unsafe { 2608 | instance.get(Data::new) 2609 | } 2610 | } 2611 | } 2612 | 2613 | impl ::protobuf::Clear for Data { 2614 | fn clear(&mut self) { 2615 | self.index = ::std::option::Option::None; 2616 | self.value.clear(); 2617 | self.nodes.clear(); 2618 | self.signature.clear(); 2619 | self.unknown_fields.clear(); 2620 | } 2621 | } 2622 | 2623 | impl ::std::fmt::Debug for Data { 2624 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 2625 | ::protobuf::text_format::fmt(self, f) 2626 | } 2627 | } 2628 | 2629 | impl ::protobuf::reflect::ProtobufValue for Data { 2630 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 2631 | ::protobuf::reflect::ProtobufValueRef::Message(self) 2632 | } 2633 | } 2634 | 2635 | #[derive(PartialEq,Clone,Default)] 2636 | pub struct Data_Node { 2637 | // message fields 2638 | index: ::std::option::Option, 2639 | hash: ::protobuf::SingularField<::std::vec::Vec>, 2640 | size: ::std::option::Option, 2641 | // special fields 2642 | pub unknown_fields: ::protobuf::UnknownFields, 2643 | pub cached_size: ::protobuf::CachedSize, 2644 | } 2645 | 2646 | impl<'a> ::std::default::Default for &'a Data_Node { 2647 | fn default() -> &'a Data_Node { 2648 | ::default_instance() 2649 | } 2650 | } 2651 | 2652 | impl Data_Node { 2653 | pub fn new() -> Data_Node { 2654 | ::std::default::Default::default() 2655 | } 2656 | 2657 | // required uint64 index = 1; 2658 | 2659 | 2660 | pub fn get_index(&self) -> u64 { 2661 | self.index.unwrap_or(0) 2662 | } 2663 | pub fn clear_index(&mut self) { 2664 | self.index = ::std::option::Option::None; 2665 | } 2666 | 2667 | pub fn has_index(&self) -> bool { 2668 | self.index.is_some() 2669 | } 2670 | 2671 | // Param is passed by value, moved 2672 | pub fn set_index(&mut self, v: u64) { 2673 | self.index = ::std::option::Option::Some(v); 2674 | } 2675 | 2676 | // required bytes hash = 2; 2677 | 2678 | 2679 | pub fn get_hash(&self) -> &[u8] { 2680 | match self.hash.as_ref() { 2681 | Some(v) => &v, 2682 | None => &[], 2683 | } 2684 | } 2685 | pub fn clear_hash(&mut self) { 2686 | self.hash.clear(); 2687 | } 2688 | 2689 | pub fn has_hash(&self) -> bool { 2690 | self.hash.is_some() 2691 | } 2692 | 2693 | // Param is passed by value, moved 2694 | pub fn set_hash(&mut self, v: ::std::vec::Vec) { 2695 | self.hash = ::protobuf::SingularField::some(v); 2696 | } 2697 | 2698 | // Mutable pointer to the field. 2699 | // If field is not initialized, it is initialized with default value first. 2700 | pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { 2701 | if self.hash.is_none() { 2702 | self.hash.set_default(); 2703 | } 2704 | self.hash.as_mut().unwrap() 2705 | } 2706 | 2707 | // Take field 2708 | pub fn take_hash(&mut self) -> ::std::vec::Vec { 2709 | self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) 2710 | } 2711 | 2712 | // required uint64 size = 3; 2713 | 2714 | 2715 | pub fn get_size(&self) -> u64 { 2716 | self.size.unwrap_or(0) 2717 | } 2718 | pub fn clear_size(&mut self) { 2719 | self.size = ::std::option::Option::None; 2720 | } 2721 | 2722 | pub fn has_size(&self) -> bool { 2723 | self.size.is_some() 2724 | } 2725 | 2726 | // Param is passed by value, moved 2727 | pub fn set_size(&mut self, v: u64) { 2728 | self.size = ::std::option::Option::Some(v); 2729 | } 2730 | } 2731 | 2732 | impl ::protobuf::Message for Data_Node { 2733 | fn is_initialized(&self) -> bool { 2734 | if self.index.is_none() { 2735 | return false; 2736 | } 2737 | if self.hash.is_none() { 2738 | return false; 2739 | } 2740 | if self.size.is_none() { 2741 | return false; 2742 | } 2743 | true 2744 | } 2745 | 2746 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2747 | while !is.eof()? { 2748 | let (field_number, wire_type) = is.read_tag_unpack()?; 2749 | match field_number { 2750 | 1 => { 2751 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2752 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2753 | } 2754 | let tmp = is.read_uint64()?; 2755 | self.index = ::std::option::Option::Some(tmp); 2756 | }, 2757 | 2 => { 2758 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?; 2759 | }, 2760 | 3 => { 2761 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 2762 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 2763 | } 2764 | let tmp = is.read_uint64()?; 2765 | self.size = ::std::option::Option::Some(tmp); 2766 | }, 2767 | _ => { 2768 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 2769 | }, 2770 | }; 2771 | } 2772 | ::std::result::Result::Ok(()) 2773 | } 2774 | 2775 | // Compute sizes of nested messages 2776 | #[allow(unused_variables)] 2777 | fn compute_size(&self) -> u32 { 2778 | let mut my_size = 0; 2779 | if let Some(v) = self.index { 2780 | my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); 2781 | } 2782 | if let Some(ref v) = self.hash.as_ref() { 2783 | my_size += ::protobuf::rt::bytes_size(2, &v); 2784 | } 2785 | if let Some(v) = self.size { 2786 | my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); 2787 | } 2788 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 2789 | self.cached_size.set(my_size); 2790 | my_size 2791 | } 2792 | 2793 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2794 | if let Some(v) = self.index { 2795 | os.write_uint64(1, v)?; 2796 | } 2797 | if let Some(ref v) = self.hash.as_ref() { 2798 | os.write_bytes(2, &v)?; 2799 | } 2800 | if let Some(v) = self.size { 2801 | os.write_uint64(3, v)?; 2802 | } 2803 | os.write_unknown_fields(self.get_unknown_fields())?; 2804 | ::std::result::Result::Ok(()) 2805 | } 2806 | 2807 | fn get_cached_size(&self) -> u32 { 2808 | self.cached_size.get() 2809 | } 2810 | 2811 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 2812 | &self.unknown_fields 2813 | } 2814 | 2815 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 2816 | &mut self.unknown_fields 2817 | } 2818 | 2819 | fn as_any(&self) -> &dyn (::std::any::Any) { 2820 | self as &dyn (::std::any::Any) 2821 | } 2822 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 2823 | self as &mut dyn (::std::any::Any) 2824 | } 2825 | fn into_any(self: Box) -> ::std::boxed::Box { 2826 | self 2827 | } 2828 | 2829 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 2830 | Self::descriptor_static() 2831 | } 2832 | 2833 | fn new() -> Data_Node { 2834 | Data_Node::new() 2835 | } 2836 | 2837 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 2838 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 2839 | lock: ::protobuf::lazy::ONCE_INIT, 2840 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 2841 | }; 2842 | unsafe { 2843 | descriptor.get(|| { 2844 | let mut fields = ::std::vec::Vec::new(); 2845 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2846 | "index", 2847 | |m: &Data_Node| { &m.index }, 2848 | |m: &mut Data_Node| { &mut m.index }, 2849 | )); 2850 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 2851 | "hash", 2852 | |m: &Data_Node| { &m.hash }, 2853 | |m: &mut Data_Node| { &mut m.hash }, 2854 | )); 2855 | fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 2856 | "size", 2857 | |m: &Data_Node| { &m.size }, 2858 | |m: &mut Data_Node| { &mut m.size }, 2859 | )); 2860 | ::protobuf::reflect::MessageDescriptor::new::( 2861 | "Data_Node", 2862 | fields, 2863 | file_descriptor_proto() 2864 | ) 2865 | }) 2866 | } 2867 | } 2868 | 2869 | fn default_instance() -> &'static Data_Node { 2870 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 2871 | lock: ::protobuf::lazy::ONCE_INIT, 2872 | ptr: 0 as *const Data_Node, 2873 | }; 2874 | unsafe { 2875 | instance.get(Data_Node::new) 2876 | } 2877 | } 2878 | } 2879 | 2880 | impl ::protobuf::Clear for Data_Node { 2881 | fn clear(&mut self) { 2882 | self.index = ::std::option::Option::None; 2883 | self.hash.clear(); 2884 | self.size = ::std::option::Option::None; 2885 | self.unknown_fields.clear(); 2886 | } 2887 | } 2888 | 2889 | impl ::std::fmt::Debug for Data_Node { 2890 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 2891 | ::protobuf::text_format::fmt(self, f) 2892 | } 2893 | } 2894 | 2895 | impl ::protobuf::reflect::ProtobufValue for Data_Node { 2896 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 2897 | ::protobuf::reflect::ProtobufValueRef::Message(self) 2898 | } 2899 | } 2900 | 2901 | #[derive(PartialEq,Clone,Default)] 2902 | pub struct Close { 2903 | // message fields 2904 | discoveryKey: ::protobuf::SingularField<::std::vec::Vec>, 2905 | // special fields 2906 | pub unknown_fields: ::protobuf::UnknownFields, 2907 | pub cached_size: ::protobuf::CachedSize, 2908 | } 2909 | 2910 | impl<'a> ::std::default::Default for &'a Close { 2911 | fn default() -> &'a Close { 2912 | ::default_instance() 2913 | } 2914 | } 2915 | 2916 | impl Close { 2917 | pub fn new() -> Close { 2918 | ::std::default::Default::default() 2919 | } 2920 | 2921 | // optional bytes discoveryKey = 1; 2922 | 2923 | 2924 | pub fn get_discoveryKey(&self) -> &[u8] { 2925 | match self.discoveryKey.as_ref() { 2926 | Some(v) => &v, 2927 | None => &[], 2928 | } 2929 | } 2930 | pub fn clear_discoveryKey(&mut self) { 2931 | self.discoveryKey.clear(); 2932 | } 2933 | 2934 | pub fn has_discoveryKey(&self) -> bool { 2935 | self.discoveryKey.is_some() 2936 | } 2937 | 2938 | // Param is passed by value, moved 2939 | pub fn set_discoveryKey(&mut self, v: ::std::vec::Vec) { 2940 | self.discoveryKey = ::protobuf::SingularField::some(v); 2941 | } 2942 | 2943 | // Mutable pointer to the field. 2944 | // If field is not initialized, it is initialized with default value first. 2945 | pub fn mut_discoveryKey(&mut self) -> &mut ::std::vec::Vec { 2946 | if self.discoveryKey.is_none() { 2947 | self.discoveryKey.set_default(); 2948 | } 2949 | self.discoveryKey.as_mut().unwrap() 2950 | } 2951 | 2952 | // Take field 2953 | pub fn take_discoveryKey(&mut self) -> ::std::vec::Vec { 2954 | self.discoveryKey.take().unwrap_or_else(|| ::std::vec::Vec::new()) 2955 | } 2956 | } 2957 | 2958 | impl ::protobuf::Message for Close { 2959 | fn is_initialized(&self) -> bool { 2960 | true 2961 | } 2962 | 2963 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2964 | while !is.eof()? { 2965 | let (field_number, wire_type) = is.read_tag_unpack()?; 2966 | match field_number { 2967 | 1 => { 2968 | ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.discoveryKey)?; 2969 | }, 2970 | _ => { 2971 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 2972 | }, 2973 | }; 2974 | } 2975 | ::std::result::Result::Ok(()) 2976 | } 2977 | 2978 | // Compute sizes of nested messages 2979 | #[allow(unused_variables)] 2980 | fn compute_size(&self) -> u32 { 2981 | let mut my_size = 0; 2982 | if let Some(ref v) = self.discoveryKey.as_ref() { 2983 | my_size += ::protobuf::rt::bytes_size(1, &v); 2984 | } 2985 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 2986 | self.cached_size.set(my_size); 2987 | my_size 2988 | } 2989 | 2990 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 2991 | if let Some(ref v) = self.discoveryKey.as_ref() { 2992 | os.write_bytes(1, &v)?; 2993 | } 2994 | os.write_unknown_fields(self.get_unknown_fields())?; 2995 | ::std::result::Result::Ok(()) 2996 | } 2997 | 2998 | fn get_cached_size(&self) -> u32 { 2999 | self.cached_size.get() 3000 | } 3001 | 3002 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 3003 | &self.unknown_fields 3004 | } 3005 | 3006 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 3007 | &mut self.unknown_fields 3008 | } 3009 | 3010 | fn as_any(&self) -> &dyn (::std::any::Any) { 3011 | self as &dyn (::std::any::Any) 3012 | } 3013 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 3014 | self as &mut dyn (::std::any::Any) 3015 | } 3016 | fn into_any(self: Box) -> ::std::boxed::Box { 3017 | self 3018 | } 3019 | 3020 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 3021 | Self::descriptor_static() 3022 | } 3023 | 3024 | fn new() -> Close { 3025 | Close::new() 3026 | } 3027 | 3028 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 3029 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { 3030 | lock: ::protobuf::lazy::ONCE_INIT, 3031 | ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, 3032 | }; 3033 | unsafe { 3034 | descriptor.get(|| { 3035 | let mut fields = ::std::vec::Vec::new(); 3036 | fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( 3037 | "discoveryKey", 3038 | |m: &Close| { &m.discoveryKey }, 3039 | |m: &mut Close| { &mut m.discoveryKey }, 3040 | )); 3041 | ::protobuf::reflect::MessageDescriptor::new::( 3042 | "Close", 3043 | fields, 3044 | file_descriptor_proto() 3045 | ) 3046 | }) 3047 | } 3048 | } 3049 | 3050 | fn default_instance() -> &'static Close { 3051 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { 3052 | lock: ::protobuf::lazy::ONCE_INIT, 3053 | ptr: 0 as *const Close, 3054 | }; 3055 | unsafe { 3056 | instance.get(Close::new) 3057 | } 3058 | } 3059 | } 3060 | 3061 | impl ::protobuf::Clear for Close { 3062 | fn clear(&mut self) { 3063 | self.discoveryKey.clear(); 3064 | self.unknown_fields.clear(); 3065 | } 3066 | } 3067 | 3068 | impl ::std::fmt::Debug for Close { 3069 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 3070 | ::protobuf::text_format::fmt(self, f) 3071 | } 3072 | } 3073 | 3074 | impl ::protobuf::reflect::ProtobufValue for Close { 3075 | fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { 3076 | ::protobuf::reflect::ProtobufValueRef::Message(self) 3077 | } 3078 | } 3079 | 3080 | static file_descriptor_proto_data: &'static [u8] = b"\ 3081 | \n\tlib.proto\x12\0\"!\n\x0cNoisePayload\x12\x0f\n\x05nonce\x18\x01\x20\ 3082 | \x02(\x0cB\0:\0\"6\n\x04Open\x12\x16\n\x0cdiscoveryKey\x18\x01\x20\x02(\ 3083 | \x0cB\0\x12\x14\n\ncapability\x18\x02\x20\x01(\x0cB\0:\0\"0\n\x07Options\ 3084 | \x12\x14\n\nextensions\x18\x01\x20\x03(\tB\0\x12\r\n\x03ack\x18\x02\x20\ 3085 | \x01(\x08B\0:\0\"6\n\x06Status\x12\x13\n\tuploading\x18\x01\x20\x01(\x08\ 3086 | B\0\x12\x15\n\x0bdownloading\x18\x02\x20\x01(\x08B\0:\0\"Q\n\x04Have\x12\ 3087 | \x0f\n\x05start\x18\x01\x20\x02(\x04B\0\x12\x13\n\x06length\x18\x02\x20\ 3088 | \x01(\x04:\x011B\0\x12\x12\n\x08bitfield\x18\x03\x20\x01(\x0cB\0\x12\r\n\ 3089 | \x03ack\x18\x04\x20\x01(\x08B\0:\0\"0\n\x06Unhave\x12\x0f\n\x05start\x18\ 3090 | \x01\x20\x02(\x04B\0\x12\x13\n\x06length\x18\x02\x20\x01(\x04:\x011B\0:\ 3091 | \0\"+\n\x04Want\x12\x0f\n\x05start\x18\x01\x20\x02(\x04B\0\x12\x10\n\x06\ 3092 | length\x18\x02\x20\x01(\x04B\0:\0\"-\n\x06Unwant\x12\x0f\n\x05start\x18\ 3093 | \x01\x20\x02(\x04B\0\x12\x10\n\x06length\x18\x02\x20\x01(\x04B\0:\0\"N\n\ 3094 | \x07Request\x12\x0f\n\x05index\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05byte\ 3095 | s\x18\x02\x20\x01(\x04B\0\x12\x0e\n\x04hash\x18\x03\x20\x01(\x08B\0\x12\ 3096 | \x0f\n\x05nodes\x18\x04\x20\x01(\x04B\0:\0\"<\n\x06Cancel\x12\x0f\n\x05i\ 3097 | ndex\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05bytes\x18\x02\x20\x01(\x04B\0\ 3098 | \x12\x0e\n\x04hash\x18\x03\x20\x01(\x08B\0:\0\"\x97\x01\n\x04Data\x12\ 3099 | \x0f\n\x05index\x18\x01\x20\x02(\x04B\0\x12\x0f\n\x05value\x18\x02\x20\ 3100 | \x01(\x0cB\0\x12\x1b\n\x05nodes\x18\x03\x20\x03(\x0b2\n.Data.NodeB\0\x12\ 3101 | \x13\n\tsignature\x18\x04\x20\x01(\x0cB\0\x1a9\n\x04Node\x12\x0f\n\x05in\ 3102 | dex\x18\x01\x20\x02(\x04B\0\x12\x0e\n\x04hash\x18\x02\x20\x02(\x0cB\0\ 3103 | \x12\x0e\n\x04size\x18\x03\x20\x02(\x04B\0:\0:\0\"!\n\x05Close\x12\x16\n\ 3104 | \x0cdiscoveryKey\x18\x01\x20\x01(\x0cB\0:\0B\0b\x06proto2\ 3105 | "; 3106 | 3107 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { 3108 | lock: ::protobuf::lazy::ONCE_INIT, 3109 | ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, 3110 | }; 3111 | 3112 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 3113 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 3114 | } 3115 | 3116 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 3117 | unsafe { 3118 | file_descriptor_proto_lazy.get(|| { 3119 | parse_descriptor_proto() 3120 | }) 3121 | } 3122 | } 3123 | --------------------------------------------------------------------------------