{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rmw/pulls/comments/108749026","pull_request_review_id":29801319,"id":108749026,"diff_hunk":"@@ -0,0 +1,95 @@\n+// Copyright 2017 Open Source Robotics Foundation, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#ifndef RMW__VALIDATE_NODE_NAME_H_\n+#define RMW__VALIDATE_NODE_NAME_H_\n+\n+#if __cplusplus\n+extern \"C\"\n+{\n+#endif\n+\n+#include \"rmw/macros.h\"\n+#include \"rmw/types.h\"\n+\n+#define RMW_NODE_NAME_VALID 0\n+#define RMW_NODE_NAME_INVALID_IS_EMPTY_STRING 1\n+#define RMW_NODE_NAME_INVALID_CONTAINS_UNALLOWED_CHARACTERS 2\n+#define RMW_NODE_NAME_INVALID_STARTS_WITH_NUMBER 3\n+#define RMW_NODE_NAME_INVALID_TOO_LONG 4\n+\n+#define RMW_NODE_NAME_MAX_NAME_LENGTH 255 /* arbitrary constraint */\n+\n+/// Determine if a node name is valid.\n+/**\n+ * Node names must follow these rules:\n+ *\n+ * - must not be an empty string\n+ * - must only contain alphanumeric characters and underscores (a-z|A-Z|0-9|_)\n+ * - must not start with an number\n+ *\n+ * If either the node name C string or validation_result pointer are null, then\n+ * `RMW_RET_INVALID_ARGUMENT` will be returned.\n+ * The node_name should be a valid, null-terminated C string.\n+ * The validation_result int pointer should point to valid memory so a result\n+ * can be stored in it as an output variable.","path":"rmw/include/rmw/validate_node_name.h","position":46,"original_position":46,"commit_id":"3982076fa8658b68e0d6e4a53903d7efda132d50","original_commit_id":"3982076fa8658b68e0d6e4a53903d7efda132d50","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars2.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"@karsten1987 and I already discussed this in #93, but I explicitly did it this way to not mix the validation codes for the node name or topic name with the new return codes.  I do not want to change how it is currently organized for that reason. ","created_at":"2017-03-29T18:16:26Z","updated_at":"2017-03-29T18:16:26Z","html_url":"https://github.com/ros2/rmw/pull/93#discussion_r108749026","pull_request_url":"https://api.github.com/repos/ros2/rmw/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/ros2/rmw/pulls/comments/108749026"},"html":{"href":"https://github.com/ros2/rmw/pull/93#discussion_r108749026"},"pull_request":{"href":"https://api.github.com/repos/ros2/rmw/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/rmw/pulls/93","id":113094486,"html_url":"https://github.com/ros2/rmw/pull/93","diff_url":"https://github.com/ros2/rmw/pull/93.diff","patch_url":"https://github.com/ros2/rmw/pull/93.patch","issue_url":"https://api.github.com/repos/ros2/rmw/issues/93","number":93,"state":"open","locked":false,"title":"add rmw_validate_node_name()","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars2.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"This is a precursor to the larger set of namespace pull requests. This one was small and reviewable as-is, so I'm submitting it separately.\r\n\r\nThe documentation for this new function also takes the opportunity to layout some rules for node names, which we've sort of had in mind informally until now.\r\n\r\nThis new function can be used by `rcl*` to check if a node name follows the rules for node names, or by `rmw_*` packages to assert that the node name it is given is valid (should always be the case, but it might be worth checking incase something other than `rcl` uses `rmw` directly).\r\n\r\nJust like `rmw_validate_topic_name()`, this function will return a cause if the name is invalid, as well as an index in the string that is the culprit.\r\n\r\nI copy-paste-modify'ed this from the other validate function, so please be on the lookout for typos :smile:.","created_at":"2017-03-29T00:19:52Z","updated_at":"2017-03-29T18:16:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24cea13f7b20c9fdc9fc2d06b084f4787b41dbf7","assignee":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars2.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"assignees":[{"login":"wjwwood","id":100427,"avatar_url":"https://avatars2.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rmw/pulls/93/commits","review_comments_url":"https://api.github.com/repos/ros2/rmw/pulls/93/comments","review_comment_url":"https://api.github.com/repos/ros2/rmw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rmw/issues/93/comments","statuses_url":"https://api.github.com/repos/ros2/rmw/statuses/3982076fa8658b68e0d6e4a53903d7efda132d50","head":{"label":"ros2:validate_node_name_func","ref":"validate_node_name_func","sha":"3982076fa8658b68e0d6e4a53903d7efda132d50","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars2.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737319,"name":"rmw","full_name":"ros2/rmw","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars2.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rmw","description":"The ROS Middleware (rmw) Interface.","fork":false,"url":"https://api.github.com/repos/ros2/rmw","forks_url":"https://api.github.com/repos/ros2/rmw/forks","keys_url":"https://api.github.com/repos/ros2/rmw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rmw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rmw/teams","hooks_url":"https://api.github.com/repos/ros2/rmw/hooks","issue_events_url":"https://api.github.com/repos/ros2/rmw/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rmw/events","assignees_url":"https://api.github.com/repos/ros2/rmw/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rmw/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rmw/tags","blobs_url":"https://api.github.com/repos/ros2/rmw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rmw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rmw/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rmw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rmw/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rmw/languages","stargazers_url":"https://api.github.com/repos/ros2/rmw/stargazers","contributors_url":"https://api.github.com/repos/ros2/rmw/contributors","subscribers_url":"https://api.github.com/repos/ros2/rmw/subscribers","subscription_url":"https://api.github.com/repos/ros2/rmw/subscription","commits_url":"https://api.github.com/repos/ros2/rmw/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rmw/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rmw/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rmw/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rmw/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rmw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rmw/merges","archive_url":"https://api.github.com/repos/ros2/rmw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rmw/downloads","issues_url":"https://api.github.com/repos/ros2/rmw/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rmw/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rmw/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rmw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rmw/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rmw/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rmw/deployments","created_at":"2014-08-07T21:35:58Z","updated_at":"2016-10-25T21:31:42Z","pushed_at":"2017-03-29T07:51:54Z","git_url":"git://github.com/ros2/rmw.git","ssh_url":"git@github.com:ros2/rmw.git","clone_url":"https://github.com/ros2/rmw.git","svn_url":"https://github.com/ros2/rmw","homepage":"","size":202,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":14,"forks":7,"open_issues":14,"watchers":5,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"9dc1f6591574e3c5537f2aa8405fe6b515f416bc","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars2.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737319,"name":"rmw","full_name":"ros2/rmw","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars2.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rmw","description":"The ROS Middleware (rmw) Interface.","fork":false,"url":"https://api.github.com/repos/ros2/rmw","forks_url":"https://api.github.com/repos/ros2/rmw/forks","keys_url":"https://api.github.com/repos/ros2/rmw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rmw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rmw/teams","hooks_url":"https://api.github.com/repos/ros2/rmw/hooks","issue_events_url":"https://api.github.com/repos/ros2/rmw/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rmw/events","assignees_url":"https://api.github.com/repos/ros2/rmw/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rmw/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rmw/tags","blobs_url":"https://api.github.com/repos/ros2/rmw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rmw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rmw/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rmw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rmw/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rmw/languages","stargazers_url":"https://api.github.com/repos/ros2/rmw/stargazers","contributors_url":"https://api.github.com/repos/ros2/rmw/contributors","subscribers_url":"https://api.github.com/repos/ros2/rmw/subscribers","subscription_url":"https://api.github.com/repos/ros2/rmw/subscription","commits_url":"https://api.github.com/repos/ros2/rmw/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rmw/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rmw/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rmw/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rmw/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rmw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rmw/merges","archive_url":"https://api.github.com/repos/ros2/rmw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rmw/downloads","issues_url":"https://api.github.com/repos/ros2/rmw/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rmw/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rmw/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rmw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rmw/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rmw/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rmw/deployments","created_at":"2014-08-07T21:35:58Z","updated_at":"2016-10-25T21:31:42Z","pushed_at":"2017-03-29T07:51:54Z","git_url":"git://github.com/ros2/rmw.git","ssh_url":"git@github.com:ros2/rmw.git","clone_url":"https://github.com/ros2/rmw.git","svn_url":"https://github.com/ros2/rmw","homepage":"","size":202,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":14,"forks":7,"open_issues":14,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rmw/pulls/93"},"html":{"href":"https://github.com/ros2/rmw/pull/93"},"issue":{"href":"https://api.github.com/repos/ros2/rmw/issues/93"},"comments":{"href":"https://api.github.com/repos/ros2/rmw/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rmw/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rmw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rmw/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rmw/statuses/3982076fa8658b68e0d6e4a53903d7efda132d50"}}}}
{"actor":{"display_login":"wjwwood"}}