ThingWorx Edge C SDK > How to Take Advantage of the C SDK Utilities
How to Take Advantage of the C SDK Utilities
The /src/utils subdirectory of the C SDK provides several utilities that you may find useful in your applications:
Utilities that support proxy servers:
HTTP Proxy — This utility allows you to open a socket and connect to ThingWorx Platform through the HTTP proxy server specified in the twSocket structure. The functions provided support establishing, authenticating, and otherwise managing connections through an HTTP proxy server. The files that define and implement the functions are twHttpProxy.h and twHttpProxy.c.
twNTLM — This utility enables you to establish a connection to ThingWorx Platform through an NTLM proxy server. The files that define and implement the functions are twNtlm.h and twNtlm.c.
Utilities that enable you to use lists, maps (hashmaps), and dictionaries:
list — This utility provides functions for creating a linked list, adding entries to the list, updating values of entries in the list, removing entries from the list, iterating over entries in a list, and deleting lists. The linked lists that the ForEach function can iterate over include maps and dictionaries. Note that twList is dynamically sized, thread-safe, untyped, and doubly linked. Refer to Using Linked Lists
twMaptwMap is a pointer to an internally maintained data structure. The twMap.h file defines the prototypes for the functions that enable you to create a hashmap, add elements to a hashmap, retrieve an element from a hashmap, remove elements from a hashmap, delete a hashmap, search a map for an element and value, replace a value of an element, retrieve the number of elements in a map, and iterate over the elements in a hashmap, using the twMap_Foreach function. Refer to Maps.
twDict — This is an abstraction that lets the C SDK decide if a list is implemented as a map or a list. This utility might be useful on systems with low memory. Refer to Dictionaries.
Utility that supports logging:
twLogger — The twLogger.h file defines the structures and prototypes for the functions that support the logging functionality of the C SDK, including the log level enumeration and the ability to turn on verbose logging for purposes of debugging. The twLogger.c file provides the functions that support logging with the C SDK.
Utilities that provide encryption and string manipulation:
crypto_wrapper — This utility is a wrapper around the libtomcrypt DES encryption functions. The functions support DES encryption/decryption, MD4 Message-Digest algorithm, and creation of a DES key.
twString — The string utilities enable an application to modify characters (strings), including changing the case (upper to lower and lower to upper) and copying a string. The
Was this helpful?