1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 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 16 #ifndef CRPC_COMMON_H 17 #define CRPC_COMMON_H 18 19 #include <errno.h> 20 #include <stdio.h> 21 #include <stdlib.h> 22 #include <string.h> 23 #include <arpa/inet.h> 24 #include <fcntl.h> 25 #include <poll.h> 26 #include <sys/epoll.h> 27 #include <sys/socket.h> 28 #include <sys/types.h> 29 #include <sys/un.h> 30 #include <unistd.h> 31 #include <pthread.h> 32 33 #include "securec.h" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #define SOCK_CLOSE (-200) 40 #define SOCK_ERR (-100) 41 42 #define NONE_EVENT (0X00) 43 #define READ_EVENT (0x01) 44 #define WRIT_EVENT (0X02) 45 #define EXCP_EVENT (0X04) 46 47 #define INSERT_HASH_DUPLICATE (-2) 48 #define SERIAL_READ_TOO_LONG (-2) 49 #define SERIAL_READ_INVALID_DIGIT (-3) 50 #define MAX_ONE_LINE_SIZE (1024) 51 52 #ifdef __cplusplus 53 } 54 #endif 55 #endif