FdIOClient.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 
00018 #ifndef _OASYS_FD_IOCLIENT_H_
00019 #define _OASYS_FD_IOCLIENT_H_
00020 
00021 #include "IOClient.h"
00022 #include "../debug/Logger.h"
00023 #include "../thread/Notifier.h"
00024 
00025 namespace oasys {
00026 
00030 class FdIOClient : public IOClient, public Logger {
00031 public:
00034     FdIOClient(int fd, Notifier* intr = 0);
00035 
00037     void set_fd(int fd) { fd_ = fd; }
00038 
00040     int fd() { return fd_; }
00041 
00043     virtual int read(char* bp, size_t len);
00044     virtual int readv(const struct iovec* iov, int iovcnt);
00045     virtual int write(const char* bp, size_t len);
00046     virtual int writev(const struct iovec* iov, int iovcnt);
00047 
00048     virtual int readall(char* bp, size_t len);
00049     virtual int writeall(const char* bp, size_t len);
00050     virtual int readvall(const struct iovec* iov, int iovcnt);
00051     virtual int writevall(const struct iovec* iov, int iovcnt);
00052     
00053     virtual int timeout_read(char* bp, size_t len, int timeout_ms);
00054     virtual int timeout_readv(const struct iovec* iov, int iovcnt,
00055                               int timeout_ms);
00056     virtual int timeout_readall(char* bp, size_t len, int timeout_ms);
00057     virtual int timeout_readvall(const struct iovec* iov, int iovcnt,
00058                                  int timeout_ms);
00059 
00060     virtual int timeout_write(const char* bp, size_t len, int timeout_ms);
00061     virtual int timeout_writev(const struct iovec* iov, int iovcnt,
00062                                int timeout_ms);
00063     virtual int timeout_writeall(const char* bp, size_t len, int timeout_ms);
00064     virtual int timeout_writevall(const struct iovec* iov, int iovcnt,
00065                                   int timeout_ms);
00066 
00067     virtual int get_nonblocking(bool* nonblockingp);
00068     virtual int set_nonblocking(bool nonblocking);
00070 
00071 protected:
00072     int       fd_;
00073 };
00074 
00075 } // namespace oasys
00076 
00077 #endif /* _OASYS_FD_IOCLIENT_H_ */

Generated on Sat Sep 8 08:43:27 2007 for DTN Reference Implementation by  doxygen 1.5.3