Public Member Functions | Data Fields

SocketManager Struct Reference

Utility class for socket operations. More...

#include <I_SocketManager.h>

Public Member Functions

 SocketManager ()
SOCKET socket (int domain=AF_INET, int type=SOCK_STREAM, int protocol=0, bool bNonBlocking=true)
SOCKET mc_socket (int domain=AF_INET, int type=SOCK_DGRAM, int protocol=0, bool bNonBlocking=true)
int open (const char *path, int oflag=O_RDWR|O_NDELAY|O_CREAT, mode_t mode=DEFAULT_OPEN_MODE)
int64_t read (int fd, void *buf, int len, void *pOLP=NULL)
int64_t vector_io (int fd, struct iovec *vector, size_t count, int read_request, void *pOLP=0)
int64_t readv (int fd, struct iovec *vector, size_t count)
int64_t read_vector (int fd, struct iovec *vector, size_t count, void *pOLP=0)
int64_t pread (int fd, void *buf, int len, off_t offset, char *tag=NULL)
int recv (int s, void *buf, int len, int flags)
int recvfrom (int fd, void *buf, int size, int flags, struct sockaddr *addr, socklen_t *addrlen)
int64_t write (int fd, void *buf, int len, void *pOLP=NULL)
int64_t writev (int fd, struct iovec *vector, size_t count)
int64_t write_vector (int fd, struct iovec *vector, size_t count, void *pOLP=0)
int64_t pwrite (int fd, void *buf, int len, off_t offset, char *tag=NULL)
int send (int fd, void *buf, int len, int flags)
int sendto (int fd, void *buf, int len, int flags, struct sockaddr const *to, int tolen)
int sendmsg (int fd, struct msghdr *m, int flags, void *pOLP=0)
int64_t lseek (int fd, off_t offset, int whence)
int fstat (int fd, struct stat *)
int unlink (char *buf)
int fsync (int fildes)
int ftruncate (int fildes, off_t length)
int lockf (int fildes, int function, off_t size)
int poll (struct pollfd *fds, unsigned long nfds, int timeout)
int shutdown (int s, int how)
int dup (int s)
int accept (int s, struct sockaddr *addr, socklen_t *addrlen)
int get_sndbuf_size (int s)
int get_rcvbuf_size (int s)
int set_sndbuf_size (int s, int size)
int set_rcvbuf_size (int s, int size)
int getsockname (int s, struct sockaddr *, socklen_t *)
int close (int sock)
 Close the socket.
int ink_bind (int s, struct sockaddr const *name, int namelen, short protocol=0)
virtual ~SocketManager ()

Data Fields

const size_t pagesize

Detailed Description

Utility class for socket operations.

Definition at line 49 of file I_SocketManager.h.


Constructor & Destructor Documentation

SocketManager::SocketManager (  ) 

Definition at line 33 of file SocketManager.cc.

SocketManager::~SocketManager (  )  [virtual]

Definition at line 38 of file SocketManager.cc.


Member Function Documentation

