All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
unix-transport-lite.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_UNIX_TRANSPORT_LITE_HPP
23 #define NDN_UNIX_TRANSPORT_LITE_HPP
24 
25 #include "../../c/errors.h"
26 #include "../../c/transport/transport-types.h"
27 #include "../util/dynamic-uint8-array-lite.hpp"
28 #include "../encoding/element-listener-lite.hpp"
29 
30 namespace ndn {
31 
38 public:
50 
56  static bool
57  isLocal();
58 
68  ndn_Error
69  connect(char* filePath, ElementListenerLite& elementListener);
70 
77  ndn_Error
78  send(const uint8_t* data, size_t dataLength);
79 
94  ndn_Error
95  processEvents(uint8_t *buffer, size_t bufferLength);
96 
101  ndn_Error
102  close();
103 
109  static UnixTransportLite&
110  downCast(ndn_UnixTransport& transport) { return *(UnixTransportLite*)&transport; }
111 
112  static const UnixTransportLite&
113  downCast(const ndn_UnixTransport& transport) { return *(UnixTransportLite*)&transport; }
114 };
115 
116 }
117 
118 #endif
ndn_Error connect(char *filePath, ElementListenerLite &elementListener)
Connect with a Unix Socket to the socket filePath.
An ElementListenerLite holds an OnReceivedElementLite function pointer.
Definition: element-listener-lite.hpp:37
ndn_Error close()
Close the socket.
ndn_Error send(const uint8_t *data, size_t dataLength)
Send data to the socket.
ndn_Error processEvents(uint8_t *buffer, size_t bufferLength)
Process any data to receive.
A DynamicUInt8ArrayLite holds a pointer to an allocated array, the length of the allocated array...
Definition: dynamic-uint8-array-lite.hpp:35
A UnixTransportLite object is used to send packets and to listen for incoming packets over a Unix soc...
Definition: unix-transport-lite.hpp:37
static UnixTransportLite & downCast(ndn_UnixTransport &transport)
Downcast the reference to the ndn_UnixTransport struct to a UnixTransportLite.
Definition: unix-transport-lite.hpp:110
static bool isLocal()
Determine whether this transport is to a node on the current machine.
Definition: transport-types.h:43
UnixTransportLite(DynamicUInt8ArrayLite &buffer)
Create a UnixTransport with default values for no connection yet and to use the given DynamicUInt8Arr...