Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ppp_lwip.h Source File

ppp_lwip.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2017 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef PPP_LWIP_H_
00017 #define PPP_LWIP_H_
00018 #include "netif/ppp/pppapi.h"
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 #if LWIP_PPP_API
00023 
00024 /** Initializes LWIP PPP interface
00025  *
00026  *  Starts a private thread for LWIP PPP and turns the PPP interface
00027  *  up.
00028  *
00029  *  @param netif  LWIP netif struct
00030  *
00031  *  @return 0 for success and negative error codes for failure
00032  */
00033 nsapi_error_t ppp_lwip_if_init(struct netif *netif, const nsapi_ip_stack_t stack);
00034 
00035 /** Connects to a PPP pipe
00036  *
00037  *  Called during LWIP interface bringup
00038  *
00039  *  @return 0 for success and negative error codes for failure
00040  */
00041 err_t ppp_lwip_connect(void);
00042 
00043 /** Disconnects from a PPP pipe
00044  *
00045  *  Can be called from multiple places. If LWIP bringup fails after initializing
00046  *  PPP interface, this API kicks in. Formal disconnection occurs when LWIP
00047  *  interface is brought down.
00048  *
00049  *  @return 0 for success and negative error codes for failure
00050  */
00051 err_t ppp_lwip_disconnect(void);
00052 #else
00053 /**
00054  * Stubs in case LWIP PPP is not enabled
00055  */
00056 #define ppp_lwip_if_init(netif, stack)     NSAPI_ERROR_UNSUPPORTED
00057 #define ppp_lwip_connect()                 ERR_IF
00058 #define ppp_lwip_disconnect()              ERR_IF
00059 #endif //LWIP_PPP_API
00060 #ifdef __cplusplus
00061 }
00062 #endif
00063 
00064 #endif /* PPP_LWIP_H_ */