The beta version of the Vodafone K3770 dongle driver
This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/
NetworkingCoreLib/main/if/IPInterface.h@0:0ac66acdfdc0, 2012-05-31 (annotated)
- Committer:
- donatien
- Date:
- Thu May 31 15:32:49 2012 +0000
- Revision:
- 0:0ac66acdfdc0
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:0ac66acdfdc0 | 1 | /* IPInterface.h */ |
donatien | 0:0ac66acdfdc0 | 2 | /* |
donatien | 0:0ac66acdfdc0 | 3 | Copyright (C) 2011 ARM Limited. |
donatien | 0:0ac66acdfdc0 | 4 | |
donatien | 0:0ac66acdfdc0 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 0:0ac66acdfdc0 | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 0:0ac66acdfdc0 | 7 | the Software without restriction, including without limitation the rights to |
donatien | 0:0ac66acdfdc0 | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 0:0ac66acdfdc0 | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 0:0ac66acdfdc0 | 10 | so, subject to the following conditions: |
donatien | 0:0ac66acdfdc0 | 11 | |
donatien | 0:0ac66acdfdc0 | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 0:0ac66acdfdc0 | 13 | copies or substantial portions of the Software. |
donatien | 0:0ac66acdfdc0 | 14 | |
donatien | 0:0ac66acdfdc0 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:0ac66acdfdc0 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:0ac66acdfdc0 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:0ac66acdfdc0 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:0ac66acdfdc0 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:0ac66acdfdc0 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 0:0ac66acdfdc0 | 21 | SOFTWARE. |
donatien | 0:0ac66acdfdc0 | 22 | */ |
donatien | 0:0ac66acdfdc0 | 23 | |
donatien | 0:0ac66acdfdc0 | 24 | #ifndef IPINTERFACE_H_ |
donatien | 0:0ac66acdfdc0 | 25 | #define IPINTERFACE_H_ |
donatien | 0:0ac66acdfdc0 | 26 | |
donatien | 0:0ac66acdfdc0 | 27 | #include "core/fwk.h" |
donatien | 0:0ac66acdfdc0 | 28 | |
donatien | 0:0ac66acdfdc0 | 29 | /** Generic IP-based network interface |
donatien | 0:0ac66acdfdc0 | 30 | * |
donatien | 0:0ac66acdfdc0 | 31 | */ |
donatien | 0:0ac66acdfdc0 | 32 | class IPInterface |
donatien | 0:0ac66acdfdc0 | 33 | { |
donatien | 0:0ac66acdfdc0 | 34 | public: |
donatien | 0:0ac66acdfdc0 | 35 | IPInterface(); |
donatien | 0:0ac66acdfdc0 | 36 | virtual ~IPInterface(); |
donatien | 0:0ac66acdfdc0 | 37 | |
donatien | 0:0ac66acdfdc0 | 38 | virtual int init() = 0; //Initialize interface; no connection should be performed at this stage |
donatien | 0:0ac66acdfdc0 | 39 | virtual int connect() = 0; //Do connect the interface |
donatien | 0:0ac66acdfdc0 | 40 | virtual int disconnect() = 0; |
donatien | 0:0ac66acdfdc0 | 41 | //It is encouraged that the derived class implement a "setup(...)" function to configure the interface before the connection |
donatien | 0:0ac66acdfdc0 | 42 | |
donatien | 0:0ac66acdfdc0 | 43 | static IPInterface* getDefaultInterface(); //For use by TCP, UDP sockets library |
donatien | 0:0ac66acdfdc0 | 44 | |
donatien | 0:0ac66acdfdc0 | 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 | 0:0ac66acdfdc0 | 46 | void registerAsDefaultInterface(); //First come, first served |
donatien | 0:0ac66acdfdc0 | 47 | void unregisterAsDefaultInterface(); //Must be called before inst is destroyed to avoid invalid ptr fault |
donatien | 0:0ac66acdfdc0 | 48 | |
donatien | 0:0ac66acdfdc0 | 49 | private: |
donatien | 0:0ac66acdfdc0 | 50 | static IPInterface* s_pDefaultInterface; |
donatien | 0:0ac66acdfdc0 | 51 | }; |
donatien | 0:0ac66acdfdc0 | 52 | |
donatien | 0:0ac66acdfdc0 | 53 | #endif /* IPINTERFACE_H_ */ |