SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWSockType Class Reference

A type of socket communications channel. More...

#include <rw/network/RWSockType.h>

Inheritance diagram for RWSockType:
RWInet6Type RWInetType

Public Member Functions

 RWSockType ()
 
 RWSockType (const RWCString &familyName, int domain, int type=SOCK_STREAM, int protocol=0)
 
 ~RWSockType ()
 
int getDomain () const
 
int getFamily () const
 
RWCString getFamilyName () const
 
int getProtocol () const
 
int getType () const
 
RWCString id (unsigned level) const
 
bool operator!= (const RWSockType &) const
 
bool operator== (const RWSockType &) const
 

Detailed Description

RWSockType represents a type of socket communications channel. It is made up of a family (or domain), a type, and a protocol. An example of a family is the Internet TCP/IP family AF_INET. A socket type is SOCK_STREAM or SOCK_DGRAM. A protocol could be PF_INET or PF_UNSPEC.

Constructor & Destructor Documentation

RWSockType::RWSockType ( )

Builds an invalid socket type. To set it to a valid type, use the assignment operator.

RWSockType::RWSockType ( const RWCString familyName,
int  domain,
int  type = SOCK_STREAM,
int  protocol = 0 
)

Builds a socket communication type descriptor. The domain specifies the type of communications channel. For the Internet domain, it is AF_INET; for the Unix domain, it is AF_UNIX. type specifies the type of channel, usually SOCK_STREAM or SOCK_DGRAM. The RWCString should contain 7-bit US-ASCII data.

RWSockType::~RWSockType ( )

Destructor.

Member Function Documentation

int RWSockType::getDomain ( ) const
inline

Alias for getFamily().

int RWSockType::getFamily ( ) const
inline

Returns the integer identifier of the address domain for the socket type, such as AF_INET for an Internet domain address.

RWCString RWSockType::getFamilyName ( ) const
inline

Returns a string representation of the address domain, such as "inet" for the Internet address domain. The RWCString should contain 7-bit US-ASCII data.

int RWSockType::getProtocol ( ) const
inline

Gets the protocol family that describes the socket type.

int RWSockType::getType ( ) const
inline

Gets the socket type that describes the socket protocol.

RWCString RWSockType::id ( unsigned  level) const

Returns a string describing self. The parameter level is currently unused. This method will return a string representing the address family and socket type.

Given the example input:

RWSockType("inet", AF_INET, SOCK_DGRAM, IPPROTO_UDP);

the following output would be returned:

inet:dgram
bool RWSockType::operator!= ( const RWSockType ) const

Returns true if any of the components (name, family, type, protocol) differ between the two classes.

bool RWSockType::operator== ( const RWSockType ) const

Returns true if all components (name, family, type, protocol) in the two classes are equivalent.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.