Mistake on this page?
Report an issue in GitHub or email us
nsapi_ppp.h
1 /** \addtogroup netsocket */
2 /** @{*/
3 /* nsapi_ppp.h
4  * Modified work Copyright (c) 2017 ARM Limited
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef NSAPI_PPP_H_
19 #define NSAPI_PPP_H_
20 
21 #include "FileHandle.h"
22 #include "NetworkStack.h"
23 
24 namespace mbed {
25 
26 /** Provide access to the NetworkStack object
27  *
28  * @return The underlying NetworkStack object
29  */
30 NetworkStack *nsapi_ppp_get_stack();
31 
32 /** Set connection blocking parameter
33  *
34  * @param blocking True if connection is blocking
35  *
36  * @return 0 on success, negative error code on failure
37  */
38 nsapi_error_t nsapi_ppp_set_blocking(bool blocking);
39 
40 /** Connect to a PPP pipe
41  *
42  * @param stream Pointer to a device type file handle (descriptor)
43  * @param status_cb Optional, user provided callback for connection status
44  * @param uname Optional, username for the connection
45  * @param pwd Optional, password for the connection
46  * @param stack Optional, stack for the connection
47  *
48  * @return 0 on success, negative error code on failure
49  */
50 nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_event_t, intptr_t)> status_cb = 0, const char *uname = 0, const char *pwd = 0, const nsapi_ip_stack_t stack = DEFAULT_STACK);
51 
52 /** Close a PPP connection
53  *
54  * @param stream Pointer to a device type file handle (descriptor)
55  *
56  * @return 0 on success, negative error code on failure
57  */
58 nsapi_error_t nsapi_ppp_disconnect(FileHandle *stream);
59 
60 /** Get IP address
61  *
62  * After a successful connection, this API can be used to retrieve assigned IP address.
63  *
64  * @param stream Pointer to a device type file handle (descriptor)
65  *
66  * @return A string containing IP address or NULL
67  */
68 const char *nsapi_ppp_get_ip_addr(FileHandle *stream);
69 
70 /** Get network mask
71  *
72  * After a successful connection, this API can be used to retrieve network mask
73  * in case of an IPv4 network.
74  *
75  * @param stream Pointer to a device type file handle (descriptor)
76  *
77  * @return A string containing network mask or NULL
78  */
79 const char *nsapi_ppp_get_netmask(FileHandle *stream);
80 
81 /** Get gateway address
82  *
83  * After a successful connection, this API can be used to retrieve IP address
84  * of the default gateway in case of an IPv4 network.
85  *
86  * @param stream Pointer to a device type file handle (descriptor)
87  *
88  * @return A string containing gateway IP address or NULL
89  */
90 const char *nsapi_ppp_get_gw_addr(FileHandle *stream);
91 
92 } //namespace mbed
93 
94 /** @} */
95 
96 #endif /* NSAPI_PPP_H_ */
NetworkStack class.
Definition: NetworkStack.h:40
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
NetworkStack class.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.