Giter VIP home page Giter VIP logo

xuphone / evmongoose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhaojh329/evmongoose

0.0 1.0 0.0 1.02 MB

DEPRECATED. Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It's based on mongoose and libev implementation and it's support Lua API.

License: GNU General Public License v3.0

CMake 0.50% C 96.59% Lua 2.37% HTML 0.17% Makefile 0.37%

evmongoose's Introduction

DEPRECATED. Replaced by libuhttpd, libuwsc, libumqttc

Evmongoose(中文)(github)

Evmongoose is an asynchronous, event(libev) based multi-protocol embedded networking library with functions including TCP, HTTP, WebSocket, MQTT and much more. It is based on mongoose and libev implementation and it's support Lua API.

Evmongoose supports highly customized to extend your application. Before I started this project, I had never found a HTTP server library that was satisfied with the event based framework, and those HTTP server libraries could only loop it'sown objects and could not add my own objects. For example, I want to monitor a signal or a file through the event.

Features

  • New from evmongoose

    • Using libev programming
    • Highly customized to extend your application based on libev
    • Lua API(except wrapper for evmongoose and additional include frequently-used posix C API)
  • Inherited from mongoose

    • plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
    • Alternative openssl and mbedtls
    • HTTP client, HTTP server
    • HTTP File Upload
    • Proxy
    • WebSocket client, WebSocket server
    • MQTT client, MQTT broker
    • CoAP client, CoAP server
    • DNS client, DNS server, async DNS resolver
    • Url Rewrite

How To Compile

For Ubuntu

Install dependency Libraries

  • libev-dev libssl-dev lua5.1 liblua5.1-0-dev lua-zlib

      sudo apt install libev-dev libssl-dev lua5.1 liblua5.1-0-dev lua-zlib
    
  • lua-ev

      git clone https://github.com/brimworks/lua-ev.git
      cd lua-ev
      cmake . -DINSTALL_CMOD=$(lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end")
      make && sudo make install
    

Install Evmongoose(HTTPS Support Default)

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
mkdir build
cd build
cmake ../
make && sudo make install

Install Evmongoose(Disable HTTPS Support)

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
mkdir build
cd build
cmake ../ -DHTTPS_SUPPORT=OFF
make && sudo make install

For OpenWRT/LEDE

git clone https://github.com/zhaojh329/lua-ev-openwrt.git
cp -r lua-ev-openwrt openwrt_dir/package/lua-ev

git clone https://github.com/zhaojh329/evmongoose.git
cp -r evmongoose/openwrt openwrt_dir/package/evmongoose

cd openwrt_dir
./scripts/feeds update -a
./scripts/feeds install -a

make menuconfig
Libraries  --->
    Networking  --->
        <*> evmongoose
            Configuration  --->
                SSl (mbedtls)  --->

make package/evmongoose/compile V=s

For General embedded environment

Cross compile lib-ev

git clone https://github.com/kindy/libev.git
cd libev/src
sh ./autogen.sh
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH
./configure --host=mipsel-openwrt-linux --prefix=`pwd`/obj
make && make install

Cross compile Lua-ev

git clone https://github.com/brimworks/lua-ev.git
cd lua-ev
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH

# xxxxx is your cross compiler with directories
cmake . -DCMAKE_C_COMPILER=mipsel-openwrt-linux-gcc -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH=xxxxx
make

Cross compile evmongoose

git clone https://github.com/zhaojh329/evmongoose.git
cd evmongoose
export PATH=/home/zjh/lede/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/bin:$PATH

# xxxxx is your cross compiler with directories
cmake . -DCMAKE_C_COMPILER=mipsel-openwrt-linux-gcc -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH=xxxxx
make

C API reference manual

Evmongoose dose not change the usage of API in mongoose and libev, so please refer to the API Manual of mongoose and libev. Only one thing to notice is that mg_mgr_poll is no longer invoked when using evmongoose.

In addition, evmongoose added a new API: mg_mgr_set_loop, which is used to set libev's loop for Mgr. If the function is not called, the Mgr will use the default loop:EV_DEFAULT.

How To Contribute

Feel free to create issues or pull-requests if you have any problems.

Please read contributing.md before pushing any changes.

Thanks for the following project

If the project is helpful to you, please do not hesitate to star. Thank you!

evmongoose's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.