2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
18 #define COMMUNICATION_CLIENT_CAN_INCLUDE_API_LOCAL_COMMON_H_
20 enum CANIF_PROTOCOL_IDX {
25 static inline const char *Canif_PidxTosname(enum CANIF_PROTOCOL_IDX idx) {
28 return LAN_SERVICE_CAN;
36 #define CANIF_NOTIFY_NAME_MAX_SIZE 15
37 static inline bool Canif_CheckNotifyName(PCSTR notify_name) {
38 size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
43 return (strnlen(notify_name, n) < n);
46 static inline bool Canif_CheckNotifyNameWithoutNullCheck(PCSTR notify_name) {
47 size_t n = CANIF_NOTIFY_NAME_MAX_SIZE + 1;
48 return (strnlen(notify_name, n) < n);
51 static inline void Canif_CopyNotifyName(char *dest, PCSTR notify_name) {
52 strncpy(dest, notify_name,
53 strnlen(notify_name, CANIF_NOTIFY_NAME_MAX_SIZE));