{"action":"created","comment":{"url":"https://api.github.com/repos/m-labs/smoltcp/pulls/comments/165247889","pull_request_review_id":93154012,"id":165247889,"diff_hunk":"@@ -0,0 +1,316 @@\n+use core::fmt;\n+use {Error, Result};\n+\n+pub use super::IpProtocol as Protocol;\n+\n+/// A read/write wrapper around an IPv6 Hop-by-Hop Options Header.\n+#[derive(Debug, PartialEq)]\n+pub struct HopByHop<T: AsRef<[u8]>> {\n+    buffer: T\n+}\n+\n+// Format of the Hop-by-Hop Options Header\n+//\n+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+// |  Next Header  |  Hdr Ext Len  |                               |\n+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +\n+// |                                                               |\n+// .                                                               .\n+// .                            Options                            .\n+// .                                                               .\n+// |                                                               |\n+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n+//\n+//\n+// See https://tools.ietf.org/html/rfc8200#section-4.3 for details.\n+mod field {\n+    #![allow(non_snake_case)]\n+\n+    use wire::field::*;\n+\n+    // 8-bit identifier of the header immediately following this header.\n+    pub const NXT_HDR:  usize = 0;\n+    // 8-bit unsigned integer. Length of the OPTIONS field in 8-octet units,\n+    // not including the first 8 octets.\n+    pub const LENGTH:   usize = 1;\n+    // Variable-length field. Option-Type-specific data.\n+    pub fn OPTIONS(length: u8) -> Field {\n+        2..length as usize + 2\n+    }\n+}\n+\n+impl<T: AsRef<[u8]>> HopByHop<T> {\n+    /// Create a raw octet buffer with an IPv6 Hop-by-Hop Options Header structure.\n+    pub fn new(buffer: T) -> HopByHop<T> {\n+        HopByHop { buffer }\n+    }\n+\n+    /// Shorthand for a combination of [new] and [check_len].\n+    ///\n+    /// [new]: #method.new\n+    /// [check_len]: #method.check_len\n+    pub fn new_checked(buffer: T) -> Result<HopByHop<T>> {\n+        let hopbyhop = Self::new(buffer);\n+        hopbyhop.check_len()?;\n+        Ok(hopbyhop)\n+    }\n+\n+    /// Ensure that no accessor method will panic if called.\n+    /// Returns `Err(Error::Truncated)` if the buffer is too short.\n+    ///\n+    /// The result of this check is invalidated by calling [set_header_len].\n+    ///\n+    /// [set_header_len]: #method.set_header_len\n+    pub fn check_len(&self) -> Result<()> {\n+        let data = self.buffer.as_ref();\n+        let len = data.len();\n+\n+        if len == field::NXT_HDR {","path":"src/wire/ipv6hop.rs","position":68,"original_position":68,"commit_id":"2dbdeb4976dab1c7948a1f93275eafbeb5fa0a87","original_commit_id":"2dbdeb4976dab1c7948a1f93275eafbeb5fa0a87","user":{"login":"dlrobertson","id":7504153,"avatar_url":"https://avatars1.githubusercontent.com/u/7504153?v=4","gravatar_id":"","url":"https://api.github.com/users/dlrobertson","html_url":"https://github.com/dlrobertson","followers_url":"https://api.github.com/users/dlrobertson/followers","following_url":"https://api.github.com/users/dlrobertson/following{/other_user}","gists_url":"https://api.github.com/users/dlrobertson/gists{/gist_id}","starred_url":"https://api.github.com/users/dlrobertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlrobertson/subscriptions","organizations_url":"https://api.github.com/users/dlrobertson/orgs","repos_url":"https://api.github.com/users/dlrobertson/repos","events_url":"https://api.github.com/users/dlrobertson/events{/privacy}","received_events_url":"https://api.github.com/users/dlrobertson/received_events","type":"User","site_admin":false},"body":"Good point, so why not add `MIN_HEADER_SIZE = 8`, then change this to `len < field::MIN_HEADER_SIZE`","created_at":"2018-02-01T02:49:49Z","updated_at":"2018-02-01T02:49:49Z","html_url":"https://github.com/m-labs/smoltcp/pull/139#discussion_r165247889","pull_request_url":"https://api.github.com/repos/m-labs/smoltcp/pulls/139","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/comments/165247889"},"html":{"href":"https://github.com/m-labs/smoltcp/pull/139#discussion_r165247889"},"pull_request":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/139"}},"in_reply_to_id":165236807},"pull_request":{"url":"https://api.github.com/repos/m-labs/smoltcp/pulls/139","id":166297222,"html_url":"https://github.com/m-labs/smoltcp/pull/139","diff_url":"https://github.com/m-labs/smoltcp/pull/139.diff","patch_url":"https://github.com/m-labs/smoltcp/pull/139.patch","issue_url":"https://api.github.com/repos/m-labs/smoltcp/issues/139","number":139,"state":"open","locked":false,"title":"Add IPv6 Extension Hop-by-Hop Options Header","user":{"login":"hjr3","id":33318,"avatar_url":"https://avatars1.githubusercontent.com/u/33318?v=4","gravatar_id":"","url":"https://api.github.com/users/hjr3","html_url":"https://github.com/hjr3","followers_url":"https://api.github.com/users/hjr3/followers","following_url":"https://api.github.com/users/hjr3/following{/other_user}","gists_url":"https://api.github.com/users/hjr3/gists{/gist_id}","starred_url":"https://api.github.com/users/hjr3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjr3/subscriptions","organizations_url":"https://api.github.com/users/hjr3/orgs","repos_url":"https://api.github.com/users/hjr3/repos","events_url":"https://api.github.com/users/hjr3/events{/privacy}","received_events_url":"https://api.github.com/users/hjr3/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-01-31T15:47:37Z","updated_at":"2018-02-01T02:49:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef895461fce2b844a58955a137c1bff5b6eb6c49","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/m-labs/smoltcp/pulls/139/commits","review_comments_url":"https://api.github.com/repos/m-labs/smoltcp/pulls/139/comments","review_comment_url":"https://api.github.com/repos/m-labs/smoltcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m-labs/smoltcp/issues/139/comments","statuses_url":"https://api.github.com/repos/m-labs/smoltcp/statuses/2dbdeb4976dab1c7948a1f93275eafbeb5fa0a87","head":{"label":"hjr3:ipv6-hop-by-hop","ref":"ipv6-hop-by-hop","sha":"2dbdeb4976dab1c7948a1f93275eafbeb5fa0a87","user":{"login":"hjr3","id":33318,"avatar_url":"https://avatars1.githubusercontent.com/u/33318?v=4","gravatar_id":"","url":"https://api.github.com/users/hjr3","html_url":"https://github.com/hjr3","followers_url":"https://api.github.com/users/hjr3/followers","following_url":"https://api.github.com/users/hjr3/following{/other_user}","gists_url":"https://api.github.com/users/hjr3/gists{/gist_id}","starred_url":"https://api.github.com/users/hjr3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjr3/subscriptions","organizations_url":"https://api.github.com/users/hjr3/orgs","repos_url":"https://api.github.com/users/hjr3/repos","events_url":"https://api.github.com/users/hjr3/events{/privacy}","received_events_url":"https://api.github.com/users/hjr3/received_events","type":"User","site_admin":false},"repo":{"id":115244805,"name":"smoltcp","full_name":"hjr3/smoltcp","owner":{"login":"hjr3","id":33318,"avatar_url":"https://avatars1.githubusercontent.com/u/33318?v=4","gravatar_id":"","url":"https://api.github.com/users/hjr3","html_url":"https://github.com/hjr3","followers_url":"https://api.github.com/users/hjr3/followers","following_url":"https://api.github.com/users/hjr3/following{/other_user}","gists_url":"https://api.github.com/users/hjr3/gists{/gist_id}","starred_url":"https://api.github.com/users/hjr3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjr3/subscriptions","organizations_url":"https://api.github.com/users/hjr3/orgs","repos_url":"https://api.github.com/users/hjr3/repos","events_url":"https://api.github.com/users/hjr3/events{/privacy}","received_events_url":"https://api.github.com/users/hjr3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hjr3/smoltcp","description":"a smol tcp/ip stack","fork":true,"url":"https://api.github.com/repos/hjr3/smoltcp","forks_url":"https://api.github.com/repos/hjr3/smoltcp/forks","keys_url":"https://api.github.com/repos/hjr3/smoltcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hjr3/smoltcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hjr3/smoltcp/teams","hooks_url":"https://api.github.com/repos/hjr3/smoltcp/hooks","issue_events_url":"https://api.github.com/repos/hjr3/smoltcp/issues/events{/number}","events_url":"https://api.github.com/repos/hjr3/smoltcp/events","assignees_url":"https://api.github.com/repos/hjr3/smoltcp/assignees{/user}","branches_url":"https://api.github.com/repos/hjr3/smoltcp/branches{/branch}","tags_url":"https://api.github.com/repos/hjr3/smoltcp/tags","blobs_url":"https://api.github.com/repos/hjr3/smoltcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hjr3/smoltcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hjr3/smoltcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/hjr3/smoltcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hjr3/smoltcp/statuses/{sha}","languages_url":"https://api.github.com/repos/hjr3/smoltcp/languages","stargazers_url":"https://api.github.com/repos/hjr3/smoltcp/stargazers","contributors_url":"https://api.github.com/repos/hjr3/smoltcp/contributors","subscribers_url":"https://api.github.com/repos/hjr3/smoltcp/subscribers","subscription_url":"https://api.github.com/repos/hjr3/smoltcp/subscription","commits_url":"https://api.github.com/repos/hjr3/smoltcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/hjr3/smoltcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/hjr3/smoltcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/hjr3/smoltcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/hjr3/smoltcp/contents/{+path}","compare_url":"https://api.github.com/repos/hjr3/smoltcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hjr3/smoltcp/merges","archive_url":"https://api.github.com/repos/hjr3/smoltcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hjr3/smoltcp/downloads","issues_url":"https://api.github.com/repos/hjr3/smoltcp/issues{/number}","pulls_url":"https://api.github.com/repos/hjr3/smoltcp/pulls{/number}","milestones_url":"https://api.github.com/repos/hjr3/smoltcp/milestones{/number}","notifications_url":"https://api.github.com/repos/hjr3/smoltcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hjr3/smoltcp/labels{/name}","releases_url":"https://api.github.com/repos/hjr3/smoltcp/releases{/id}","deployments_url":"https://api.github.com/repos/hjr3/smoltcp/deployments","created_at":"2017-12-24T06:31:12Z","updated_at":"2017-12-24T06:31:14Z","pushed_at":"2018-01-31T15:46:22Z","git_url":"git://github.com/hjr3/smoltcp.git","ssh_url":"git@github.com:hjr3/smoltcp.git","clone_url":"https://github.com/hjr3/smoltcp.git","svn_url":"https://github.com/hjr3/smoltcp","homepage":null,"size":1010,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"m-labs:master","ref":"master","sha":"0f20acf96723143178236564bb4c7f69284f6284","user":{"login":"m-labs","id":116047,"avatar_url":"https://avatars3.githubusercontent.com/u/116047?v=4","gravatar_id":"","url":"https://api.github.com/users/m-labs","html_url":"https://github.com/m-labs","followers_url":"https://api.github.com/users/m-labs/followers","following_url":"https://api.github.com/users/m-labs/following{/other_user}","gists_url":"https://api.github.com/users/m-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/m-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-labs/subscriptions","organizations_url":"https://api.github.com/users/m-labs/orgs","repos_url":"https://api.github.com/users/m-labs/repos","events_url":"https://api.github.com/users/m-labs/events{/privacy}","received_events_url":"https://api.github.com/users/m-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":75406961,"name":"smoltcp","full_name":"m-labs/smoltcp","owner":{"login":"m-labs","id":116047,"avatar_url":"https://avatars3.githubusercontent.com/u/116047?v=4","gravatar_id":"","url":"https://api.github.com/users/m-labs","html_url":"https://github.com/m-labs","followers_url":"https://api.github.com/users/m-labs/followers","following_url":"https://api.github.com/users/m-labs/following{/other_user}","gists_url":"https://api.github.com/users/m-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/m-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-labs/subscriptions","organizations_url":"https://api.github.com/users/m-labs/orgs","repos_url":"https://api.github.com/users/m-labs/repos","events_url":"https://api.github.com/users/m-labs/events{/privacy}","received_events_url":"https://api.github.com/users/m-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m-labs/smoltcp","description":"a smol tcp/ip stack","fork":false,"url":"https://api.github.com/repos/m-labs/smoltcp","forks_url":"https://api.github.com/repos/m-labs/smoltcp/forks","keys_url":"https://api.github.com/repos/m-labs/smoltcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m-labs/smoltcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m-labs/smoltcp/teams","hooks_url":"https://api.github.com/repos/m-labs/smoltcp/hooks","issue_events_url":"https://api.github.com/repos/m-labs/smoltcp/issues/events{/number}","events_url":"https://api.github.com/repos/m-labs/smoltcp/events","assignees_url":"https://api.github.com/repos/m-labs/smoltcp/assignees{/user}","branches_url":"https://api.github.com/repos/m-labs/smoltcp/branches{/branch}","tags_url":"https://api.github.com/repos/m-labs/smoltcp/tags","blobs_url":"https://api.github.com/repos/m-labs/smoltcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m-labs/smoltcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m-labs/smoltcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/m-labs/smoltcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m-labs/smoltcp/statuses/{sha}","languages_url":"https://api.github.com/repos/m-labs/smoltcp/languages","stargazers_url":"https://api.github.com/repos/m-labs/smoltcp/stargazers","contributors_url":"https://api.github.com/repos/m-labs/smoltcp/contributors","subscribers_url":"https://api.github.com/repos/m-labs/smoltcp/subscribers","subscription_url":"https://api.github.com/repos/m-labs/smoltcp/subscription","commits_url":"https://api.github.com/repos/m-labs/smoltcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/m-labs/smoltcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/m-labs/smoltcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/m-labs/smoltcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/m-labs/smoltcp/contents/{+path}","compare_url":"https://api.github.com/repos/m-labs/smoltcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m-labs/smoltcp/merges","archive_url":"https://api.github.com/repos/m-labs/smoltcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m-labs/smoltcp/downloads","issues_url":"https://api.github.com/repos/m-labs/smoltcp/issues{/number}","pulls_url":"https://api.github.com/repos/m-labs/smoltcp/pulls{/number}","milestones_url":"https://api.github.com/repos/m-labs/smoltcp/milestones{/number}","notifications_url":"https://api.github.com/repos/m-labs/smoltcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m-labs/smoltcp/labels{/name}","releases_url":"https://api.github.com/repos/m-labs/smoltcp/releases{/id}","deployments_url":"https://api.github.com/repos/m-labs/smoltcp/deployments","created_at":"2016-12-02T15:21:02Z","updated_at":"2018-01-28T00:28:38Z","pushed_at":"2018-02-01T01:16:12Z","git_url":"git://github.com/m-labs/smoltcp.git","ssh_url":"git@github.com:m-labs/smoltcp.git","clone_url":"https://github.com/m-labs/smoltcp.git","svn_url":"https://github.com/m-labs/smoltcp","homepage":null,"size":997,"stargazers_count":393,"watchers_count":393,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":32,"mirror_url":null,"archived":false,"open_issues_count":32,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":32,"open_issues":32,"watchers":393,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/139"},"html":{"href":"https://github.com/m-labs/smoltcp/pull/139"},"issue":{"href":"https://api.github.com/repos/m-labs/smoltcp/issues/139"},"comments":{"href":"https://api.github.com/repos/m-labs/smoltcp/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m-labs/smoltcp/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/m-labs/smoltcp/statuses/2dbdeb4976dab1c7948a1f93275eafbeb5fa0a87"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dlrobertson"}}