Committer:
zoot661
Date:
Tue May 29 09:49:18 2012 +0000
Revision:
0:f993b6d8b1d8

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zoot661 0:f993b6d8b1d8 1
zoot661 0:f993b6d8b1d8 2 /*
zoot661 0:f993b6d8b1d8 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
zoot661 0:f993b6d8b1d8 4
zoot661 0:f993b6d8b1d8 5 Permission is hereby granted, free of charge, to any person obtaining a copy
zoot661 0:f993b6d8b1d8 6 of this software and associated documentation files (the "Software"), to deal
zoot661 0:f993b6d8b1d8 7 in the Software without restriction, including without limitation the rights
zoot661 0:f993b6d8b1d8 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
zoot661 0:f993b6d8b1d8 9 copies of the Software, and to permit persons to whom the Software is
zoot661 0:f993b6d8b1d8 10 furnished to do so, subject to the following conditions:
zoot661 0:f993b6d8b1d8 11
zoot661 0:f993b6d8b1d8 12 The above copyright notice and this permission notice shall be included in
zoot661 0:f993b6d8b1d8 13 all copies or substantial portions of the Software.
zoot661 0:f993b6d8b1d8 14
zoot661 0:f993b6d8b1d8 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
zoot661 0:f993b6d8b1d8 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
zoot661 0:f993b6d8b1d8 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
zoot661 0:f993b6d8b1d8 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
zoot661 0:f993b6d8b1d8 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
zoot661 0:f993b6d8b1d8 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
zoot661 0:f993b6d8b1d8 21 THE SOFTWARE.
zoot661 0:f993b6d8b1d8 22 */
zoot661 0:f993b6d8b1d8 23
zoot661 0:f993b6d8b1d8 24 #ifndef NETIF_H
zoot661 0:f993b6d8b1d8 25 #define NETIF_H
zoot661 0:f993b6d8b1d8 26
zoot661 0:f993b6d8b1d8 27 #include "core/ipaddr.h"
zoot661 0:f993b6d8b1d8 28 /*
zoot661 0:f993b6d8b1d8 29 #include "nettcpsocket.h"
zoot661 0:f993b6d8b1d8 30 #include "netudpsocket.h"
zoot661 0:f993b6d8b1d8 31 #include "netdnsrequest.h"
zoot661 0:f993b6d8b1d8 32 */
zoot661 0:f993b6d8b1d8 33 class NetTcpSocket;
zoot661 0:f993b6d8b1d8 34 class NetUdpSocket;
zoot661 0:f993b6d8b1d8 35 class NetDnsRequest;
zoot661 0:f993b6d8b1d8 36
zoot661 0:f993b6d8b1d8 37 #if 0
zoot661 0:f993b6d8b1d8 38 enum NetifEvent
zoot661 0:f993b6d8b1d8 39 {
zoot661 0:f993b6d8b1d8 40 NETIF_CONNECTED, //Connected, can create & use sockets now
zoot661 0:f993b6d8b1d8 41 NETIF_DNSREPLY,
zoot661 0:f993b6d8b1d8 42 NETIF_DISCONNECTED
zoot661 0:f993b6d8b1d8 43 };
zoot661 0:f993b6d8b1d8 44 #endif
zoot661 0:f993b6d8b1d8 45
zoot661 0:f993b6d8b1d8 46 class NetIf
zoot661 0:f993b6d8b1d8 47 {
zoot661 0:f993b6d8b1d8 48 public:
zoot661 0:f993b6d8b1d8 49 NetIf();
zoot661 0:f993b6d8b1d8 50 virtual ~NetIf();
zoot661 0:f993b6d8b1d8 51 virtual NetTcpSocket* tcpSocket() = 0; //Create a new tcp socket
zoot661 0:f993b6d8b1d8 52 virtual NetUdpSocket* udpSocket() = 0; //Create a new udp socket
zoot661 0:f993b6d8b1d8 53 virtual void poll() = 0;
zoot661 0:f993b6d8b1d8 54 virtual NetDnsRequest* dnsRequest(const char* hostname) = 0; //Create a new NetDnsRequest object
zoot661 0:f993b6d8b1d8 55 virtual NetDnsRequest* dnsRequest(Host* pHost) = 0; //Create a new NetDnsRequest object
zoot661 0:f993b6d8b1d8 56
zoot661 0:f993b6d8b1d8 57 //!Returns the IP of the interface once it's connected
zoot661 0:f993b6d8b1d8 58 IpAddr getIp() const;
zoot661 0:f993b6d8b1d8 59
zoot661 0:f993b6d8b1d8 60 protected:
zoot661 0:f993b6d8b1d8 61 IpAddr m_ip;
zoot661 0:f993b6d8b1d8 62 };
zoot661 0:f993b6d8b1d8 63
zoot661 0:f993b6d8b1d8 64 #endif