Dmitry Pakhomenko / VodafoneUSBModem

Dependencies:   Socket USBHostWANDongle lwip-sys lwip

Fork of VodafoneUSBModem by mbed official

Committer:
donatien
Date:
Fri Jun 08 13:30:06 2012 +0000
Revision:
7:2069ba77b6b8
Parent:
0:3b2f052c333b
Fork / New libraries arch

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:3b2f052c333b 1 /* PPPIPInterface.h */
donatien 0:3b2f052c333b 2 /*
donatien 0:3b2f052c333b 3 Copyright (C) 2012 ARM Limited.
donatien 0:3b2f052c333b 4
donatien 0:3b2f052c333b 5 Permission is hereby granted, free of charge, to any person obtaining a copy of
donatien 0:3b2f052c333b 6 this software and associated documentation files (the "Software"), to deal in
donatien 0:3b2f052c333b 7 the Software without restriction, including without limitation the rights to
donatien 0:3b2f052c333b 8 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
donatien 0:3b2f052c333b 9 of the Software, and to permit persons to whom the Software is furnished to do
donatien 0:3b2f052c333b 10 so, subject to the following conditions:
donatien 0:3b2f052c333b 11
donatien 0:3b2f052c333b 12 The above copyright notice and this permission notice shall be included in all
donatien 0:3b2f052c333b 13 copies or substantial portions of the Software.
donatien 0:3b2f052c333b 14
donatien 0:3b2f052c333b 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
donatien 0:3b2f052c333b 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
donatien 0:3b2f052c333b 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
donatien 0:3b2f052c333b 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
donatien 0:3b2f052c333b 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 0:3b2f052c333b 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
donatien 0:3b2f052c333b 21 SOFTWARE.
donatien 0:3b2f052c333b 22 */
donatien 0:3b2f052c333b 23
donatien 0:3b2f052c333b 24 #ifndef PPPIPINTERFACE_H_
donatien 0:3b2f052c333b 25 #define PPPIPINTERFACE_H_
donatien 0:3b2f052c333b 26
donatien 0:3b2f052c333b 27 #include "core/fwk.h"
donatien 0:3b2f052c333b 28
donatien 0:3b2f052c333b 29 #include "LwIPInterface.h"
donatien 0:3b2f052c333b 30
donatien 0:3b2f052c333b 31 #include "lwip/sio.h"
donatien 0:3b2f052c333b 32
donatien 0:3b2f052c333b 33 namespace rtos {
donatien 0:3b2f052c333b 34 class Semaphore;
donatien 0:3b2f052c333b 35 }
donatien 0:3b2f052c333b 36 using namespace rtos;
donatien 0:3b2f052c333b 37
donatien 0:3b2f052c333b 38 /** Interface using PPP to connect to an IP-based network
donatien 0:3b2f052c333b 39 *
donatien 0:3b2f052c333b 40 */
donatien 0:3b2f052c333b 41 class PPPIPInterface : public LwIPInterface
donatien 0:3b2f052c333b 42 {
donatien 0:3b2f052c333b 43 public:
donatien 0:3b2f052c333b 44 PPPIPInterface(IOStream* pStream);
donatien 0:3b2f052c333b 45 virtual ~PPPIPInterface();
donatien 0:3b2f052c333b 46
donatien 0:3b2f052c333b 47 virtual int init(); //Init PPP-specific stuff, create the right bindings, etc
donatien 0:3b2f052c333b 48 int setup(const char* user, const char* pw); //Setup authentication
donatien 0:3b2f052c333b 49 virtual int connect();
donatien 0:3b2f052c333b 50 virtual int disconnect();
donatien 0:3b2f052c333b 51
donatien 0:3b2f052c333b 52 private:
donatien 0:3b2f052c333b 53 static void linkStatusCb(void *ctx, int errCode, void *arg); //PPP link status
donatien 0:3b2f052c333b 54 Semaphore m_linkStatusSphre;
donatien 0:3b2f052c333b 55 int m_pppErrCode;
donatien 0:3b2f052c333b 56
donatien 0:3b2f052c333b 57 IOStream* m_pStream; //Serial stream
donatien 0:3b2f052c333b 58 bool m_streamAvail;
donatien 0:3b2f052c333b 59
donatien 0:3b2f052c333b 60 int m_pppd;
donatien 0:3b2f052c333b 61
donatien 0:3b2f052c333b 62 friend u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
donatien 0:3b2f052c333b 63 friend u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
donatien 0:3b2f052c333b 64 friend void sio_read_abort(sio_fd_t fd);
donatien 0:3b2f052c333b 65 };
donatien 0:3b2f052c333b 66
donatien 0:3b2f052c333b 67 #endif /* PPPIPINTERFACE_H_ */