Tizen RT Libs&Environment  v1.0 D5
dhcpc.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 /****************************************************************************
19  * apps/include/netutils/dhcpc.h
20  *
21  * Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved.
22  * Author: Gregory Nutt <gnutt@nuttx.org>
23  *
24  * This logic was leveraged from uIP which also has a BSD-style license:
25  *
26  * Copyright (c) 2005, Swedish Institute of Computer Science
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  *
33  * 1. Redistributions of source code must retain the above copyright
34  * notice, this list of conditions and the following disclaimer.
35  * 2. Redistributions in binary form must reproduce the above copyright
36  * notice, this list of conditions and the following disclaimer in the
37  * documentation and/or other materials provided with the distribution.
38  * 3. Neither the name of the Institute nor the names of its contributors
39  * may be used to endorse or promote products derived from this software
40  * without specific prior written permission.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
43  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
46  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52  * SUCH DAMAGE.
53  */
54 
66 #ifndef __APPS_INCLUDE_NETUTILS_DHCPC_H
67 #define __APPS_INCLUDE_NETUTILS_DHCPC_H
68 
69 /****************************************************************************
70  * Included Files
71  ****************************************************************************/
72 
73 #include <stdint.h>
74 #include <netinet/in.h>
75 
76 /****************************************************************************
77  * Pre-processor Definitions
78  ****************************************************************************/
79 
80 /****************************************************************************
81  * Public Types
82  ****************************************************************************/
83 
84 struct dhcpc_state {
85  struct in_addr serverid;
86  struct in_addr ipaddr;
87  struct in_addr netmask;
88  struct in_addr dnsaddr;
89  struct in_addr default_router;
90  uint32_t lease_time; /* Lease expires in this number of seconds */
91 };
92 
93 /****************************************************************************
94  * Public Function Prototypes
95  ****************************************************************************/
96 
97 #ifdef __cplusplus
98 // *INDENT-OFF*
99 #define EXTERN extern "C"
100 extern "C" {
101 #else
102 #define EXTERN extern
103 // *INDENT-ON*
104 #endif
105 
115 void *dhcpc_open(const char *intf);
116 
125 int dhcpc_request(void *handle, struct dhcpc_state *presult);
126 
134 void dhcpc_close(void *handle);
135 
136 #undef EXTERN
137 #ifdef __cplusplus
138 // *INDENT-OFF*
139 }
140 // *INDENT-ON*
141 #endif
142 
143 #endif /* __APPS_INCLUDE_NETUTILS_DHCPC_H */
144 
struct in_addr dnsaddr
Definition: dhcpc.h:88
void dhcpc_close(void *handle)
dhcpc_close() return dhcp client handle
struct in_addr serverid
Definition: dhcpc.h:85
void * dhcpc_open(const char *intf)
Get DHCP client handle.
struct in_addr default_router
Definition: dhcpc.h:89
uint32_t lease_time
Definition: dhcpc.h:90
struct in_addr ipaddr
Definition: dhcpc.h:86
struct in_addr netmask
Definition: dhcpc.h:87
int dhcpc_request(void *handle, struct dhcpc_state *presult)
Starts DHCP client.