12498b56bSopenharmony_ci/* 22498b56bSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 32498b56bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 42498b56bSopenharmony_ci * you may not use this file except in compliance with the License. 52498b56bSopenharmony_ci * You may obtain a copy of the License at 62498b56bSopenharmony_ci * 72498b56bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 82498b56bSopenharmony_ci * 92498b56bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 102498b56bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 112498b56bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 122498b56bSopenharmony_ci * See the License for the specific language governing permissions and 132498b56bSopenharmony_ci * limitations under the License. 142498b56bSopenharmony_ci */ 152498b56bSopenharmony_ci 162498b56bSopenharmony_ci#ifndef HILOG_BASE_H 172498b56bSopenharmony_ci#define HILOG_BASE_H 182498b56bSopenharmony_ci 192498b56bSopenharmony_ci#include <stdint.h> 202498b56bSopenharmony_ci#include <stddef.h> 212498b56bSopenharmony_ci 222498b56bSopenharmony_ci#define SOCKET_FILE_DIR "/dev/unix/socket/" 232498b56bSopenharmony_ci#define INPUT_SOCKET_NAME "hilogInput" 242498b56bSopenharmony_ci 252498b56bSopenharmony_ci#define MAX_LOG_LEN 4096 /* maximum length of a log, include '\0' */ 262498b56bSopenharmony_ci#define MAX_TAG_LEN 32 /* log tag size, include '\0' */ 272498b56bSopenharmony_ci 282498b56bSopenharmony_ci/* 292498b56bSopenharmony_ci * header of log message from libhilog to hilogd 302498b56bSopenharmony_ci */ 312498b56bSopenharmony_citypedef struct __attribute__((__packed__)) { 322498b56bSopenharmony_ci uint16_t len; 332498b56bSopenharmony_ci uint16_t version : 3; 342498b56bSopenharmony_ci uint16_t type : 4; /* APP,CORE,INIT,SEC etc */ 352498b56bSopenharmony_ci uint16_t level : 3; 362498b56bSopenharmony_ci uint16_t tagLen : 6; /* include '\0' */ 372498b56bSopenharmony_ci uint32_t tv_sec; 382498b56bSopenharmony_ci uint32_t tv_nsec; 392498b56bSopenharmony_ci uint32_t mono_sec; 402498b56bSopenharmony_ci uint32_t pid; 412498b56bSopenharmony_ci uint32_t tid; 422498b56bSopenharmony_ci uint32_t domain; 432498b56bSopenharmony_ci char tag[]; /* shall be end with '\0' */ 442498b56bSopenharmony_ci} HilogMsg; 452498b56bSopenharmony_ci 462498b56bSopenharmony_ci#if defined(__GNUC__) && (__GNUC__ >= 4) 472498b56bSopenharmony_ci#define HILOG_PUBLIC_API __attribute__((visibility("default"))) 482498b56bSopenharmony_ci#define HILOG_LOCAL_API __attribute__((visibility("hidden"))) 492498b56bSopenharmony_ci#else 502498b56bSopenharmony_ci#define HILOG_PUBLIC_API 512498b56bSopenharmony_ci#define HILOG_LOCAL_API 522498b56bSopenharmony_ci#endif 532498b56bSopenharmony_ci 542498b56bSopenharmony_ci#endif /* HILOG_BASE_H */ 55