rcl  master
C API providing common ROS client library functionality.
validate_topic_name.h
1 // Copyright 2017 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCL__VALIDATE_TOPIC_NAME_H_
16 #define RCL__VALIDATE_TOPIC_NAME_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rcl/macros.h"
24 #include "rcl/types.h"
25 #include "rcl/visibility_control.h"
26 
27 #define RCL_TOPIC_NAME_VALID 0
28 #define RCL_TOPIC_NAME_INVALID_IS_EMPTY_STRING 1
29 #define RCL_TOPIC_NAME_INVALID_ENDS_WITH_FORWARD_SLASH 2
30 #define RCL_TOPIC_NAME_INVALID_CONTAINS_UNALLOWED_CHARACTERS 3
31 #define RCL_TOPIC_NAME_INVALID_NAME_TOKEN_STARTS_WITH_NUMBER 4
32 #define RCL_TOPIC_NAME_INVALID_UNMATCHED_CURLY_BRACE 5
33 #define RCL_TOPIC_NAME_INVALID_MISPLACED_TILDE 6
34 #define RCL_TOPIC_NAME_INVALID_TILDE_NOT_FOLLOWED_BY_FORWARD_SLASH 7
35 #define RCL_TOPIC_NAME_INVALID_SUBSTITUTION_CONTAINS_UNALLOWED_CHARACTERS 8
36 #define RCL_TOPIC_NAME_INVALID_SUBSTITUTION_STARTS_WITH_NUMBER 9
37 
39 
89 RCL_PUBLIC
90 RCL_WARN_UNUSED
91 rcl_ret_t
92 rcl_validate_topic_name(
93  const char * topic_name,
94  int * validation_result,
95  size_t * invalid_index);
96 
98 
107 RCL_PUBLIC
108 RCL_WARN_UNUSED
109 rcl_ret_t
110 rcl_validate_topic_name_with_size(
111  const char * topic_name,
112  size_t topic_name_length,
113  int * validation_result,
114  size_t * invalid_index);
115 
117 RCL_PUBLIC
118 RCL_WARN_UNUSED
119 const char *
120 rcl_topic_name_validation_result_string(int validation_result);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif // RCL__VALIDATE_TOPIC_NAME_H_