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