src/include/palm/http/Sock.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef INCL_SOCK
00020 #define INCL_SOCK
00021 
00023 #include "base/fscapi.h"
00024 #include "base/constants.h"
00025 
00026 
00027 class Sock {
00028     public:
00029         // costruttore e distruttore
00030         Sock(unsigned long maxMsgSize = MAX_MSG_SIZE) EXTRA_SECTION_03;
00031         ~Sock() EXTRA_SECTION_03;
00032 
00033         // gestione tempi
00034         void setTimeout(UInt16) EXTRA_SECTION_03;
00035         UInt16 getTimeout() EXTRA_SECTION_03;
00036         UInt16 getTicks() EXTRA_SECTION_03;
00037 
00038         // gestione NetLibrary
00039         Err findLibrary() EXTRA_SECTION_03;
00040         Err openNetLibrary() EXTRA_SECTION_03;
00041         Err closeNetLibrary() EXTRA_SECTION_03;
00042 
00043         // gestione apertura e chiusura del socket
00044         Err open() EXTRA_SECTION_03;
00045         Err close() EXTRA_SECTION_03;
00046 
00047         // gestione connessione e disconnessione del socket
00048         Err connect(char* ipAddr,UInt16 port) EXTRA_SECTION_03;
00049         Err disconnect() EXTRA_SECTION_03;
00050 
00051         // gestione invio e ricezione dati
00052         Err sendData(char* String) EXTRA_SECTION_03;
00053         Err receiveData() EXTRA_SECTION_03;
00054 
00055         // gestione dati ricevuti
00056         const char* getContent() EXTRA_SECTION_03;
00057         UInt16 getContentLength() EXTRA_SECTION_03;
00058 
00059     private:
00060 
00061         NetSocketAddrINType* addr;
00062         UInt16 netRefnum;
00063         NetSocketRef socketRef;
00064         Int32 AppNetTimeout;
00065         Int32 timeOut;
00066 
00067         char* content;
00068         unsigned long contentLength;
00069         unsigned long maxMsgSize;
00070 
00071         Boolean isDotted(char* hostName) EXTRA_SECTION_03;
00072 };
00073 
00074 
00075 NetIPAddr GetIPAddress(Char* hostName,UInt16 netRefNum,Int32 timeOut);
00076 
00077 
00079 #endif

Generated on Fri Apr 27 12:29:19 2007 for Funambol C++ Client Library by  doxygen 1.5.2