Back to index

im-sdk  12.3.91
Public Types | Public Member Functions | Private Member Functions | Private Attributes
IMTransAccept Class Reference

#include <IMTrans.hh>

List of all members.

Public Types

enum  SELECT_TYPE { Trans_ERROR = -1, Trans_TIMEOUT = 0, Trans_ACCEPT = 1 }

Public Member Functions

 IMTransAccept (int fd)
 ~IMTransAccept ()
int read (char *buf, int len)
int write (char *buf, int len)
int connection_id ()
int select_fd (struct timeval)

Private Member Functions

 IMTransAccept (const IMTransAccept &)
IMTransAcceptoperator= (const IMTransAccept &a)

Private Attributes

int accept_fd
fd_set rmask_fd

Detailed Description

Definition at line 78 of file IMTrans.hh.


Member Enumeration Documentation

Enumerator:
Trans_ERROR 
Trans_TIMEOUT 
Trans_ACCEPT 

Definition at line 90 of file IMTrans.hh.

                   {
    Trans_ERROR = -1, Trans_TIMEOUT = 0, Trans_ACCEPT = 1
  };

Constructor & Destructor Documentation

IMTransAccept::IMTransAccept ( int  fd) [inline]

Definition at line 80 of file IMTrans.hh.

                        : accept_fd(fd) {
    memset(&rmask_fd, 0, sizeof(fd_set));
    FD_SET(fd, &rmask_fd);
  }

Definition at line 251 of file IMTransP.cpp.

                              {
  if (accept_fd) {
    FD_CLR(accept_fd, &rmask_fd);
    close(accept_fd);
    shutdown(accept_fd, 2);
    accept_fd = 0;
  }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 292 of file IMTransP.cpp.

{return accept_fd;}

Here is the caller graph for this function:

IMTransAccept& IMTransAccept::operator= ( const IMTransAccept a) [private]
int IMTransAccept::read ( char *  buf,
int  len 
)

Definition at line 261 of file IMTransP.cpp.

                                      {
  return ::read(accept_fd, buf, len);
}

Here is the caller graph for this function:

int IMTransAccept::select_fd ( struct timeval  timeout)

Definition at line 266 of file IMTransP.cpp.

                                               {
  fd_set select_mask;
  select_mask = rmask_fd;
  int nfds = accept_fd + 1;

  while(1) {
    if (select(nfds, &select_mask, NULL, NULL, &timeout) == -1) {
      if (errno == EINTR)
       continue;
      else
       return Trans_ERROR;
    }
    if (FD_ISSET(accept_fd, &select_mask)) {
      return Trans_ACCEPT;
    }
    // timeout
    return Trans_TIMEOUT;
  }
}

Here is the caller graph for this function:

int IMTransAccept::write ( char *  buf,
int  len 
)

Definition at line 287 of file IMTransP.cpp.

                                       {
  return ::write(accept_fd, buf, len);
}

Here is the caller graph for this function:


Member Data Documentation

int IMTransAccept::accept_fd [private]

Definition at line 97 of file IMTrans.hh.

fd_set IMTransAccept::rmask_fd [private]

Definition at line 98 of file IMTrans.hh.


The documentation for this class was generated from the following files: