github.com/alibaba/ilogtail/pkg@v0.0.0-20250526110833-c53b480d046c/logtail/LogtailPluginAdapter.h (about) 1 /* 2 * Copyright 2021 iLogtail Authors 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 #ifndef LOGTAILPLUGINADAPTER_H__ 18 #define LOGTAILPLUGINADAPTER_H__ 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 typedef int(*IsValidToSendFun)(long long logstoreKey); 25 26 typedef int(*SendPbFun)(const char * configName, int configNameSize, const char * logstore, int logstoreSize, char * pbBuffer, int pbSize, int lines); 27 28 typedef int(*SendPbV2Fun)(const char *configName, int configNameSize, 29 const char *logstore, int logstoreSize, 30 char *pbBuffer, int pbSize, 31 int lines, 32 const char *shardHash, int shardHashSize); 33 34 typedef int(*PluginCtlCmdFun)(const char * configName, int configNameSize, int optId, const char * params, int paramsLen); 35 36 void RegisterLogtailCallBack(IsValidToSendFun checkFun, SendPbFun sendFun, PluginCtlCmdFun cmdFun); 37 38 void RegisterLogtailCallBackV2(IsValidToSendFun checkFun, 39 SendPbFun sendV1Fun, 40 SendPbV2Fun sendV2Fun, 41 PluginCtlCmdFun cmdFun); 42 43 int LogtailIsValidToSend(long long logstoreKey); 44 45 int LogtailSendPb(const char * configName, int configNameSize, const char * logstore, int logstoreSize, char * pbBuffer, int pbSize, int lines); 46 47 int LogtailSendPbV2(const char *configName, int configNameSize, 48 const char *logstore, int logstoreSize, 49 char *pbBuffer, int pbSize, 50 int lines, 51 const char *shardHash, int shardHashSize); 52 53 int LogtailCtlCmd(const char * configName, int configNameSize, int cmdId, const char * params, int paramsLen); 54 55 // version for logtail plugin adapter, used for check plugin adapter version 56 int PluginAdapterVersion(); 57 58 #ifdef __cplusplus 59 } 60 #endif 61 62 63 #endif // LOGTAILPLUGINADAPTER_H__