Core networking libraries including LwIP implementation

Dependencies:   DebugLib lwip_ppp_ethernet

Dependents:   EthernetNetworkLib

Committer:
donatien
Date:
Thu May 31 15:09:06 2012 +0000
Revision:
4:e60b65fed967
Parent:
1:240e3322b87a
Debuglib up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 1:240e3322b87a 1 /* IPInterface.h */
donatien 1:240e3322b87a 2 /*
donatien 1:240e3322b87a 3 Copyright (C) 2011 ARM Limited.
donatien 1:240e3322b87a 4
donatien 1:240e3322b87a 5 Permission is hereby granted, free of charge, to any person obtaining a copy of
donatien 1:240e3322b87a 6 this software and associated documentation files (the "Software"), to deal in
donatien 1:240e3322b87a 7 the Software without restriction, including without limitation the rights to
donatien 1:240e3322b87a 8 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
donatien 1:240e3322b87a 9 of the Software, and to permit persons to whom the Software is furnished to do
donatien 1:240e3322b87a 10 so, subject to the following conditions:
donatien 1:240e3322b87a 11
donatien 1:240e3322b87a 12 The above copyright notice and this permission notice shall be included in all
donatien 1:240e3322b87a 13 copies or substantial portions of the Software.
donatien 1:240e3322b87a 14
donatien 1:240e3322b87a 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
donatien 1:240e3322b87a 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
donatien 1:240e3322b87a 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
donatien 1:240e3322b87a 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
donatien 1:240e3322b87a 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 1:240e3322b87a 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
donatien 1:240e3322b87a 21 SOFTWARE.
donatien 1:240e3322b87a 22 */
donatien 1:240e3322b87a 23
donatien 1:240e3322b87a 24 #ifndef IPINTERFACE_H_
donatien 1:240e3322b87a 25 #define IPINTERFACE_H_
donatien 1:240e3322b87a 26
donatien 1:240e3322b87a 27 #include "core/fwk.h"
donatien 1:240e3322b87a 28
donatien 1:240e3322b87a 29 /** Generic IP-based network interface
donatien 1:240e3322b87a 30 *
donatien 1:240e3322b87a 31 */
donatien 1:240e3322b87a 32 class IPInterface
donatien 1:240e3322b87a 33 {
donatien 1:240e3322b87a 34 public:
donatien 1:240e3322b87a 35 IPInterface();
donatien 1:240e3322b87a 36 virtual ~IPInterface();
donatien 1:240e3322b87a 37
donatien 1:240e3322b87a 38 virtual int init() = 0; //Initialize interface; no connection should be performed at this stage
donatien 1:240e3322b87a 39 virtual int connect() = 0; //Do connect the interface
donatien 1:240e3322b87a 40 virtual int disconnect() = 0;
donatien 1:240e3322b87a 41 //It is encouraged that the derived class implement a "setup(...)" function to configure the interface before the connection
donatien 1:240e3322b87a 42
donatien 1:240e3322b87a 43 static IPInterface* getDefaultInterface(); //For use by TCP, UDP sockets library
donatien 1:240e3322b87a 44
donatien 1:240e3322b87a 45 //WARN: Implementation will have to be more careful in case of multiple interfaces (or implement a routing protocol based on local IP addresses differentiation)
donatien 1:240e3322b87a 46 void registerAsDefaultInterface(); //First come, first served
donatien 1:240e3322b87a 47 void unregisterAsDefaultInterface(); //Must be called before inst is destroyed to avoid invalid ptr fault
donatien 1:240e3322b87a 48
donatien 1:240e3322b87a 49 private:
donatien 1:240e3322b87a 50 static IPInterface* s_pDefaultInterface;
donatien 1:240e3322b87a 51 };
donatien 1:240e3322b87a 52
donatien 1:240e3322b87a 53 #endif /* IPINTERFACE_H_ */