first commit for opensource
first commit for opensource
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#ifndef _OSAL_DTLS_H_
|
||||
#define _OSAL_DTLS_H_
|
||||
|
||||
__QCLOUD_OSAL__ void *osal_dtls_connect(qcloud_tls_opt_t *tls_opt, const char *host, int port);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_dtls_disconnect(void *handle);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_dtls_write(void *handle, const void *buf, size_t len, size_t *write_len);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_dtls_read(void *handle, void *buf, size_t len, uint32_t timeout, size_t *read_len);
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,29 @@
|
||||
#ifndef _OSAL_OS_H_
|
||||
#define _OSAL_OS_H_
|
||||
|
||||
__QCLOUD_OSAL__ void *osal_mutex_create(void);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_mutex_destroy(void *mutex);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_mutex_lock(void *mutex);
|
||||
|
||||
__QCLOUD_OSAL__ int osal_mutex_trylock(void *mutex);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_mutex_unlock(void *mutex);
|
||||
|
||||
__QCLOUD_OSAL__ void *osal_malloc(uint32_t size);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_free(void *ptr);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_printf(const char *fmt, ...);
|
||||
|
||||
__QCLOUD_OSAL__ int osal_snprintf(char *str, const int len, const char *fmt, ...);
|
||||
|
||||
__QCLOUD_OSAL__ int osal_vsnprintf(char *str, const int len, const char *format, va_list ap);
|
||||
|
||||
__QCLOUD_OSAL__ uint32_t osal_uptime_ms(void);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_sleep_ms(uint32_t ms);
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,13 @@
|
||||
#ifndef _OSAL_TCP_
|
||||
#define _OSAL_TCP_
|
||||
|
||||
__QCLOUD_OSAL__ int osal_tcp_connect(const char *host, uint16_t port);
|
||||
|
||||
__QCLOUD_OSAL__ int osal_tcp_disconnect(int fd);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_tcp_write(int fd, const void *buf, size_t len, uint32_t timeout, size_t *write_len);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_tcp_read(int fd, void *buf, size_t len, uint32_t timeout, size_t *read_len);
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#ifndef _OSAL_TIMER_H_
|
||||
#define _OSAL_TIMER_H_
|
||||
|
||||
typedef struct osal_timer_st {
|
||||
uint32_t end_time;
|
||||
} osal_timer_t;
|
||||
|
||||
__QCLOUD_OSAL__ int osal_timer_is_expired(osal_timer_t *timer);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_timer_countdown_ms(osal_timer_t *timer, uint32_t timeout);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_timer_countdown(osal_timer_t *timer, uint32_t timeout);
|
||||
|
||||
__QCLOUD_OSAL__ uint32_t osal_timer_remain(osal_timer_t *timer);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_timer_init(osal_timer_t *timer);
|
||||
|
||||
__QCLOUD_OSAL__ char *osal_timer_current(void);
|
||||
|
||||
__QCLOUD_OSAL__ long osal_timer_current_sec(void);
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,13 @@
|
||||
#ifndef _OSAL_TLS_H_
|
||||
#define _OSAL_TLS_H_
|
||||
|
||||
__QCLOUD_OSAL__ void *osal_tls_connect(qcloud_tls_opt_t *tls_opt, const char *host, int port);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_tls_disconnect(void *handle);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_tls_write(void *handle, const void *buf, size_t len, uint32_t timeout, size_t *write_len);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_tls_read(void *handle, void *buf, size_t len, uint32_t timeout, size_t *read_len) ;
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,13 @@
|
||||
#ifndef _OSAL_UDP_H_
|
||||
#define _OSAL_UDP_H_
|
||||
|
||||
__QCLOUD_OSAL__ int osal_udp_connect(const char *host, unsigned short port);
|
||||
|
||||
__QCLOUD_OSAL__ void osal_udp_disconnect(int sockfd);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_udp_write(int sockfd, const void *buf, size_t len, uint32_t timeout, size_t *write_len);
|
||||
|
||||
__QCLOUD_OSAL__ qcloud_err_t osal_udp_read(int sockfd, void *buf, size_t len, uint32_t timeout, size_t *read_len);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user