文件(设备)处理相关类
Method | Description |
int control (int cmd, void *) const | Interface for ioctl. ACE_OS:: ioctl(HANDLE, cmd, arg). More refer to the ioctl function in Unix programming. |
int enable (int value) const | Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the value. |
int disable (int value) const | Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the value. Reimplemented in ACE_DEV, and ACE_FILE. |
ACE_HANDLE get_handle (void) const | Get the underlying handle.(This Class has member : _handle) |
void set_handle (ACE_HANDLE handle) | Set the underlying handle. |
oid dump (void) const | Dump the state of an object. Reimplemented in ACE_DEV, ACE_DEV_IO, ACE_FILE, and ACE_FILE_IO. |
Member | Description |
+ACE_HANDLE ACE_IO_SAP::handle_ | Underlying I/O handle. |
+pid_t ACE_IO_SAP::pid_ = 0 static | Cache the process ID. |
Method | Description |
int close (void) | Close the ACE_FILE handle without removing the ACE_FILE from the file system. |
int remove (void) | Close and remove the ACE_FILE from the file system. |
int unlink (void) | Remove the ACE_FILE from the file system without closing the ACE_FILE handle. |
int get_info (ACE_FILE_Info *finfo) int get_info(ACE_FILE_Info &finfo) | Get information on this ACE_FILE. |
int truncate (ACE_OFF_T length) | Set filesize to length byte. ACE_OFF_T: off_t(偏移量) |
ACE_OFF_T seek (ACE_OFF_T offset, int whence=SEEK_CUR) | Sets the file pointer as follows: If <whence> is <SEEK_SET>, the pointer is set to <offset> bytes. If <whence> is <SEEK_CUR>, the pointer is set to its current location plus <offset>. If <whence> is <SEEK_END>, the pointer is set to the size of the file plus offset. |
ACE_OFF_T tell (void) | Return an offset for the file handle. |
int disable (int signum) const | Disable signal signum. This is here to prevent Win32 from disabling SPIPE using socket calls |
int get_local_addr (ACE_Addr &) const | Return the local endpoint address in the referenced ACE_Addr. Returns 0 if successful, else -1. |
int get_remote_addr (ACE_Addr &) const | Return the same thing as get_local_addr(). |
Member | Description |
ACE_FILE_Addr addr_ | File we are "connected" with |
Method | Description |
ssize_t send (const void *buf, size_t n) const | send upto n bytes in buf. |
ssize_t recv (void *buf, size_t n) const | Recv upto n bytes in buf. |
ssize_t send_n (const void *buf, size_t n) const | Send n bytes, keep trying until n are sent. |
ssize_t send_n( const ACE_Message_Block *message_block, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) | Send all the <message_block>s chained through their <next> and <cont> pointers. This call uses the underlying OS gather-write operation to reduce the domain-crossing penalty. |
ssize_t recv_n(void *buf, size_t n) const | Recv n bytes, keep trying until n are received. |
ssize_t send (const iovec iov[], int n) const | Send iovecs via <ACE_OS::writev>. |
ssize_t recv (iovec iov[], int n) const | Recv iovecs via < ACE_OS::readv>. |
ssize_t send (size_t n,...) const | Send N char *ptrs and int lengths. Note that the char *'s precede the ints (basically, an varargs version of writev). The count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! |
ssize_t recv (size_t n,...) const | This is an interface to readv, that doesn't use the struct iovec explicitly. The ... can be passed as an arbitrary number of (char *ptr, int len) tuples. However, the count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! |
ssize_t send(const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | Send n bytes via Win32 WriteFile using overlapped I/O. typedef OVERLAPPED ACE_OVERLAPPED. |
ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | Recv n bytes via Win32 ReadFile using overlapped I/O. |
ssize_t sendv (const iovec iov[], int n) const | Send an <iovec> of size n to the file. Same with send(iovec,int) |
ssize_t recvv (iovec *io_vec) | Allows a client to read from a file without having to provide a buffer to read. This method determines how much data is in the file, allocates a buffer of this size, reads in the data, and returns the number of bytes read. The caller is responsible for deleting the member in the <iov_base> field of <io_vec> using delete [] io_vec->iov_base. |
ssize_t sendv_n (const iovec iov[], int n) const | Send an <iovec> of size n to the file. Will block until all bytes are sent or an error occurs |
ssize_t recvv_n (iovec iov[], int n) const | Receive an <iovec> of size n to the file |
Member | Description |
typedef ACE_FILE_Addr PEER_ADDR |
|
Method |
int close (void) |
void dump (void) const |
int disable (int signum) const |
Method | Description |
ssize_t send (const void *buf, size_t n) const | send upto n bytes in buf. |
ssize_t recv (void *buf, size_t n) const | Recv upto n bytes in buf. |
ssize_t send_n (const void *buf, size_t n) const | Send n bytes, keep trying until n are sent. |
ssize_t recv_n (void *buf, size_t n, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const | Recv n bytes. |
ssize_t send (const iovec iov[], int n) const | Send iovecs via <ACE_OS::writev>. |
ssize_t recv (iovec iov[], int n) const | Recv iovecs via < ACE_OS::readv>. |
ssize_t send (size_t n,...) const | Send N char *ptrs and int lengths. Note that the char *'s precede the ints (basically, an varargs version of writev). The count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! |
ssize_t recv (size_t n,...) const | This is an interface to readv, that doesn't use the struct iovec explicitly. The ... can be passed as an arbitrary number of (char *ptr, int len) tuples. However, the count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs! |
ssize_t send(const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | Send n bytes via Win32 WriteFile using overlapped I/O. typedef OVERLAPPED ACE_OVERLAPPED. |
ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const | Recv n bytes via Win32 ReadFile using overlapped I/O. |
int get_local_addr (ACE_DEV_Addr &) const | Return the local endpoint address. |
int get_remote_addr(ACE_DEV_Addr&) const | Return the address of the remotely connected peer (if there is one). |
Member | Description |
typedef ACE_FILE_Addr PEER_ADDR | Address of device we are connected to. |
Class definitions for platform specific TTY features.
This class represents an example interface for a specific device (a serial line). It extends the capability of the underlying DEV_IO class by adding a control method that takes a special structure (Serial_Params) as argument to allow a comfortable user interface (away from that annoying termios structure, which is very specific to UNIX).
Method | Description |
ACE_FILE_Addr(const ACE_FILE_Addr &sa) | Copy constructor. |
ACE_FILE_Addr (const ACE_TCHAR *filename) | Create a ACE_FILE_Addr from a pathname. |
int set (const ACE_FILE_Addr &sa) | Acts like a copy constructor. If <sa> == ACE_Addr::sap_any then create a temporary filename using <ACE_OS::mktemp>. |
int set (const ACE_TCHAR *filename) | Create a ACE_FILE_Addr from a pathname. |
ACE_FILE_Addr & operator= ( const ACE_FILE_Addr &) | Assignment operator. |
virtual void * get_addr (void) const | Return a pointer to the address. |
virtual int addr_to_string ( ACE_TCHAR *addr, size_t) const | Transform the current address into string format. |
bool operator==( const ACE_FILE_Addr &SAP) const | Compare two addresses for equality. |
bool operator!=( const ACE_FILE_Addr &SAP) const | Compare two addresses for inequality. |
const ACE_TCHAR * get_path_name (void) const | Return the path name used for the rendezvous point. |
Member | Description |
ACE_TCHAR filename_ [MAXPATHLEN+1] | Name of the file |
w ACE_DEV_Addr
Method | Description |
ACE_DEV_Addr (const ACE_DEV_Addr &sa) | Copy constructor. |
ACE_DEV_Addr (const ACE_TCHAR *devname) | Create a ACE_FILE_Addr from a pathname. |
int set (const ACE_DEV_Addr &sa) | Acts like a copy constructor. |
int set (const ACE_TCHAR *devname) | Create a ACE_Addr from a ACE_DEV pathname. |
ACE_DEV_Addr & operator=( const ACE_DEV_Addr &) | Assignment operator. |
virtual void * get_addr (void) const | Return a pointer to the address. |
virtual int addr_to_string ( ACE_TCHAR *addr, size_t) const | Transform the current address into string format. |
bool operator==( const ACE_FILE_Addr &SAP) const | Compare two addresses for equality. |
bool operator!=( const ACE_FILE_Addr &SAP) const | Compare two addresses for inequality. |
const ACE_TCHAR * get_path_name (void) const | Return the path name used for the rendezvous point. |
Member | Description |
ACE_TCHAR devname_ [DEVNAME_LENGTH] enum {DEVNAME_LENGTH = MAXPATHLEN + 1} | Name of the device. |
w ACE_FILE_Connector
Defines an active connection factory for the ACE_FILE wrappers.
Note that the O_APPEND flag is only partly supported on Win32. If you specify O_APPEND, then the file pointer will be positioned at the end of the file initially during open, but it is not re-positioned at the end prior to each write, as specified by POSIX. This is generally good enough for typical situations, but it is ``not quite right'' in its semantics.
Method | Description |
ACE_FILE_Connector ( ACE_FILE_IO &new_io, const ACE_FILE_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=O_RDWR|O_CREAT, int perms=ACE_DEFAULT_FILE_PERMS) | Actively ``connect'' and produce a <new_io> <ACE_FILE_IO> object if things go well. The <remote_sap> is the file that we are trying to create/open. If it's the default value of <ACE_Addr::sap_any> then the user is letting the OS create the filename (via <ACE_OS::mkstemp>). The timeout is the amount of time to wait to create/open the file. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the file is created using non-blocking mode. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. The <local_sap> and <reuse_addr> parameters are ignored. The <flags> and <perms> arguments are passed down to the <ACE_OS::open> method. |
int connect( ACE_FILE_IO &new_io, const ACE_FILE_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=O_RDWR|O_CREAT, int perms=ACE_DEFAULT_FILE_PERMS) | Actively ``connect'' and produce a <new_io> <ACE_FILE_IO> object if things go well. The <remote_sap> is the file that we are trying to create/open. If it's the default value of <ACE_Addr::sap_any> then the user is letting the OS create the filename (via <ACE_OS::mkstemp>). The timeout is the amount of time to wait to create/open the file. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the file is created using non-blocking mode. In this case, if the create/open can't be done immediately the value of -1 is returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made <errno == ETIME>. The <local_sap> and <reuse_addr> parameters are ignored. The <flags> and <perms> arguments are passed down to the <ACE_OS::open> method. |
int reset_new_handle (ACE_HANDLE handle) | Resets any event associations on this handle. |
w ACE_DEV_Connector
Method | Description |
ACE_DEV_Connector ( ACE_DEV_IO &new_io, const ACE_DEV_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=O_RDWR, int perms=0) | Actively connect and produce a <new_stream> if things go well. The <remote_sap> is the address that we are trying to connect with. The timeout is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made <errno == ETIME>. The <local_sap> is the value of local address to bind to. If it's the default value of <ACE_Addr::sap_any> then the user is letting the OS do the binding. If <reuse_addr> == 1 then the <local_addr> is reused, even if it hasn't been cleanedup yet. The <flags> and <perms> arguments are passed down to the <open> method. |
int connect ( ACE_DEV_IO &new_io, const ACE_DEV_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=O_RDWR, int perms=0) | Actively connect and produce a <new_stream> if things go well. The <remote_sap> is the address that we are trying to connect with. The timeout is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made <errno == ETIME>. The <local_sap> is the value of local address to bind to. If it's the default value of <ACE_Addr::sap_any> then the user is letting the OS do the binding. If <reuse_addr> == 1 then the <local_addr> is reused, even if it hasn't been cleanedup yet. The <flags> and <perms> arguments are passed down to the <open> method. |
int reset_new_handle (ACE_HANDLE handle) | Resets any event associations on this handle. |