libubox

lbubox是openwrt的一个核心库,封装了一系列基础实用功能,主要提供事件循环,二进制格式处理,linux链表实现和一些JSON辅助处理。

它的目的是以动态链接库方式来提供可重用的通用功能,给其他模块提供便利和避免再造轮子。

libubox主要提供三部分功能:

1)提供多种基础通用功能接口,包含链表,平衡二叉树,二进制处理,key-value链表,MD5等。

2)socket通信。

3)一套基于事件驱动的机制及任务队列管理功能。

编译安装到PC

1. 修改目录下CMakelists.txt,先去掉lua部分(不使用lua)。

#OPTION(BUILD_LUA "build Lua plugin" ON)
#ADD_SUBDIRECTORY(lua)

2. cmake编译安装

mkdir build; cd build ; cmake .. ; make; make install
[  4%] Built target blobmsg_json-static
[ 38%] Built target ubox-static
[ 72%] Built target ubox
[ 76%] Built target blobmsg_json
[ 80%] Built target jshn
[ 84%] Built target json_script
[ 88%] Built target blobmsg-example
[ 92%] Built target runqueue-example
[ 96%] Built target ustream-example
[100%] Built target json_script-example
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/include/libubox/kvlist.h
-- Up-to-date: /usr/local/include/libubox/json_script.h
-- Up-to-date: /usr/local/include/libubox/blobmsg_json.h
-- Up-to-date: /usr/local/include/libubox/ulog.h
-- Up-to-date: /usr/local/include/libubox/avl-cmp.h
-- Up-to-date: /usr/local/include/libubox/blob.h
-- Up-to-date: /usr/local/include/libubox/runqueue.h
-- Up-to-date: /usr/local/include/libubox/uloop.h
-- Up-to-date: /usr/local/include/libubox/list.h
-- Up-to-date: /usr/local/include/libubox/ustream.h
-- Up-to-date: /usr/local/include/libubox/vlist.h
-- Up-to-date: /usr/local/include/libubox/avl.h
-- Up-to-date: /usr/local/include/libubox/blobmsg.h
-- Up-to-date: /usr/local/include/libubox/safe_list.h
-- Up-to-date: /usr/local/include/libubox/usock.h
-- Up-to-date: /usr/local/include/libubox/md5.h
-- Up-to-date: /usr/local/include/libubox/utils.h
-- Installing: /usr/local/lib/libubox.so
-- Installing: /usr/local/lib/libubox.a
-- Installing: /usr/local/lib/libblobmsg_json.so
-- Set runtime path of "/usr/local/lib/libblobmsg_json.so" to ""
-- Installing: /usr/local/lib/libblobmsg_json.a
-- Installing: /usr/local/bin/jshn
-- Set runtime path of "/usr/local/bin/jshn" to ""
-- Installing: /usr/local/lib/libjson_script.so
-- Set runtime path of "/usr/local/lib/libjson_script.so" to ""
-- Up-to-date: /usr/local/share/libubox/jshn.sh

 

参考文档:

libubox组件(1)——usock

libubox组件(2)——blob/blobmsg

libubox组件(3)——uloop

BLOB二进制对象(blob.c/h)

libubox [4] - uloop runqueue ustream

posted @ 2017-05-01 11:33  yuxi_o  阅读(1686)  评论(0编辑  收藏  举报