{"action":"created","comment":{"url":"https://api.github.com/repos/torproject/tor/pulls/comments/231703613","pull_request_review_id":172724269,"id":231703613,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTcwMzYxMw==","diff_hunk":"@@ -0,0 +1,539 @@\n+/*\n+ * Copyright (c) 2017, The Tor Project, Inc. */\n+/* See LICENSE for licensing information */\n+\n+/**\n+ * \\file circuitpadding.h\n+ * \\brief Header file for circuitpadding.c.\n+ **/\n+#ifndef TOR_CIRCUITPADDING_H\n+#define TOR_CIRCUITPADDING_H\n+\n+#include \"circpad_negotiation.h\"\n+#include \"lib/evloop/timers.h\"\n+\n+typedef struct circuit_t circuit_t;\n+typedef struct origin_circuit_t origin_circuit_t;\n+typedef struct cell_t cell_t;\n+\n+/**\n+ * Circpad state specifier.\n+ *\n+ * Each circuit has up to two state machines, and each state\n+ * machine consists of these states. Machines transition between\n+ * these states using the event transition specifiers below.\n+ */\n+typedef enum {\n+  CIRCPAD_STATE_START = 0,\n+  CIRCPAD_STATE_BURST = 1,\n+  CIRCPAD_STATE_GAP = 2,\n+  CIRCPAD_STATE_END = 3\n+} circpad_statenum_t;\n+#define CIRCPAD_NUM_STATES  ((uint8_t)CIRCPAD_STATE_END+1)\n+\n+/**\n+ * These constants form a bitfield to specify the types of events\n+ * that can cause transitions between state machine states.\n+ *\n+ * Note that SENT and RECV are relative to this endpoint. For\n+ * relays, SENT means packets destined towards the client and\n+ * RECV means packets destined towards the relay. On the client,\n+ * SENT means packets destined towards the relay, where as RECV\n+ * means packets destined towards the client.\n+ */\n+typedef enum {\n+  CIRCPAD_EVENT_NONPADDING_RECV = 1<<0,\n+  CIRCPAD_EVENT_NONPADDING_SENT = 1<<1,\n+  CIRCPAD_EVENT_PADDING_SENT = 1<<2,\n+  CIRCPAD_EVENT_PADDING_RECV = 1<<3,\n+  CIRCPAD_EVENT_INFINITY = 1<<4,\n+  CIRCPAD_EVENT_BINS_EMPTY = 1<<5,\n+  CIRCPAD_EVENT_LENGTH_COUNT = 1<<6\n+} circpad_event_t;\n+\n+/** Boolean type that says if we decided to transition states or not */\n+typedef enum {\n+  CIRCPAD_STATE_UNCHANGED = 0,\n+  CIRCPAD_STATE_CHANGED = 1\n+} circpad_decision_t;\n+\n+/** The type for histogram bins */\n+typedef uint16_t circpad_hist_bin_t;\n+\n+/** The type for absolute time, from monotime_absolute_usec() */\n+typedef uint64_t circpad_time_t;\n+\n+/** The type for timer delays, in microseconds */\n+typedef uint32_t circpad_delay_t;\n+\n+/**\n+ * An infinite padding cell delay means don't schedule any padding --\n+ * simply wait until a different event triggers a transition.\n+ *\n+ * This means that the maximum delay we can scedule is UINT32_MAX-1\n+ * microseconds, or about 4300 seconds (1.25 hours).\n+ * XXX: Is this enough if we want to simulate light, intermittent\n+ * activity on an onion service?\n+ */\n+#define CIRCPAD_DELAY_INFINITE  (UINT32_MAX)\n+\n+/**\n+ * These constants form a bitfield that specifies when a state machine\n+ * should be applied to a circuit.\n+ *\n+ * The helper function circpad_circuit_state() converts circuit state\n+ * flags into this more compact representation.\n+ */\n+typedef enum {\n+  CIRCPAD_CIRC_BUILDING = 1<<0,\n+  CIRCPAD_CIRC_OPENED = 1<<1,\n+  CIRCPAD_CIRC_NO_STREAMS = 1<<2,\n+  CIRCPAD_CIRC_STREAMS = 1<<3,\n+  CIRCPAD_CIRC_HAS_RELAY_EARLY = 1<<4,\n+  CIRCPAD_CIRC_HAS_NO_RELAY_EARLY = 1<<5\n+} circpad_circuit_state_t;\n+\n+/** Bitmask that says \"apply this machine to all states\" */\n+#define CIRCPAD_STATE_ALL   \\\n+    (CIRCPAD_CIRC_BUILDING|CIRCPAD_CIRC_OPENED| \\\n+     CIRCPAD_CIRC_STREAMS|CIRCPAD_CIRC_NO_STREAMS| \\\n+     CIRCPAD_CIRC_HAS_RELAY_EARLY|CIRCPAD_CIRC_HAS_NO_RELAY_EARLY)\n+\n+/**\n+ * A compact circuit purpose bitfield mask that allows us to compactly\n+ * specify which circuit purposes a machine should apply to.\n+ *\n+ * The helper function circpad_circ_purpose_to_mask() converts circuit\n+ * purposes into bit positions in this bitmask.\n+ */\n+typedef uint32_t circpad_purpose_mask_t;\n+\n+/** Bitmask that says \"apply this machine to all purposes\". */\n+#define CIRCPAD_PURPOSE_ALL (0xFFFFFFFF)\n+\n+/**\n+ * This type specifies all of the conditions that must be met before\n+ * a client decides to initiate padding on a circuit.\n+ *\n+ * A circuit must satisfy every sub-field in this type in order\n+ * to be considered to match the conditions.\n+ */\n+typedef struct circpad_machine_conditions_t {\n+  /** Only apply the machine *if* the circuit has at least this many hops */","path":"src/core/or/circuitpadding.h","position":129,"original_position":122,"commit_id":"d585ebdbb8da4f5543fb4c5f984acd3aba3c6846","original_commit_id":"94b76e85d48d6483ae9b28947177b3be0aff2b6a","user":{"login":"nmathewson","id":162054,"node_id":"MDQ6VXNlcjE2MjA1NA==","avatar_url":"https://avatars1.githubusercontent.com/u/162054?v=4","gravatar_id":"","url":"https://api.github.com/users/nmathewson","html_url":"https://github.com/nmathewson","followers_url":"https://api.github.com/users/nmathewson/followers","following_url":"https://api.github.com/users/nmathewson/following{/other_user}","gists_url":"https://api.github.com/users/nmathewson/gists{/gist_id}","starred_url":"https://api.github.com/users/nmathewson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmathewson/subscriptions","organizations_url":"https://api.github.com/users/nmathewson/orgs","repos_url":"https://api.github.com/users/nmathewson/repos","events_url":"https://api.github.com/users/nmathewson/events{/privacy}","received_events_url":"https://api.github.com/users/nmathewson/received_events","type":"User","site_admin":false},"body":"Can we use a full uint8_t here? If not, let's make it \"unsigned\".","created_at":"2018-11-07T22:31:49Z","updated_at":"2018-11-07T22:41:52Z","html_url":"https://github.com/torproject/tor/pull/461#discussion_r231703613","pull_request_url":"https://api.github.com/repos/torproject/tor/pulls/461","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/torproject/tor/pulls/comments/231703613"},"html":{"href":"https://github.com/torproject/tor/pull/461#discussion_r231703613"},"pull_request":{"href":"https://api.github.com/repos/torproject/tor/pulls/461"}}},"pull_request":{"url":"https://api.github.com/repos/torproject/tor/pulls/461","id":227129353,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MTI5MzUz","html_url":"https://github.com/torproject/tor/pull/461","diff_url":"https://github.com/torproject/tor/pull/461.diff","patch_url":"https://github.com/torproject/tor/pull/461.patch","issue_url":"https://api.github.com/repos/torproject/tor/issues/461","number":461,"state":"open","locked":false,"title":"Adaptive padding rebased 0.3.6 squashed","user":{"login":"mikeperry-tor","id":7707841,"node_id":"MDQ6VXNlcjc3MDc4NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/7707841?v=4","gravatar_id":"","url":"https://api.github.com/users/mikeperry-tor","html_url":"https://github.com/mikeperry-tor","followers_url":"https://api.github.com/users/mikeperry-tor/followers","following_url":"https://api.github.com/users/mikeperry-tor/following{/other_user}","gists_url":"https://api.github.com/users/mikeperry-tor/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeperry-tor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeperry-tor/subscriptions","organizations_url":"https://api.github.com/users/mikeperry-tor/orgs","repos_url":"https://api.github.com/users/mikeperry-tor/repos","events_url":"https://api.github.com/users/mikeperry-tor/events{/privacy}","received_events_url":"https://api.github.com/users/mikeperry-tor/received_events","type":"User","site_admin":false},"body":"Strong recommend to review in git commit order (which is different than github's weirdly sorted order below).","created_at":"2018-10-31T01:12:55Z","updated_at":"2018-11-07T22:41:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"699215705e170b4a6f2f431e3149dcc477d16d11","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/torproject/tor/pulls/461/commits","review_comments_url":"https://api.github.com/repos/torproject/tor/pulls/461/comments","review_comment_url":"https://api.github.com/repos/torproject/tor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/torproject/tor/issues/461/comments","statuses_url":"https://api.github.com/repos/torproject/tor/statuses/d585ebdbb8da4f5543fb4c5f984acd3aba3c6846","head":{"label":"mikeperry-tor:adaptive_padding-rebased_0.3.6-squashed","ref":"adaptive_padding-rebased_0.3.6-squashed","sha":"d585ebdbb8da4f5543fb4c5f984acd3aba3c6846","user":{"login":"mikeperry-tor","id":7707841,"node_id":"MDQ6VXNlcjc3MDc4NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/7707841?v=4","gravatar_id":"","url":"https://api.github.com/users/mikeperry-tor","html_url":"https://github.com/mikeperry-tor","followers_url":"https://api.github.com/users/mikeperry-tor/followers","following_url":"https://api.github.com/users/mikeperry-tor/following{/other_user}","gists_url":"https://api.github.com/users/mikeperry-tor/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeperry-tor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeperry-tor/subscriptions","organizations_url":"https://api.github.com/users/mikeperry-tor/orgs","repos_url":"https://api.github.com/users/mikeperry-tor/repos","events_url":"https://api.github.com/users/mikeperry-tor/events{/privacy}","received_events_url":"https://api.github.com/users/mikeperry-tor/received_events","type":"User","site_admin":false},"repo":{"id":131752316,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE3NTIzMTY=","name":"tor","full_name":"mikeperry-tor/tor","private":false,"owner":{"login":"mikeperry-tor","id":7707841,"node_id":"MDQ6VXNlcjc3MDc4NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/7707841?v=4","gravatar_id":"","url":"https://api.github.com/users/mikeperry-tor","html_url":"https://github.com/mikeperry-tor","followers_url":"https://api.github.com/users/mikeperry-tor/followers","following_url":"https://api.github.com/users/mikeperry-tor/following{/other_user}","gists_url":"https://api.github.com/users/mikeperry-tor/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeperry-tor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeperry-tor/subscriptions","organizations_url":"https://api.github.com/users/mikeperry-tor/orgs","repos_url":"https://api.github.com/users/mikeperry-tor/repos","events_url":"https://api.github.com/users/mikeperry-tor/events{/privacy}","received_events_url":"https://api.github.com/users/mikeperry-tor/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mikeperry-tor/tor","description":"unofficial git repo -- report bugs/issues/pull requests on https://trac.torproject.org/ --","fork":true,"url":"https://api.github.com/repos/mikeperry-tor/tor","forks_url":"https://api.github.com/repos/mikeperry-tor/tor/forks","keys_url":"https://api.github.com/repos/mikeperry-tor/tor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikeperry-tor/tor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikeperry-tor/tor/teams","hooks_url":"https://api.github.com/repos/mikeperry-tor/tor/hooks","issue_events_url":"https://api.github.com/repos/mikeperry-tor/tor/issues/events{/number}","events_url":"https://api.github.com/repos/mikeperry-tor/tor/events","assignees_url":"https://api.github.com/repos/mikeperry-tor/tor/assignees{/user}","branches_url":"https://api.github.com/repos/mikeperry-tor/tor/branches{/branch}","tags_url":"https://api.github.com/repos/mikeperry-tor/tor/tags","blobs_url":"https://api.github.com/repos/mikeperry-tor/tor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikeperry-tor/tor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikeperry-tor/tor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikeperry-tor/tor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikeperry-tor/tor/statuses/{sha}","languages_url":"https://api.github.com/repos/mikeperry-tor/tor/languages","stargazers_url":"https://api.github.com/repos/mikeperry-tor/tor/stargazers","contributors_url":"https://api.github.com/repos/mikeperry-tor/tor/contributors","subscribers_url":"https://api.github.com/repos/mikeperry-tor/tor/subscribers","subscription_url":"https://api.github.com/repos/mikeperry-tor/tor/subscription","commits_url":"https://api.github.com/repos/mikeperry-tor/tor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikeperry-tor/tor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikeperry-tor/tor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikeperry-tor/tor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikeperry-tor/tor/contents/{+path}","compare_url":"https://api.github.com/repos/mikeperry-tor/tor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikeperry-tor/tor/merges","archive_url":"https://api.github.com/repos/mikeperry-tor/tor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikeperry-tor/tor/downloads","issues_url":"https://api.github.com/repos/mikeperry-tor/tor/issues{/number}","pulls_url":"https://api.github.com/repos/mikeperry-tor/tor/pulls{/number}","milestones_url":"https://api.github.com/repos/mikeperry-tor/tor/milestones{/number}","notifications_url":"https://api.github.com/repos/mikeperry-tor/tor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikeperry-tor/tor/labels{/name}","releases_url":"https://api.github.com/repos/mikeperry-tor/tor/releases{/id}","deployments_url":"https://api.github.com/repos/mikeperry-tor/tor/deployments","created_at":"2018-05-01T19:08:02Z","updated_at":"2018-05-01T19:08:09Z","pushed_at":"2018-11-06T01:02:16Z","git_url":"git://github.com/mikeperry-tor/tor.git","ssh_url":"git@github.com:mikeperry-tor/tor.git","clone_url":"https://github.com/mikeperry-tor/tor.git","svn_url":"https://github.com/mikeperry-tor/tor","homepage":"https://gitweb.torproject.org/tor.git","size":114668,"stargazers_count":0,"watchers_count":0,"language":"C","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":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"torproject:master","ref":"master","sha":"aa1ae1343a2e57dc5a7bcd045566a10175acdd10","user":{"login":"torproject","id":4099049,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTkwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/4099049?v=4","gravatar_id":"","url":"https://api.github.com/users/torproject","html_url":"https://github.com/torproject","followers_url":"https://api.github.com/users/torproject/followers","following_url":"https://api.github.com/users/torproject/following{/other_user}","gists_url":"https://api.github.com/users/torproject/gists{/gist_id}","starred_url":"https://api.github.com/users/torproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torproject/subscriptions","organizations_url":"https://api.github.com/users/torproject/orgs","repos_url":"https://api.github.com/users/torproject/repos","events_url":"https://api.github.com/users/torproject/events{/privacy}","received_events_url":"https://api.github.com/users/torproject/received_events","type":"Organization","site_admin":false},"repo":{"id":10513590,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUxMzU5MA==","name":"tor","full_name":"torproject/tor","private":false,"owner":{"login":"torproject","id":4099049,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTkwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/4099049?v=4","gravatar_id":"","url":"https://api.github.com/users/torproject","html_url":"https://github.com/torproject","followers_url":"https://api.github.com/users/torproject/followers","following_url":"https://api.github.com/users/torproject/following{/other_user}","gists_url":"https://api.github.com/users/torproject/gists{/gist_id}","starred_url":"https://api.github.com/users/torproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torproject/subscriptions","organizations_url":"https://api.github.com/users/torproject/orgs","repos_url":"https://api.github.com/users/torproject/repos","events_url":"https://api.github.com/users/torproject/events{/privacy}","received_events_url":"https://api.github.com/users/torproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/torproject/tor","description":"unofficial git repo -- report bugs/issues/pull requests on https://trac.torproject.org/ --","fork":false,"url":"https://api.github.com/repos/torproject/tor","forks_url":"https://api.github.com/repos/torproject/tor/forks","keys_url":"https://api.github.com/repos/torproject/tor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/torproject/tor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/torproject/tor/teams","hooks_url":"https://api.github.com/repos/torproject/tor/hooks","issue_events_url":"https://api.github.com/repos/torproject/tor/issues/events{/number}","events_url":"https://api.github.com/repos/torproject/tor/events","assignees_url":"https://api.github.com/repos/torproject/tor/assignees{/user}","branches_url":"https://api.github.com/repos/torproject/tor/branches{/branch}","tags_url":"https://api.github.com/repos/torproject/tor/tags","blobs_url":"https://api.github.com/repos/torproject/tor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/torproject/tor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/torproject/tor/git/refs{/sha}","trees_url":"https://api.github.com/repos/torproject/tor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/torproject/tor/statuses/{sha}","languages_url":"https://api.github.com/repos/torproject/tor/languages","stargazers_url":"https://api.github.com/repos/torproject/tor/stargazers","contributors_url":"https://api.github.com/repos/torproject/tor/contributors","subscribers_url":"https://api.github.com/repos/torproject/tor/subscribers","subscription_url":"https://api.github.com/repos/torproject/tor/subscription","commits_url":"https://api.github.com/repos/torproject/tor/commits{/sha}","git_commits_url":"https://api.github.com/repos/torproject/tor/git/commits{/sha}","comments_url":"https://api.github.com/repos/torproject/tor/comments{/number}","issue_comment_url":"https://api.github.com/repos/torproject/tor/issues/comments{/number}","contents_url":"https://api.github.com/repos/torproject/tor/contents/{+path}","compare_url":"https://api.github.com/repos/torproject/tor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/torproject/tor/merges","archive_url":"https://api.github.com/repos/torproject/tor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/torproject/tor/downloads","issues_url":"https://api.github.com/repos/torproject/tor/issues{/number}","pulls_url":"https://api.github.com/repos/torproject/tor/pulls{/number}","milestones_url":"https://api.github.com/repos/torproject/tor/milestones{/number}","notifications_url":"https://api.github.com/repos/torproject/tor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/torproject/tor/labels{/name}","releases_url":"https://api.github.com/repos/torproject/tor/releases{/id}","deployments_url":"https://api.github.com/repos/torproject/tor/deployments","created_at":"2013-06-05T21:50:25Z","updated_at":"2018-11-07T21:28:49Z","pushed_at":"2018-11-07T21:28:36Z","git_url":"git://github.com/torproject/tor.git","ssh_url":"git@github.com:torproject/tor.git","clone_url":"https://github.com/torproject/tor.git","svn_url":"https://github.com/torproject/tor","homepage":"https://gitweb.torproject.org/tor.git","size":119939,"stargazers_count":842,"watchers_count":842,"language":"C","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":337,"mirror_url":null,"archived":false,"open_issues_count":72,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":337,"open_issues":72,"watchers":842,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/torproject/tor/pulls/461"},"html":{"href":"https://github.com/torproject/tor/pull/461"},"issue":{"href":"https://api.github.com/repos/torproject/tor/issues/461"},"comments":{"href":"https://api.github.com/repos/torproject/tor/issues/461/comments"},"review_comments":{"href":"https://api.github.com/repos/torproject/tor/pulls/461/comments"},"review_comment":{"href":"https://api.github.com/repos/torproject/tor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/torproject/tor/pulls/461/commits"},"statuses":{"href":"https://api.github.com/repos/torproject/tor/statuses/d585ebdbb8da4f5543fb4c5f984acd3aba3c6846"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nmathewson"}}