Committer:
borlanic
Date:
Fri Mar 30 14:07:05 2018 +0000
Revision:
4:75df35ef4fb6
Parent:
0:380207fcb5c1
commentar

Who changed what in which revision?

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