net.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  *  this is part of Spm
00004  *
00005  *  Copyright (c) 2005 Guillaume Chevallereau
00006  *
00007  *  This program is free software. You can redistribute it and/or modify it 
00008  *  under the terms of the GNU General Public License as published by the 
00009  *  Free Software Foundation. Either version 2 of the license or (at your 
00010  *  option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be usefull but WITHOUT
00013  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00014  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
00015  *  more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License along 
00018  *  with this program; if not, write to the Free Software Foundation, Inc., 
00019  *  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
00020  */
00021 #ifndef __NET_H__
00022 #define __NET_H__
00023 #include <util/utilException.h>
00024 #include <string>
00025 
00026 namespace Spm
00027 {
00028   namespace Util
00029   {
00030     
00031     class NetException : public Exception
00032     {
00033     public :
00034       NetException (const std::string & errMsg);
00035     };
00036     
00037     typedef struct
00038     {
00039       std::string service;
00040       std::string host;
00041       std::string pathToFile;
00042       std::string userName;
00043       std::string password;
00044       int port;
00045     }urlDetails;   
00046 
00053     int getSocket (const std::string & host,
00054                    int port)
00055       throw (NetException);
00056     
00061     void closeSocket (int & fdSocket);
00062 
00068     void sendTo (int fdSocket,
00069                  std::string & str)
00070       throw (NetException);
00071 
00078     char * recv(int fdSocket,
00079                 int & size)
00080       throw (NetException);
00081 
00087     urlDetails parseUrl (const std::string & url)
00088       throw (NetException);
00089 
00095     int getDefaultPortByService(const std::string & serviceName);
00096 
00102     bool isUrl (const std::string & str);
00103   }
00104 }
00105 #endif

Generated on Wed Jul 4 15:27:21 2007 for libSpm by  doxygen 1.4.6