Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #ifndef NDN_UDPTRANSPORT_H |
| 7 | #define NDN_UDPTRANSPORT_H |
| 8 | |
| 9 | #include "../errors.h" |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | struct ndn_UdpTransport { |
| 16 | int socketDescriptor; /**< -1 if not connected */ |
| 17 | }; |
| 18 | |
| 19 | static inline void ndn_UdpTransport_init(struct ndn_UdpTransport *self) |
| 20 | { |
| 21 | self->socketDescriptor = -1; |
| 22 | } |
| 23 | |
| 24 | ndn_Error ndn_UdpTransport_connect(struct ndn_UdpTransport *self, char *host, unsigned short port); |
| 25 | |
| 26 | ndn_Error ndn_UdpTransport_send(struct ndn_UdpTransport *self, unsigned char *data, unsigned int dataLength); |
| 27 | |
| 28 | ndn_Error ndn_UdpTransport_receive |
| 29 | (struct ndn_UdpTransport *self, unsigned char *buffer, unsigned int bufferLength, unsigned int *nBytes); |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | } |
| 33 | #endif |
| 34 | |
| 35 | #endif |