GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  INETADDRESS (3)

NAME

FBB::InetAddress - Converting between host byte order and network byte order

CONTENTS

SYNOPSIS

#include <bobcat/inetaddress>
Linking option: -lbobcat

DESCRIPTION

Computers differ their word-byte order, called ‘endianness\(cq. A little-endian computer has its least significant byte at the byte having the lower address of a two-byte value, whereas a big-endian computer has its least significant byte at at the byte having the higher address of a two-byte value. In order to allow these computers to communicate over over Internet, host byte order was designed. Objects of the class FBB::InetAddress may be used to convert between network byte order and host byte order (and vice versa).

The class only has a few public members. Most members are protected, and FBB::InetAddress is therefore primarily used as a base class from which other classes are derived. In practice there will be little need to construct objects of the class FBB::InetAddress, which is primarily a support class for the FBB socket-classes.

Internally, all data are stored in network byte order.

As the class\(cq constructors depend on the proper functioning of members of the FBB:GetHostent class, the class\(cq objects can only be constructed when the host whose name or address is searched can be resolved by a name resolution process, e.g., bind(1).

Objects of the class FBB::InetAddress store address information about a host in a struct sockaddr_in data member. A struct sockaddr_in is the data type used to represent socket addresses in the Internet namespace. It has the following members:
o sa_family_t sin_family:
This identifies the address family or format of the socket address. It holds the value AF_INET.
o struct in_addr sin_addr:
This is the Internet address of the host machine stored as a binary value.
o size_t short int sin_port:
This field holds the port number.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

-

PROTECTED CONSTRUCTORS

o InetAddress(std::string const &host, uint16_t port):
This constructor expects a host name or dotted decimal address and and an (size_t) port number, and determines the host\(cqs address information. An FBB::Exception exception is thrown if the address could not be determined.
o InetAddress(uint16_t port):
This constructor constructs the ‘generic\(cq address information that is used when constructing, e.g. server sockets.
o InetAddress(sockaddr_in const &address):
This constructor constructs an FBB::InetAddress object from an initialized sockaddr_in object. It is primarily used to promote a sockaddr_in to an FBB::InetAddresss.

The (public) copy constructor is available.

MEMBER FUNCTIONS

o uint16_t port() const:
Accessor returning the object\(cqs port value.
o std::string dottedDecimalAddress() const:
Accessor returning the object\(cqs Internet address as a dotted decimal string. If the address could not be determined, an FBB::Exception object is thrown.
o size_t size() const:
Accessor returning the size of the object\(cqs sockaddr_in (address) information.
o sockaddr const *sockaddrPtr() const:
Accessor returning the pointer to the object\(cqs sockaddr data member.
o sockaddr_in const *sockaddr_inPtr() const:
Accessor returning the pointer to the object\(cqs sockaddr_in data member.

PROTECTED MEMBER FUNCTIONS

o sockaddr *sockaddrPtr():
This member returns the object\(cqs address information as a pointer to a modifiable struct sockaddr. This allows (contrary to the public member having the same name) derived objects to manipulate the object\(cqs address information directly.
o sockaddr_in *sockaddr_inPtr():
This member returns the object\(cqs address information as a pointer to a modifiable struct sockaddr_in. This allows (contrary to the public member having the same name) derived objects to manipulate the object\(cqs address information directly.

EXAMPLE

#include <iostream>

#include <bobcat/inetaddress> #include <bobcat/errno>

using namespace std; using namespace FBB;

InetAddress X() { class A: public InetAddress { public: A(uint16_t port) : InetAddress(port) {} };

return A(2000); }

int main(int argc, char **argv) try { InetAddress const &ia = X();

cout << \(dqA InetAddress was constructed for port \(dq << ia.port() << endl; cout << \(dqIt has the generic ‘ANY\(cq address: \(dq << ia.dottedDecimalAddress() << endl;

return 0; } catch (Errno const &e) { cout << \(dqException: \(dq << e.why() << endl; }

FILES

bobcat/inetaddress - defines the class interface

SEE ALSO

bind(1), bobcat(7), gethostent(3bobcat), socketbase(3bobcat)

BUGS

None Reported.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::INETADDRESS (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.