IoT Wireless

Open Source Library for Cloud 본문

SmartThings

Open Source Library for Cloud

DH0815 2015. 2. 6. 10:33

IoT Cloud/Device를 구축하는데, 보조적으로 사용될 수 있는 이식성 높은 Library를 정리해본다.

실제, 몇몇 Library들은 Cloud SDK로 추천되고 사용되기도 한다.


libcurl


ibcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!


libcurl is highly portable, it builds and works identically on numerous platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more...


libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported, fast, thoroughly documented and is already used by many known, big and successful companies and numerous applications.


http://curl.haxx.se/libcurl/

int main(void)
{
  CURL *curl;
  CURLcode res;
 
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    /* example.com is redirected, so we tell libcurl to follow redirection */ 
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
 
    /* Perform the request, res will get the return code */ 
    res = curl_easy_perform(curl);
    /* Check for errors */ 
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));
 
    /* always cleanup */ 
    curl_easy_cleanup(curl);
  }
  return 0;
}


libevent


The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.

libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop.


Currently, libevent supports /dev/poll, kqueue(2), event ports, POSIX select(2), Windows select(), poll(2), and epoll(4). The internal event mechanism is completely independent of the exposed event API, and a simple update of libevent can provide new functionality without having to redesign the applications. As a result, Libevent allows for portable application development and provides the most scalable event notification mechanism available on an operating system. Libevent can also be used for multi-threaded applications, either by isolating each event_base so that only a single thread accesses it, or by locked access to a single shared event_base. Libevent should compile on Linux, *BSD, Mac OS X, Solaris, Windows, and more.


http://libevent.org/

int main(int argc, char **argv)
{
    //.........................
    ev_init();
    //.........................

    event_set(&ev_accept, listen_fd, EV_READ|EV_PERSIST, on_accept, NULL);
    event_add(&ev_accept, NULL);

    //.........................
    event_dispatch();
}


libjson


This is the libjson project ("libjson")

This project is hosted by SourceForge.net. The project team describes it as:


A JSON reader and writer which is super-effiecient and usually runs circles around other JSON libraries. It's highly customizable to optimize for your particular project, and very lightweight. For Windows, OSX, or Linux. Works in any language.


http://libjson.sourceforge.net/


int main(int argc, char **argv)
{
  struct json_object *new_obj;

  // I added some new lines... not in real program
  new_obj = json_tokener_parse("{ \"glossary\": { \"title\":\"example glossary\", \"pageCount\": 100, \"GlossDiv\": { \"title\": \"S\", \"GlossList\":[ { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\":\"A meta-markup language, used to create markup languages such as DocBook.\",\"GlossSeeAlso\": [\"GML\", \"XML\", \"markup\"] } ] } } }");

  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));

  new_obj = json_object_object_get(new_obj, "glossary");
  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));

  new_obj = json_object_object_get(new_obj, "pageCount");

  int pageCount = json_object_get_int(new_obj);

  printf("Page count = %d", pageCount);
  json_object_put(new_obj);

  return 0;
}


OpenSSL


https://www.openssl.org/



'SmartThings' 카테고리의 다른 글

Remarkable IoT device  (0) 2015.06.04
IoT 클라우드 서버로서의 BaaS  (0) 2015.01.22
IoT Open API Platform  (0) 2014.11.14