BA
/
BaBoRo1
Embed:
(wiki syntax)
Show/hide line numbers
nsapi_ppp.h
00001 /** \addtogroup netsocket */ 00002 /** @{*/ 00003 /* nsapi_ppp.h 00004 * Modified work Copyright (c) 2017 ARM Limited 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #ifndef NSAPI_PPP_H_ 00019 #define NSAPI_PPP_H_ 00020 00021 #include "FileHandle.h" 00022 #include "NetworkStack.h" 00023 00024 namespace mbed { 00025 00026 /** Provide access to the NetworkStack object 00027 * 00028 * @return The underlying NetworkStack object 00029 */ 00030 NetworkStack *nsapi_ppp_get_stack(); 00031 00032 /** Set connection blocking parameter 00033 * 00034 * @param blocking True if connection is blocking 00035 * 00036 * @return 0 on success, negative error code on failure 00037 */ 00038 nsapi_error_t nsapi_ppp_set_blocking(bool blocking); 00039 00040 /** Connect to a PPP pipe 00041 * 00042 * @param stream Pointer to a device type file handle (descriptor) 00043 * @param status_cb Optional, user provided callback for connection status 00044 * @param uname Optional, username for the connection 00045 * @param pwd Optional, password for the connection 00046 * @param stack Optional, stack for the connection 00047 * 00048 * @return 0 on success, negative error code on failure 00049 */ 00050 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); 00051 00052 /** Close a PPP connection 00053 * 00054 * @param stream Pointer to a device type file handle (descriptor) 00055 * 00056 * @return 0 on success, negative error code on failure 00057 */ 00058 nsapi_error_t nsapi_ppp_disconnect(FileHandle *stream); 00059 00060 /** Get IP address 00061 * 00062 * After a successful connection, this API can be used to retrieve assigned IP address. 00063 * 00064 * @param stream Pointer to a device type file handle (descriptor) 00065 * 00066 * @return A string containing IP address or NULL 00067 */ 00068 const char *nsapi_ppp_get_ip_addr(FileHandle *stream); 00069 00070 /** Get network mask 00071 * 00072 * After a successful connection, this API can be used to retrieve network mask 00073 * in case of an IPv4 network. 00074 * 00075 * @param stream Pointer to a device type file handle (descriptor) 00076 * 00077 * @return A string containing network mask or NULL 00078 */ 00079 const char *nsapi_ppp_get_netmask(FileHandle *stream); 00080 00081 /** Get gateway address 00082 * 00083 * After a successful connection, this API can be used to retrieve IP address 00084 * of the default gateway in case of an IPv4 network. 00085 * 00086 * @param stream Pointer to a device type file handle (descriptor) 00087 * 00088 * @return A string containing gateway IP address or NULL 00089 */ 00090 const char *nsapi_ppp_get_gw_addr(FileHandle *stream); 00091 00092 } //namespace mbed 00093 00094 /** @} */ 00095 00096 #endif /* NSAPI_PPP_H_ */
Generated on Tue Jul 12 2022 12:22:16 by
