Skip to content

Commit

Permalink
[ISSUE #4320] C SDK Support For TCP (#4324)
Browse files Browse the repository at this point in the history
* c-sdk dirs

* c-sdk support tcp protocol

* license

* support for tcp
  • Loading branch information
zhurq authored Nov 1, 2023
1 parent 80c7f88 commit 2f66f20
Show file tree
Hide file tree
Showing 40 changed files with 24,403 additions and 0 deletions.
55 changes: 55 additions & 0 deletions eventmesh-sdks/eventmesh-sdk-c/include/message_log_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef __MESSAGE_LOG_API_H_
#define __MESSAGE_LOG_API_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include "rmb_define.h"
#include "rmb_pub.h"

#define LOG_MSG_COM_CONSUMERID "consumerId"
#define LOG_MSG_COM_LOGNAME "logName"
#define LOG_MSG_COM_TIMESTAMP "logTimestamp"
#define LOG_MSG_COM_CONTENT "content"
#define LOG_MSG_COM_LOGTYPE "logType"
#define LOG_MSG_COM_LANG "lang"
#define LOG_MSG_COM_ID "id"
#define LOG_MSG_COM_PROCESSID "processId"
#define LOG_MSG_COM_THREADID "threadId"
#define LOG_MSG_COM_CONSUMERSVRID "consumerSvrId"
#define LOG_MSG_COM_LEVEL "level"
#define LOG_MSG_COM_EXTFIELDS "extFields"

#define LOG_INFO_LEVEL "info"
#define LOG_DEBUG_LEVEL "debug"
#define LOG_WARN_LEVEL "warn"
#define LOG_ERROR_LEVEL "error"
#define LOG_FATAL_LEVEL "fatal"

//应用可以调用此接口上传log日志
int rmb_log_for_common (StContext * pStContext, const char *iLogLevel,
const char *cLogName, const char *content,
const char *extFields);

#ifdef __cplusplus
}
#endif

#endif
45 changes: 45 additions & 0 deletions eventmesh-sdks/eventmesh-sdk-c/include/rmb_access_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMB_ACCESS_CONFIG_H_
#define RMB_ACCESS_CONFIG_H_

#ifdef __cplusplus
extern "C"
{
#endif

int rmb_get_wemq_proxy_list_num ();

int rmb_get_wemq_proxy_list_used ();

//int wemq_proxy_load_servers(char* url, long timeout, const char* path);
int wemq_proxy_load_servers (const char *url, long timeout);

int wemq_proxy_get_server (char *host, size_t size, unsigned int *port);

void wemq_proxy_goodbye (const char *host, unsigned int port);

void wemq_proxy_to_black_list (const char *host, unsigned int port);

int wemq_proxy_ip_is_connected ();

void split_str (char *ips, char ipArray[][50], int *len);

#ifdef __cplusplus
}
#endif

#endif /* RMB_ACCESS_CONFIG_H_ */
60 changes: 60 additions & 0 deletions eventmesh-sdks/eventmesh-sdk-c/include/rmb_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMB_CFG_H_
#define RMB_CFG_H_

#include "rmb_define.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define CFG_STRING (int)1
#define CFG_INT (int)2
#define CFG_LONG (int)3
#define CFG_DOUBLE (int)4
#define CFG_LINE (int)5
#define CFG_SHORT (int)6

#define US 0x1f

#define MAX_CONFIG_LINE_LEN 1023

void RMB_TLib_Cfg_GetConfig (char *sConfigFilePath, ...);

#define Rmb_TLib_Cfg_GetConfig(sConfigFilePath,fmt,args...) RMB_TLib_Cfg_GetConfig(sConfigFilePath,fmt,## args)

/**
* Function: rmb_load_config
* Description: rmb load configure
* Return:
* 0: success
* -1: failed
*/
int rmb_load_config (const char *configPath);

const char *rmb_get_host_ip ();

void rmb_get_config_python (RmbPythonConfig * config);

const char *getRmbLastError ();

#ifdef __cplusplus
}
#endif

#endif /* RMB_CFG_H_ */
Loading

0 comments on commit 2f66f20

Please sign in to comment.