00001 00002 00003 00016 00017 // Copyright (C) 1997-2010 by Pawel Pilarczyk. 00018 // 00019 // This file is part of the Homology Library. This library is free software; 00020 // you can redistribute it and/or modify it under the terms of the GNU 00021 // General Public License as published by the Free Software Foundation; 00022 // either version 2 of the License, or (at your option) any later version. 00023 // 00024 // This library is distributed in the hope that it will be useful, 00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00027 // GNU General Public License for more details. 00028 // 00029 // You should have received a copy of the GNU General Public License along 00030 // with this software; see the file "license.txt". If not, write to the 00031 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00032 // MA 02111-1307, USA. 00033 00034 // Started on August 11, 2004. Last revision: November 29, 2007. 00035 00036 00037 #ifndef _CHOMP_MULTIWORK_MWLOWLEV_H_ 00038 #define _CHOMP_MULTIWORK_MWLOWLEV_H_ 00039 00040 #include <string> 00041 00042 namespace chomp { 00043 namespace multiwork { 00044 00045 // -------------------------------------------------- 00046 // ---------- network communication flags ----------- 00047 // -------------------------------------------------- 00048 00052 enum mwIOconstants 00053 { 00055 mwNone = 0, 00056 00058 mwCanRead = 0x01, 00059 00061 mwCanWrite = 0x02, 00062 00064 mwTimeOut = -4, 00065 00067 mwLost = -5 00068 00069 }; /* enum mwIOconstants */ 00070 00071 00072 // -------------------------------------------------- 00073 // ------------- network communication -------------- 00074 // -------------------------------------------------- 00075 // The following functions are implemented 00076 // in a system-dependent way in the "mw_*.cpp" files 00077 // one of which (or all) must be linked with the program. 00078 00081 int mwSendBytes (int fd, const char *buf, int len); 00082 00085 int mwRecvBytes (int fd, char *buf, int len); 00086 00089 int mwConnect (const char *name, int port); 00090 00093 int mwListen (int port, int queuesize); 00094 00098 int mwAccept (int fd, std::string &computer, int timeout = -1); 00099 00104 int mwSelect (const int *workers, int nworkers, int listensocket, 00105 int *ioflags, int timeout); 00106 00109 void mwDisconnect (int fd); 00110 00111 00112 } // namespace multiwork 00113 } // namespace chomp 00114 00115 #endif // _CHOMP_MULTIWORK_MWLOWLEV_H_ 00116 00118