Add TCP/IP AT API.

Change-Id: Iaff346f6909acb679865da75fa6d961673a0a634
diff --git a/mbtk/include/mbtk/mbtk_tcpip.h b/mbtk/include/mbtk/mbtk_tcpip.h
new file mode 100755
index 0000000..f462c46
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_tcpip.h
@@ -0,0 +1,76 @@
+/*
+    TCP/IP AT header.
+*/
+/******************************************************************************
+
+                          EDIT HISTORY FOR FILE
+
+  WHEN        WHO       WHAT,WHERE,WHY
+--------    --------    -------------------------------------------------------
+2023/9/24      lb    Initial version
+
+******************************************************************************/
+#ifndef _MBTK_TCPIP_H
+#define _MBTK_TCPIP_H
+#include "mbtk_type.h"
+
+#define MBTK_TCPIP_LINK_MAX 4
+
+typedef void (*mbtk_tcpip_read_callback_func)(int link_id, const char* data, int data_len);
+
+typedef enum {
+    MBTK_TCPIP_ERR_SUCCESS,
+
+    MBTK_TCPIP_ERR_UNKNOWN
+} mbtk_tcpip_err_enum;
+
+typedef enum {
+    MBTK_PROT_TYPE_TCP,
+    MBTK_PROT_TYPE_UDP
+} mbtk_tcpip_prot_type_enum;
+
+typedef enum {
+    MBTK_TCPIP_TYPE_CLIENT,
+    MBTK_TCPIP_TYPE_SERVER
+} mbtk_tcpip_type_enum;
+
+typedef struct {
+    int link_id;
+    char ser_addr[256];
+    int ser_port;
+    mbtk_tcpip_prot_type_enum prot_type;
+    int local_port;
+    bool ack_support;
+    bool ssl_support;
+    bool ignore_cert;
+    uint32 heartbeat_time;
+    uint32 delay_time;
+
+    mbtk_tcpip_read_callback_func read_cb;
+} mbtk_tcpip_info_t;
+
+mbtk_tcpip_err_enum mbtk_tcpip_net_open();
+mbtk_tcpip_err_enum mbtk_tcpip_net_close();
+mbtk_tcpip_err_enum mbtk_tcpip_sock_open(const mbtk_tcpip_info_t *tcpip_info);
+mbtk_tcpip_err_enum mbtk_tcpip_sock_close(int link_id);
+
+int mbtk_tcpip_send(int link_id, const char* data, int data_len, const char* ser_addr, int ser_port);
+int mbtk_tcpip_read(int link_id, char* buff, int buff_size);
+
+/*
+* Get the data traffic of the specified link.
+*/
+int mbtk_tcpip_data_traffic_get(int link_id);
+
+/*
+* Reset the data traffic of the specified link.
+*/
+mbtk_tcpip_err_enum mbtk_tcpip_data_traffic_reset(int link_id);
+
+/*
+* Return 0 if disconnected, other for connected.
+*/
+int mbtk_tcpip_link_state_get(int link_id);
+
+
+#endif /* _MBTK_TCPIP_H */
diff --git a/mbtk/mbtk_lib/src/mbtk_tcpip_at.c b/mbtk/mbtk_lib/src/mbtk_tcpip_at.c
new file mode 100755
index 0000000..8f90bed
--- /dev/null
+++ b/mbtk/mbtk_lib/src/mbtk_tcpip_at.c
@@ -0,0 +1,108 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include "mbtk_log.h"
+#include "mbtk_tcpip.h"
+
+typedef struct {
+    int fd;
+    char ser_addr[256];
+    int ser_port;
+    char local_addr[256];
+    int local_port;
+    bool ack_support;
+    bool ssl_support;
+    bool ignore_cert;
+    uint32 heartbeat_time;
+    uint32 delay_time;
+
+    mbtk_tcpip_read_callback_func read_cb;
+
+    uint32 data_traffic_send;
+    uint32 data_traffic_recv;
+
+} mbtk_tcpip_cli_info_t;
+
+typedef struct {
+    int fd;
+    char ser_addr[256];
+    int ser_port;
+
+    int cli_num;
+    mbtk_tcpip_cli_info_t *cli_list;
+} mbtk_tcpip_ser_info_t;
+
+typedef struct {
+    int link_id;
+    int link_cid;
+    bool link_active;
+    mbtk_tcpip_prot_type_enum prot_type;    // TCP/UDP
+
+    mbtk_tcpip_type_enum type;
+    union
+    {
+        mbtk_tcpip_cli_info_t cli_info;
+        mbtk_tcpip_ser_info_t ser_info;
+    } tcpip_info;
+
+} mbtk_tcpip_link_t;
+
+static mbtk_tcpip_link_t tcpip_link[MBTK_TCPIP_LINK_MAX];
+
+mbtk_tcpip_err_enum mbtk_tcpip_net_open()
+{
+    return MBTK_TCPIP_ERR_SUCCESS;
+}
+
+mbtk_tcpip_err_enum mbtk_tcpip_net_close()
+{
+    return MBTK_TCPIP_ERR_SUCCESS;
+}
+
+mbtk_tcpip_err_enum mbtk_tcpip_sock_open(const mbtk_tcpip_info_t *tcpip_info)
+{
+    return MBTK_TCPIP_ERR_SUCCESS;
+}
+
+mbtk_tcpip_err_enum mbtk_tcpip_sock_close(int link_id)
+{
+    return MBTK_TCPIP_ERR_SUCCESS;
+}
+
+int mbtk_tcpip_send(int link_id, const char* data, int data_len, const char* ser_addr, int ser_port)
+{
+
+    return 0;
+}
+
+int mbtk_tcpip_read(int link_id, char* buff, int buff_size)
+{
+    return 0;
+}
+
+/*
+* Get the data traffic of the specified link.
+*/
+int mbtk_tcpip_data_traffic_get(int link_id)
+{
+    return 0;
+}
+
+/*
+* Reset the data traffic of the specified link.
+*/
+mbtk_tcpip_err_enum mbtk_tcpip_data_traffic_reset(int link_id)
+{
+    return MBTK_TCPIP_ERR_SUCCESS;
+}
+
+/*
+* Return 0 if disconnected, other for connected.
+*/
+int mbtk_tcpip_link_state_get(int link_id)
+{
+    return 0;
+}
+