tcf-agent service开发例子

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 00:20   525   0

前几天打算基于tcf实现一个lttng control程序,因此完成了tcf-agent service开发例子

1. 下载tcf-agent:http://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git

git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git
ssh://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git
http://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git

2. 创建一个project目录,放在tcf-agent源代码目录下,

例如,拷贝example目录下的daytime项目,然后在上面进行修改。

2.1 首先是项目名字:例如daytime --->hello_service

2.2 修改Makefile文件:TCF_AGENT_DIR=../../agent ---->TCF_AGENT_DIR=../agent

2.3 修改hello_service/tcf/main/services-ext.h

#include <tcf/services/daytime.h>

static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) {
ini_daytime_service(proto); ------> 修改或增加外部services
}

2.4 增加外部的service源码文件,参考daytime.c和daytime.h.

2.4.1 增加command,调用tcf-agent api函数 add_command_handler()

例如: add_command_handler(proto, DAYTIME, "getTimeOfDay", command_get_time_of_day);

proto是协议;DAYTIME是service名字,"getTimeOfDay"是命令,command_get_time_of_day是命令处理函数。

3 编译

在hellow_service目录下:make

会在hellow_service目录下生成一个obj的目录

4 运行: ./obj/GNU/Linux/i686/Debug/agent


转载于:https://my.oschina.net/u/263896/blog/57487

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP