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  * SPDX-License-Identifier: Apache-2.0
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 #ifndef NSAPI_PPP_H_
20 #define NSAPI_PPP_H_
21 
22 #include "FileHandle.h"
23 #include "NetworkStack.h"
24 
25 namespace mbed {
26 
27 /** Provide access to the NetworkStack object
28  *
29  * @return The underlying NetworkStack object
30  */
31 NetworkStack *nsapi_ppp_get_stack();
32 
33 /** Set connection blocking parameter
34  *
35  * @param blocking True if connection is blocking
36  *
37  * @return 0 on success, negative error code on failure
38  */
39 nsapi_error_t nsapi_ppp_set_blocking(bool blocking);
40 
41 /** Connect to a PPP pipe
42  *
43  * @param stream Pointer to a device type file handle (descriptor)
44  * @param status_cb Optional, user provided callback for connection status
45  * @param uname Optional, username for the connection
46  * @param pwd Optional, password for the connection
47  * @param stack Optional, stack for the connection
48  *
49  * @return 0 on success, negative error code on failure
50  */
51 nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_event_t, intptr_t)> status_cb = nullptr, const char *uname = 0, const char *pwd = 0, const nsapi_ip_stack_t stack = DEFAULT_STACK);
52 
53 /** Close a PPP connection
54  *
55  * @param stream Pointer to a device type file handle (descriptor)
56  *
57  * @return 0 on success, negative error code on failure
58  */
59 nsapi_error_t nsapi_ppp_disconnect(FileHandle *stream);
60 
61 /** Get IP address
62  *
63  * After a successful connection, this API can be used to retrieve assigned IP address.
64  *
65  * @param stream Pointer to a device type file handle (descriptor)
66  *
67  * @return A string containing IP address or NULL
68  */
69 const char *nsapi_ppp_get_ip_addr(FileHandle *stream);
70 
71 /** Get network mask
72  *
73  * After a successful connection, this API can be used to retrieve network mask
74  * in case of an IPv4 network.
75  *
76  * @param stream Pointer to a device type file handle (descriptor)
77  *
78  * @return A string containing network mask or NULL
79  */
80 const char *nsapi_ppp_get_netmask(FileHandle *stream);
81 
82 /** Get gateway address
83  *
84  * After a successful connection, this API can be used to retrieve IP address
85  * of the default gateway in case of an IPv4 network.
86  *
87  * @param stream Pointer to a device type file handle (descriptor)
88  *
89  * @return A string containing gateway IP address or NULL
90  */
91 const char *nsapi_ppp_get_gw_addr(FileHandle *stream);
92 
93 } //namespace mbed
94 
95 /** @} */
96 
97 #endif /* NSAPI_PPP_H_ */
NetworkStack class.
Definition: NetworkStack.h:42
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:142
NetworkStack class.
Definition: ATHandler.h:46
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.