{"action":"created","comment":{"url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/comments/39260738","id":39260738,"diff_hunk":"@@ -0,0 +1,353 @@\n+/**\n+ * @file snmp_infinite_timer_count_table.cpp\n+ *\n+ * Project Clearwater - IMS in the Cloud\n+ * Copyright (C) 2015 Metaswitch Networks Ltd\n+ *\n+ * This program is free software: you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License as published by the\n+ * Free Software Foundation, either version 3 of the License, or (at your\n+ * option) any later version, along with the \"Special Exception\" for use of\n+ * the program along with SSL, set forth below. This program is distributed\n+ * in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more\n+ * details. You should have received a copy of the GNU General Public\n+ * License along with this program.  If not, see\n+ * <http://www.gnu.org/licenses/>.\n+ *\n+ * The author can be reached by email at clearwater@metaswitch.com or by\n+ * post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK\n+ *\n+ * Special Exception\n+ * Metaswitch Networks Ltd  grants you permission to copy, modify,\n+ * propagate, and distribute a work formed by combining OpenSSL with The\n+ * Software, or a work derivative of such a combination, even if such\n+ * copying, modification, propagation, or distribution would otherwise\n+ * violate the terms of the GPL. You must comply with the GPL in all\n+ * respects for all of the code used other than OpenSSL.\n+ * \"OpenSSL\" means OpenSSL toolkit software distributed by the OpenSSL\n+ * Project and licensed under the OpenSSL Licenses, or a work based on such\n+ * software and licensed under the OpenSSL Licenses.\n+ * \"OpenSSL Licenses\" means the OpenSSL License and Original SSLeay License\n+ * under which the OpenSSL Project distributes the OpenSSL toolkit software,\n+ * as those licenses appear in the file LICENSE-OPENSSL.\n+ */\n+\n+#include <string>\n+\n+#include \"snmp_statistics_structures.h\"\n+#include \"snmp_infinite_timer_count_table.h\"\n+#include \"timer_counter.h\"\n+#include \"snmp_internal/snmp_includes.h\"\n+#include \"snmp_row.h\"\n+\n+#include \"log.h\"\n+#include \"logger.h\"\n+\n+namespace SNMP\n+{\n+\n+  class InfiniteTimerCountTableImpl : public InfiniteTimerCountTable\n+  {\n+  public:\n+    InfiniteTimerCountTableImpl(std::string name, // Name of this table, for logging\n+                                std::string tbl_oid):  // Root OID of this table\n+      _name(name),\n+      _oidlen(64),\n+      _handler_reg(NULL)\n+    {\n+      read_objid(tbl_oid.c_str(), _tbl_oid, &_oidlen);\n+\n+\n+      TRC_INFO(\"Registering SNMP table %s\", _name.c_str());\n+      _handler_reg = netsnmp_create_handler_registration(_name.c_str(),\n+                                                         InfiniteTimerCountTableImpl::static_netsnmp_table_handler_fn,\n+                                                         _tbl_oid,\n+                                                         _oidlen,\n+                                                         HANDLER_CAN_RONLY | HANDLER_CAN_GETBULK);\n+      _handler_reg->handler->myvoid = this;\n+\n+      netsnmp_register_handler(_handler_reg);\n+    }\n+\n+    virtual ~InfiniteTimerCountTableImpl()\n+    {\n+      if (_handler_reg)\n+      {\n+        netsnmp_unregister_handler(_handler_reg);\n+      }\n+    }\n+\n+    /********************************/","path":"src/snmp_infinite_timer_count_table.cpp","position":82,"original_position":82,"commit_id":"8bfbde3e73d1b8bf062f6ebf7094a320180de64f","original_commit_id":"8bfbde3e73d1b8bf062f6ebf7094a320180de64f","user":{"login":"rkd-msw","id":4363492,"avatar_url":"https://avatars.githubusercontent.com/u/4363492?v=3","gravatar_id":"","url":"https://api.github.com/users/rkd-msw","html_url":"https://github.com/rkd-msw","followers_url":"https://api.github.com/users/rkd-msw/followers","following_url":"https://api.github.com/users/rkd-msw/following{/other_user}","gists_url":"https://api.github.com/users/rkd-msw/gists{/gist_id}","starred_url":"https://api.github.com/users/rkd-msw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkd-msw/subscriptions","organizations_url":"https://api.github.com/users/rkd-msw/orgs","repos_url":"https://api.github.com/users/rkd-msw/repos","events_url":"https://api.github.com/users/rkd-msw/events{/privacy}","received_events_url":"https://api.github.com/users/rkd-msw/received_events","type":"User","site_admin":false},"body":"Not our usual comment style - it would be `// Methods for TimerHandler` - but I don't think there's anything TimerHandler-specific here.","created_at":"2015-09-11T10:55:05Z","updated_at":"2015-09-11T10:55:05Z","html_url":"https://github.com/Metaswitch/cpp-common/pull/377#discussion_r39260738","pull_request_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377","_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/comments/39260738"},"html":{"href":"https://github.com/Metaswitch/cpp-common/pull/377#discussion_r39260738"},"pull_request":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377"}}},"pull_request":{"url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377","id":44767027,"html_url":"https://github.com/Metaswitch/cpp-common/pull/377","diff_url":"https://github.com/Metaswitch/cpp-common/pull/377.diff","patch_url":"https://github.com/Metaswitch/cpp-common/pull/377.patch","issue_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/377","number":377,"state":"open","locked":false,"title":"[Reviewer: Rob] Adding infinite SNMP table","user":{"login":"TygerBurning","id":6792948,"avatar_url":"https://avatars.githubusercontent.com/u/6792948?v=3","gravatar_id":"","url":"https://api.github.com/users/TygerBurning","html_url":"https://github.com/TygerBurning","followers_url":"https://api.github.com/users/TygerBurning/followers","following_url":"https://api.github.com/users/TygerBurning/following{/other_user}","gists_url":"https://api.github.com/users/TygerBurning/gists{/gist_id}","starred_url":"https://api.github.com/users/TygerBurning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TygerBurning/subscriptions","organizations_url":"https://api.github.com/users/TygerBurning/orgs","repos_url":"https://api.github.com/users/TygerBurning/repos","events_url":"https://api.github.com/users/TygerBurning/events{/privacy}","received_events_url":"https://api.github.com/users/TygerBurning/received_events","type":"User","site_admin":false},"body":"Includes refactoring CurrentAndPrevious class, introduction of registration handler to handle requests, and the object \"TimerCounter\" which manages the 12 row subsets we use in Chronos' infinite table.","created_at":"2015-09-11T10:21:30Z","updated_at":"2015-09-11T10:55:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d05b3421be9f3581c7ab2114e39fe3c49c59515","assignee":{"login":"rkd-msw","id":4363492,"avatar_url":"https://avatars.githubusercontent.com/u/4363492?v=3","gravatar_id":"","url":"https://api.github.com/users/rkd-msw","html_url":"https://github.com/rkd-msw","followers_url":"https://api.github.com/users/rkd-msw/followers","following_url":"https://api.github.com/users/rkd-msw/following{/other_user}","gists_url":"https://api.github.com/users/rkd-msw/gists{/gist_id}","starred_url":"https://api.github.com/users/rkd-msw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkd-msw/subscriptions","organizations_url":"https://api.github.com/users/rkd-msw/orgs","repos_url":"https://api.github.com/users/rkd-msw/repos","events_url":"https://api.github.com/users/rkd-msw/events{/privacy}","received_events_url":"https://api.github.com/users/rkd-msw/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377/commits","review_comments_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377/comments","review_comment_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/377/comments","statuses_url":"https://api.github.com/repos/Metaswitch/cpp-common/statuses/8bfbde3e73d1b8bf062f6ebf7094a320180de64f","head":{"label":"Metaswitch:sto1474","ref":"sto1474","sha":"8bfbde3e73d1b8bf062f6ebf7094a320180de64f","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":15284898,"name":"cpp-common","full_name":"Metaswitch/cpp-common","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/cpp-common","description":"Common C/C++ modules for Clearwater components","fork":false,"url":"https://api.github.com/repos/Metaswitch/cpp-common","forks_url":"https://api.github.com/repos/Metaswitch/cpp-common/forks","keys_url":"https://api.github.com/repos/Metaswitch/cpp-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/cpp-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/cpp-common/teams","hooks_url":"https://api.github.com/repos/Metaswitch/cpp-common/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/cpp-common/events","assignees_url":"https://api.github.com/repos/Metaswitch/cpp-common/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/cpp-common/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/cpp-common/tags","blobs_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/cpp-common/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/cpp-common/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/cpp-common/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/cpp-common/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/cpp-common/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/cpp-common/subscription","commits_url":"https://api.github.com/repos/Metaswitch/cpp-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/cpp-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/cpp-common/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/cpp-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/cpp-common/merges","archive_url":"https://api.github.com/repos/Metaswitch/cpp-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/cpp-common/downloads","issues_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/cpp-common/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/cpp-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/cpp-common/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/cpp-common/releases{/id}","created_at":"2013-12-18T14:11:57Z","updated_at":"2015-08-31T09:54:09Z","pushed_at":"2015-09-11T10:24:12Z","git_url":"git://github.com/Metaswitch/cpp-common.git","ssh_url":"git@github.com:Metaswitch/cpp-common.git","clone_url":"https://github.com/Metaswitch/cpp-common.git","svn_url":"https://github.com/Metaswitch/cpp-common","homepage":null,"size":4349,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":14,"forks":5,"open_issues":14,"watchers":1,"default_branch":"master"}},"base":{"label":"Metaswitch:master","ref":"master","sha":"2a8d4e79d1e3e1195bbcd56675337613886978e2","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":15284898,"name":"cpp-common","full_name":"Metaswitch/cpp-common","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/cpp-common","description":"Common C/C++ modules for Clearwater components","fork":false,"url":"https://api.github.com/repos/Metaswitch/cpp-common","forks_url":"https://api.github.com/repos/Metaswitch/cpp-common/forks","keys_url":"https://api.github.com/repos/Metaswitch/cpp-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/cpp-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/cpp-common/teams","hooks_url":"https://api.github.com/repos/Metaswitch/cpp-common/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/cpp-common/events","assignees_url":"https://api.github.com/repos/Metaswitch/cpp-common/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/cpp-common/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/cpp-common/tags","blobs_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/cpp-common/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/cpp-common/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/cpp-common/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/cpp-common/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/cpp-common/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/cpp-common/subscription","commits_url":"https://api.github.com/repos/Metaswitch/cpp-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/cpp-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/cpp-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/cpp-common/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/cpp-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/cpp-common/merges","archive_url":"https://api.github.com/repos/Metaswitch/cpp-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/cpp-common/downloads","issues_url":"https://api.github.com/repos/Metaswitch/cpp-common/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/cpp-common/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/cpp-common/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/cpp-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/cpp-common/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/cpp-common/releases{/id}","created_at":"2013-12-18T14:11:57Z","updated_at":"2015-08-31T09:54:09Z","pushed_at":"2015-09-11T10:24:12Z","git_url":"git://github.com/Metaswitch/cpp-common.git","ssh_url":"git@github.com:Metaswitch/cpp-common.git","clone_url":"https://github.com/Metaswitch/cpp-common.git","svn_url":"https://github.com/Metaswitch/cpp-common","homepage":null,"size":4349,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":14,"forks":5,"open_issues":14,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377"},"html":{"href":"https://github.com/Metaswitch/cpp-common/pull/377"},"issue":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/issues/377"},"comments":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/issues/377/comments"},"review_comments":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377/comments"},"review_comment":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/pulls/377/commits"},"statuses":{"href":"https://api.github.com/repos/Metaswitch/cpp-common/statuses/8bfbde3e73d1b8bf062f6ebf7094a320180de64f"}}}}