Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/features/netsocket/nsapi_ppp.h@0:4beb2ea291ec, 2020-03-16 (annotated)
- Committer:
- boro
- Date:
- Mon Mar 16 13:12:31 2020 +0000
- Revision:
- 0:4beb2ea291ec
a
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| boro | 0:4beb2ea291ec | 1 | /** \addtogroup netsocket */ |
| boro | 0:4beb2ea291ec | 2 | /** @{*/ |
| boro | 0:4beb2ea291ec | 3 | /* nsapi_ppp.h |
| boro | 0:4beb2ea291ec | 4 | * Modified work Copyright (c) 2017 ARM Limited |
| boro | 0:4beb2ea291ec | 5 | * |
| boro | 0:4beb2ea291ec | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| boro | 0:4beb2ea291ec | 7 | * you may not use this file except in compliance with the License. |
| boro | 0:4beb2ea291ec | 8 | * You may obtain a copy of the License at |
| boro | 0:4beb2ea291ec | 9 | * |
| boro | 0:4beb2ea291ec | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| boro | 0:4beb2ea291ec | 11 | * |
| boro | 0:4beb2ea291ec | 12 | * Unless required by applicable law or agreed to in writing, software |
| boro | 0:4beb2ea291ec | 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| boro | 0:4beb2ea291ec | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| boro | 0:4beb2ea291ec | 15 | * See the License for the specific language governing permissions and |
| boro | 0:4beb2ea291ec | 16 | * limitations under the License. |
| boro | 0:4beb2ea291ec | 17 | */ |
| boro | 0:4beb2ea291ec | 18 | #ifndef NSAPI_PPP_H_ |
| boro | 0:4beb2ea291ec | 19 | #define NSAPI_PPP_H_ |
| boro | 0:4beb2ea291ec | 20 | |
| boro | 0:4beb2ea291ec | 21 | #include "FileHandle.h" |
| boro | 0:4beb2ea291ec | 22 | #include "NetworkStack.h" |
| boro | 0:4beb2ea291ec | 23 | |
| boro | 0:4beb2ea291ec | 24 | namespace mbed { |
| boro | 0:4beb2ea291ec | 25 | |
| boro | 0:4beb2ea291ec | 26 | /** Provide access to the NetworkStack object |
| boro | 0:4beb2ea291ec | 27 | * |
| boro | 0:4beb2ea291ec | 28 | * @return The underlying NetworkStack object |
| boro | 0:4beb2ea291ec | 29 | */ |
| boro | 0:4beb2ea291ec | 30 | NetworkStack *nsapi_ppp_get_stack(); |
| boro | 0:4beb2ea291ec | 31 | |
| boro | 0:4beb2ea291ec | 32 | |
| boro | 0:4beb2ea291ec | 33 | /** Connect to a PPP pipe |
| boro | 0:4beb2ea291ec | 34 | * |
| boro | 0:4beb2ea291ec | 35 | * @param stream Pointer to a device type file handle (descriptor) |
| boro | 0:4beb2ea291ec | 36 | * @param status_cb Optional, user provided callback for connection status |
| boro | 0:4beb2ea291ec | 37 | * @param uname Optional, username for the connection |
| boro | 0:4beb2ea291ec | 38 | * @param pwd Optional, password for the connection |
| boro | 0:4beb2ea291ec | 39 | * @param stack Optional, stack for the connection |
| boro | 0:4beb2ea291ec | 40 | * |
| boro | 0:4beb2ea291ec | 41 | * @return 0 on success, negative error code on failure |
| boro | 0:4beb2ea291ec | 42 | */ |
| boro | 0:4beb2ea291ec | 43 | nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_error_t)> status_cb=0, const char *uname=0, const char *pwd=0, const nsapi_ip_stack_t stack=DEFAULT_STACK); |
| boro | 0:4beb2ea291ec | 44 | |
| boro | 0:4beb2ea291ec | 45 | /** Close a PPP connection |
| boro | 0:4beb2ea291ec | 46 | * |
| boro | 0:4beb2ea291ec | 47 | * @param stream Pointer to a device type file handle (descriptor) |
| boro | 0:4beb2ea291ec | 48 | * |
| boro | 0:4beb2ea291ec | 49 | * @return 0 on success, negative error code on failure |
| boro | 0:4beb2ea291ec | 50 | */ |
| boro | 0:4beb2ea291ec | 51 | nsapi_error_t nsapi_ppp_disconnect(FileHandle *stream); |
| boro | 0:4beb2ea291ec | 52 | |
| boro | 0:4beb2ea291ec | 53 | /** Get IP address |
| boro | 0:4beb2ea291ec | 54 | * |
| boro | 0:4beb2ea291ec | 55 | * After a successful connection, this API can be used to retrieve assigned IP address. |
| boro | 0:4beb2ea291ec | 56 | * |
| boro | 0:4beb2ea291ec | 57 | * @param stream Pointer to a device type file handle (descriptor) |
| boro | 0:4beb2ea291ec | 58 | * |
| boro | 0:4beb2ea291ec | 59 | * @return A string containing IP address or NULL |
| boro | 0:4beb2ea291ec | 60 | */ |
| boro | 0:4beb2ea291ec | 61 | const char *nsapi_ppp_get_ip_addr(FileHandle *stream); |
| boro | 0:4beb2ea291ec | 62 | |
| boro | 0:4beb2ea291ec | 63 | /** Get network mask |
| boro | 0:4beb2ea291ec | 64 | * |
| boro | 0:4beb2ea291ec | 65 | * After a successful connection, this API can be used to retrieve network mask |
| boro | 0:4beb2ea291ec | 66 | * in case of an IPv4 network. |
| boro | 0:4beb2ea291ec | 67 | * |
| boro | 0:4beb2ea291ec | 68 | * @param stream Pointer to a device type file handle (descriptor) |
| boro | 0:4beb2ea291ec | 69 | * |
| boro | 0:4beb2ea291ec | 70 | * @return A string containing network mask or NULL |
| boro | 0:4beb2ea291ec | 71 | */ |
| boro | 0:4beb2ea291ec | 72 | const char *nsapi_ppp_get_netmask(FileHandle *stream); |
| boro | 0:4beb2ea291ec | 73 | |
| boro | 0:4beb2ea291ec | 74 | /** Get gateway address |
| boro | 0:4beb2ea291ec | 75 | * |
| boro | 0:4beb2ea291ec | 76 | * After a successful connection, this API can be used to retrieve IP address |
| boro | 0:4beb2ea291ec | 77 | * of the default gateway in case of an IPv4 network. |
| boro | 0:4beb2ea291ec | 78 | * |
| boro | 0:4beb2ea291ec | 79 | * @param stream Pointer to a device type file handle (descriptor) |
| boro | 0:4beb2ea291ec | 80 | * |
| boro | 0:4beb2ea291ec | 81 | * @return A string containing gateway IP address or NULL |
| boro | 0:4beb2ea291ec | 82 | */ |
| boro | 0:4beb2ea291ec | 83 | const char *nsapi_ppp_get_gw_addr(FileHandle *stream); |
| boro | 0:4beb2ea291ec | 84 | |
| boro | 0:4beb2ea291ec | 85 | } //namespace mbed |
| boro | 0:4beb2ea291ec | 86 | |
| boro | 0:4beb2ea291ec | 87 | /** @} */ |
| boro | 0:4beb2ea291ec | 88 | |
| boro | 0:4beb2ea291ec | 89 | #endif /* NSAPI_PPP_H_ */ |