TI's mqtt.

Dependencies:   client server

Committer:
dflet
Date:
Sat Jun 06 13:29:50 2015 +0000
Revision:
0:698866e331b2
TI's mqtt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:698866e331b2 1 /******************************************************************************
dflet 0:698866e331b2 2 *
dflet 0:698866e331b2 3 * Copyright (C) 2014 Texas Instruments Incorporated
dflet 0:698866e331b2 4 *
dflet 0:698866e331b2 5 * All rights reserved. Property of Texas Instruments Incorporated.
dflet 0:698866e331b2 6 * Restricted rights to use, duplicate or disclose this code are
dflet 0:698866e331b2 7 * granted through contract.
dflet 0:698866e331b2 8 *
dflet 0:698866e331b2 9 * The program may not be used without the written permission of
dflet 0:698866e331b2 10 * Texas Instruments Incorporated or against the terms and conditions
dflet 0:698866e331b2 11 * stipulated in the agreement under which this program has been supplied,
dflet 0:698866e331b2 12 * and under no circumstances can it be used with non-TI connectivity device.
dflet 0:698866e331b2 13 *
dflet 0:698866e331b2 14 ******************************************************************************/
dflet 0:698866e331b2 15
dflet 0:698866e331b2 16 /*
dflet 0:698866e331b2 17 Network Services for General Purpose Linux environment
dflet 0:698866e331b2 18 */
dflet 0:698866e331b2 19
dflet 0:698866e331b2 20 #ifndef __CC31XX_SL_NET_H__
dflet 0:698866e331b2 21 #define __CC31XX_SL_NET_H__
dflet 0:698866e331b2 22
dflet 0:698866e331b2 23 #include "cc3100_simplelink.h"
dflet 0:698866e331b2 24 #include "mqtt_client.h" /* conn options */
dflet 0:698866e331b2 25
dflet 0:698866e331b2 26 #ifdef __cplusplus
dflet 0:698866e331b2 27 extern "C"
dflet 0:698866e331b2 28 {
dflet 0:698866e331b2 29 #endif
dflet 0:698866e331b2 30
dflet 0:698866e331b2 31 namespace mbed_mqtt {
dflet 0:698866e331b2 32
dflet 0:698866e331b2 33 //*****************************************************************************
dflet 0:698866e331b2 34 // MACROS
dflet 0:698866e331b2 35 //*****************************************************************************
dflet 0:698866e331b2 36
dflet 0:698866e331b2 37 // MACRO to include receive time out feature
dflet 0:698866e331b2 38 #define SOC_RCV_TIMEOUT_OPT 1
dflet 0:698866e331b2 39
dflet 0:698866e331b2 40
dflet 0:698866e331b2 41 /*-----------------------------------------------------------------------------
dflet 0:698866e331b2 42 definitions needed for the functions in this file
dflet 0:698866e331b2 43 -----------------------------------------------------------------------------*/
dflet 0:698866e331b2 44
dflet 0:698866e331b2 45
dflet 0:698866e331b2 46 /*-----------------------------------------------------------------------------
dflet 0:698866e331b2 47 prototypes of functions
dflet 0:698866e331b2 48 -----------------------------------------------------------------------------*/
dflet 0:698866e331b2 49
dflet 0:698866e331b2 50 int32_t comm_open(uint32_t nwconn_opts, const char *server_addr, uint16_t port_number,
dflet 0:698866e331b2 51 const struct secure_conn *nw_security);
dflet 0:698866e331b2 52 int32_t tcp_send(int32_t comm, const uint8_t *buf, uint32_t len, void *ctx);
dflet 0:698866e331b2 53 int32_t tcp_recv(int32_t comm, uint8_t *buf, uint32_t len, uint32_t wait_secs, bool *timed_out,
dflet 0:698866e331b2 54 void *ctx);
dflet 0:698866e331b2 55 int32_t comm_close(int32_t comm);
dflet 0:698866e331b2 56 uint32_t rtc_secs(void);
dflet 0:698866e331b2 57
dflet 0:698866e331b2 58 /*-----------------functions added for server -----------------------------*/
dflet 0:698866e331b2 59
dflet 0:698866e331b2 60 int32_t tcp_listen(uint32_t nwconn_info, uint16_t port_number,
dflet 0:698866e331b2 61 const struct secure_conn *nw_security);
dflet 0:698866e331b2 62
dflet 0:698866e331b2 63 int32_t tcp_select(int32_t *recv_cvec, int32_t *send_cvec, int32_t *rsvd_cvec,
dflet 0:698866e331b2 64 uint32_t wait_secs);
dflet 0:698866e331b2 65
dflet 0:698866e331b2 66
dflet 0:698866e331b2 67 int32_t tcp_accept(int32_t listen_hnd, uint8_t *client_ip,
dflet 0:698866e331b2 68 uint32_t *ip_length);
dflet 0:698866e331b2 69
dflet 0:698866e331b2 70 /*----------------- adding functions for udp functionalities -------------------*/
dflet 0:698866e331b2 71
dflet 0:698866e331b2 72 /** Send a UDP packet
dflet 0:698866e331b2 73
dflet 0:698866e331b2 74 @param[in] comm communication entity handle; socket handle in this case
dflet 0:698866e331b2 75 @param[in] buf buf to be sent in the udp packet
dflet 0:698866e331b2 76 @param[in] len length of the buffer buf
dflet 0:698866e331b2 77 @param[in] dest_port destination port number
dflet 0:698866e331b2 78 @param[in] dest_ip ip address of the destination in dot notation, interpretted as a string;
dflet 0:698866e331b2 79 Only IPV4 is supported currently.
dflet 0:698866e331b2 80 @param[in] ip_len length of string dest_ip; currently not used
dflet 0:698866e331b2 81 @return number of bytes sent or error returned by sl_SendTo call
dflet 0:698866e331b2 82 */
dflet 0:698866e331b2 83 int32_t send_dest(int32_t, const uint8_t *buf, uint32_t len, uint16_t dest_port, const uint8_t *dest_ip, uint32_t ip_len);
dflet 0:698866e331b2 84
dflet 0:698866e331b2 85 /** Recieve a UDP packet
dflet 0:698866e331b2 86
dflet 0:698866e331b2 87 @param[in] comm communication entity handle; socket handle in this case
dflet 0:698866e331b2 88 @param[out] buf buf into which received UDP packet is written
dflet 0:698866e331b2 89 @param[in] maximum len length of the buffer buf
dflet 0:698866e331b2 90 @param[out] from_port port number of UDP packet source
dflet 0:698866e331b2 91 @param[out] from_ip ip address of the UDP packet source.
dflet 0:698866e331b2 92 The ip address is to be interpreted as a uint32_t number in network byte ordering
dflet 0:698866e331b2 93 Only IPV4 is supported currently.
dflet 0:698866e331b2 94 @param[out] ip_len length of string from_ip;
dflet 0:698866e331b2 95 currently always populated with 4 as the address is a IPV4 address
dflet 0:698866e331b2 96 @return number of bytes received or error returned by sl_RecvFrom call
dflet 0:698866e331b2 97 */
dflet 0:698866e331b2 98 int32_t recv_from(int32_t comm, uint8_t *buf, uint32_t len, uint16_t *from_port, uint8_t *from_ip, uint32_t *ip_len);
dflet 0:698866e331b2 99
dflet 0:698866e331b2 100 }//namespace mbed_mqtt
dflet 0:698866e331b2 101
dflet 0:698866e331b2 102 #ifdef __cplusplus
dflet 0:698866e331b2 103 }
dflet 0:698866e331b2 104 #endif
dflet 0:698866e331b2 105
dflet 0:698866e331b2 106 #endif
dflet 0:698866e331b2 107