Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / ip_adapter / arduino / caipadapterutils_eth.h
1 /******************************************************************
2 *
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
4 *
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ******************************************************************/
20
21 /**
22  * @file caethernetadapterutils.h
23  * @brief This file provides APIs ethernet client/server/network monitor modules
24  */
25
26 #ifndef CA_ETHERNET_ADAPTER_UTILS_
27 #define CA_ETHERNET_ADAPTER_UTILS_
28
29 #include <Arduino.h>
30 #include <Ethernet.h>
31 #include <socket.h>
32 #include <w5100.h>
33 #include <EthernetUdp.h>
34 #include <IPAddress.h>
35
36 #include "logger.h"
37 #include "cacommon.h"
38 #include "caadapterinterface.h"
39 #include "caipadapter.h"
40 #include "caadapterutils.h"
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 /**
48  * @brief Get available UDP socket
49  * @param   sockID      [OUT]   Available UDP socket ID
50  * @return  #CA_STATUS_OK or Appropriate error code
51  */
52 CAResult_t CAArduinoGetAvailableSocket(int *sockID);
53
54 /**
55  * @brief Initialize Unicast UDP socket
56  * @param   port        [INOUT] Port to start the unicast server
57  * @param   socketID    [OUT    Unicast socket ID
58  * @return  #CA_STATUS_OK or Appropriate error code
59  */
60 CAResult_t CAArduinoInitUdpSocket(uint16_t *port, int *socketID);
61
62 /**
63  * @brief Initialize Multicast UDP socket
64  * @param   mcastAddress    [IN]  Port to start the unicast server
65  * @param   mport           [IN]  Multicast port
66  * @param   lport           [IN]  Local port on which the server is started
67  * @param   socketID        [OUT] Multicast socket ID
68  * @return  #CA_STATUS_OK or Appropriate error code
69  */
70 CAResult_t CAArduinoInitMulticastUdpSocket(const char *mcastAddress,
71                                            uint16_t mport, uint16_t lport,
72                                            int *socketID);
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif /* CA_ETHERNET_ADAPTER_UTILS_ */
79
80