Add getting global ipaddr function
[platform/core/api/thread.git] / include / thread-socket-handler.h
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #ifndef __TIZEN_CAPI_NETWORK_THREAD_SOCKET_HANDLER_H__
19 #define __TIZEN_CAPI_NETWORK_THREAD_SOCKET_HANDLER_H__
20
21 #include <sys/socket.h>
22 #include <sys/un.h>
23 #include <stdio.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define THREAD_SOCKET_INTERFACE "wpan0"
30
31 #define THREAD_SOCKET_LOG_CMD "log level %d"
32 #define THREAD_SOCKET_START_CMD "thread start"
33 #define THREAD_SOCKET_STOP_CMD "thread stop"
34 #define THREAD_IFCONFIG_UP_CMD "ifconfig up"
35 #define THREAD_COMMISSIONER_START_CMD "commissioner start"
36 #define THREAD_BR_ENABLE_CMD "br enable"
37 #define THREAD_BR_DISABLE_CMD "br disable"
38 #define THREAD_NETDATA_REGISTER_CMD "netdata register"
39 #define THREAD_SRP_SERVER_START_CMD "srp server enable"
40 #define THREAD_SRP_SERVER_STOP_CMD "srp server disable"
41 #define THREAD_SRP_SERVER_SERVICE_CMD "srp server service"
42 #define THREAD_SRP_CLIENT_REGISTER_SERVICE_CMD "srp client service add"
43 #define THREAD_SRP_CLIENT_REMOVE_SERVICE_CMD "srp client service remove"
44 #define THREAD_SRP_CLIENT_SET_HOST_ADDRESS_CMD "srp client host address"
45 #define THREAD_SRP_CLIENT_SET_HOST_NAME_CMD "srp client host name"
46 #define THREAD_SRP_CLIENT_REMOVE_HOST_CMD "srp client host remove"
47 #define THREAD_SRP_CLIENT_STOP_CMD "srp client stop"
48 #define THREAD_SRP_CLIENT_START_CMD "srp client autostart enable"
49 #define THREAD_IPADDR_V "ipaddr -v"
50
51 int _thread_socket_client_init(int *session_fd, const char *if_name);
52
53 int _thread_socket_client_deinit(int session_fd);
54
55 int _thread_socket_client_connect(void);
56
57 int _thread_socket_client_execute(int session_fd, const char *cmd_buffer, size_t buf_size);
58
59 int _thread_socket_client_read(int session_fd, char *response_buffer);
60
61 int _thread_socket_client_write(int session_fd, const char *request_buffer, size_t buf_size);
62
63 #ifdef __cplusplus
64 }
65 #endif
66 #endif /* __TIZEN_CAPI_NETWORK_THREAD_SOCKET_HANDLER_H__ */