TS_INLINE int SocketManager::accept ( int  s,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

Definition at line 63 of file P_UnixSocketManager.h.

References likely, and transient_error().

Referenced by Server::accept(), and NetAccept::acceptFastEvent().

int SocketManager::close ( int  sock  ) 
TS_INLINE int SocketManager::dup ( int  s  ) 

Definition at line 539 of file P_UnixSocketManager.h.

TS_INLINE int SocketManager::fstat ( int  fd,
struct stat *  buf 
)

Definition at line 285 of file P_UnixSocketManager.h.

References transient_error().

TS_INLINE int SocketManager::fsync ( int  fildes  ) 

Definition at line 308 of file P_UnixSocketManager.h.

TS_INLINE int SocketManager::ftruncate ( int  fildes,
off_t  length 
)

Definition at line 319 of file P_UnixSocketManager.h.

TS_INLINE int SocketManager::get_rcvbuf_size ( int  s  ) 

Definition at line 476 of file P_UnixSocketManager.h.

References safe_getsockopt().

TS_INLINE int SocketManager::get_sndbuf_size ( int  s  ) 

Definition at line 465 of file P_UnixSocketManager.h.

References safe_getsockopt().

TS_INLINE int SocketManager::getsockname ( int  s,
struct sockaddr *  sa,
socklen_t *  sz 
)

Definition at line 499 of file P_UnixSocketManager.h.

int SocketManager::ink_bind ( int  s,
struct sockaddr const *  name,
int  namelen,
short  protocol = 0 
)
TS_INLINE int SocketManager::lockf ( int  fildes,
int  function,
off_t  size 
)

Definition at line 528 of file P_UnixSocketManager.h.

TS_INLINE int64_t SocketManager::lseek ( int  fd,
off_t  offset,
int  whence 
)

Definition at line 274 of file P_UnixSocketManager.h.

TS_INLINE int SocketManager::mc_socket ( int  domain = AF_INET,
int  type = SOCK_DGRAM,
int  protocol = 0,
bool  bNonBlocking = true 
)

Definition at line 511 of file P_UnixSocketManager.h.

References socket().

Referenced by Connection::setup_mc_send().

TS_INLINE int SocketManager::open ( const char *  path,
int  oflag = O_RDWR | O_NDELAY | O_CREAT,
mode_t  mode = DEFAULT_OPEN_MODE 
)
TS_INLINE int SocketManager::poll ( struct pollfd *  fds,
unsigned long  nfds,
int  timeout 
)

Definition at line 330 of file P_UnixSocketManager.h.

References transient_error().

Referenced by safe_delay(), and send_throttle_message().

TS_INLINE int64_t SocketManager::pread ( int  fd,
void *  buf,
int  len,
off_t  offset,
char *  tag = NULL 
)

Definition at line 103 of file P_UnixSocketManager.h.

TS_INLINE int64_t SocketManager::pwrite ( int  fd,
void *  buf,
int  len,
off_t  offset,
char *  tag = NULL 
)

Definition at line 211 of file P_UnixSocketManager.h.

References unlikely.

Referenced by Store::clear().

TS_INLINE int64_t SocketManager::read ( int  fd,
void *  buf,
int  len,
void *  pOLP = NULL 
)

Definition at line 90 of file P_UnixSocketManager.h.

References likely.

Referenced by read_from_net(), read_stats_snap(), and send_throttle_message().

TS_INLINE int64_t SocketManager::read_vector ( int  fd,
struct iovec *  vector,
size_t  count,
void *  pOLP = 0 
)

Definition at line 169 of file P_UnixSocketManager.h.

References vector_io().

TS_INLINE int64_t SocketManager::readv ( int  fd,
struct iovec *  vector,
size_t  count 
)

Definition at line 115 of file P_UnixSocketManager.h.

References likely, and transient_error().

Referenced by read_from_net(), and vector_io().

TS_INLINE int SocketManager::recv ( int  s,
void *  buf,
int  len,
int  flags 
)

Definition at line 175 of file P_UnixSocketManager.h.

References unlikely.

TS_INLINE int SocketManager::recvfrom ( int  fd,
void *  buf,
int  size,
int  flags,
struct sockaddr *  addr,
socklen_t *  addrlen 
)
TS_INLINE int SocketManager::send ( int  fd,
void *  buf,
int  len,
int  flags 
)
TS_INLINE int SocketManager::sendmsg ( int  fd,
struct msghdr *  m,
int  flags,
void *  pOLP = 0 
)

Definition at line 263 of file P_UnixSocketManager.h.

References unlikely.

Referenced by UDPNetProcessor::sendmsg_re().

TS_INLINE int SocketManager::sendto ( int  fd,
void *  buf,
int  len,
int  flags,
struct sockaddr const *  to,
int  tolen 
)

Definition at line 252 of file P_UnixSocketManager.h.

References unlikely.

TS_INLINE int SocketManager::set_rcvbuf_size ( int  s,
int  size 
)
TS_INLINE int SocketManager::set_sndbuf_size ( int  s,
int  size 
)
TS_INLINE int SocketManager::shutdown ( int  s,
int  how 
)

Definition at line 517 of file P_UnixSocketManager.h.

References unlikely.

Referenced by UnixNetVConnection::do_io_shutdown().

TS_INLINE int SocketManager::socket ( int  domain = AF_INET,
int  type = SOCK_STREAM,
int  protocol = 0,
bool  bNonBlocking = true 
)
TS_INLINE int SocketManager::unlink ( char *  buf  ) 

Definition at line 297 of file P_UnixSocketManager.h.

Referenced by clear_stats().

TS_INLINE int64_t SocketManager::vector_io ( int  fd,
struct iovec *  vector,
size_t  count,
int  read_request,
void *  pOLP = 0 
)

Definition at line 128 of file P_UnixSocketManager.h.

References likely, min(), readv(), transient_error(), and writev().

Referenced by read_vector(), and write_vector().

TS_INLINE int64_t SocketManager::write ( int  fd,
void *  buf,
int  len,
void *  pOLP = NULL 
)
TS_INLINE int64_t SocketManager::write_vector ( int  fd,
struct iovec *  vector,
size_t  count,
void *  pOLP = 0 
)

Definition at line 234 of file P_UnixSocketManager.h.

References vector_io().

TS_INLINE int64_t SocketManager::writev ( int  fd,
struct iovec *  vector,
size_t  count 
)

Definition at line 222 of file P_UnixSocketManager.h.

References likely, and transient_error().

Referenced by UnixNetVConnection::load_buffer_and_write(), and vector_io().


Field Documentation

Definition at line 125 of file I_SocketManager.h.


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