Core networking libraries including LwIP implementation
Dependencies: DebugLib lwip_ppp_ethernet
Dependents: EthernetNetworkLib
IPInterface.h
00001 /* IPInterface.h */ 00002 /* 00003 Copyright (C) 2011 ARM Limited. 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00009 of the Software, and to permit persons to whom the Software is furnished to do 00010 so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 SOFTWARE. 00022 */ 00023 00024 #ifndef IPINTERFACE_H_ 00025 #define IPINTERFACE_H_ 00026 00027 #include "core/fwk.h" 00028 00029 /** Generic IP-based network interface 00030 * 00031 */ 00032 class IPInterface 00033 { 00034 public: 00035 IPInterface(); 00036 virtual ~IPInterface(); 00037 00038 virtual int init() = 0; //Initialize interface; no connection should be performed at this stage 00039 virtual int connect() = 0; //Do connect the interface 00040 virtual int disconnect() = 0; 00041 //It is encouraged that the derived class implement a "setup(...)" function to configure the interface before the connection 00042 00043 static IPInterface* getDefaultInterface(); //For use by TCP, UDP sockets library 00044 00045 //WARN: Implementation will have to be more careful in case of multiple interfaces (or implement a routing protocol based on local IP addresses differentiation) 00046 void registerAsDefaultInterface(); //First come, first served 00047 void unregisterAsDefaultInterface(); //Must be called before inst is destroyed to avoid invalid ptr fault 00048 00049 private: 00050 static IPInterface* s_pDefaultInterface; 00051 }; 00052 00053 #endif /* IPINTERFACE_H_ */
Generated on Sun Jul 17 2022 01:35:55 by 1.7.2