ObjFW
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
OFSocket.h File Reference
#include "objfw-defs.h"
#include <stdbool.h>
import "OFString.h"
import "macros.h"

Go to the source code of this file.

Classes

struct  OFSocketAddress
 A struct which represents a host / port pair for a socket. More...
 

Enumerations

enum  OFSocketAddressFamily {
  OFSocketAddressFamilyUnknown , OFSocketAddressFamilyIPv4 , OFSocketAddressFamilyIPv6 , OFSocketAddressFamilyUNIX ,
  OFSocketAddressFamilyIPX , OFSocketAddressFamilyAppleTalk , OFSocketAddressFamilyAny = 255
}
 A socket address family. More...
 

Functions

OFSocketAddress OFSocketAddressParseIP (OFString *IP, uint16_t port)
 Parses the specified IP (either v4 or v6) and port into an OFSocketAddress.
 
OFSocketAddress OFSocketAddressParseIPv4 (OFString *IP, uint16_t port)
 Parses the specified IPv4 and port into an OFSocketAddress.
 
OFSocketAddress OFSocketAddressParseIPv6 (OFString *IP, uint16_t port)
 Parses the specified IPv6 and port into an OFSocketAddress.
 
OFSocketAddress OFSocketAddressMakeUNIX (OFString *path)
 Creates a UNIX socket address from the specified path.
 
OFSocketAddress OFSocketAddressMakeIPX (uint32_t network, const unsigned char node[IPX_NODE_LEN], uint16_t port)
 Creates an IPX address for the specified network, node and port.
 
OFSocketAddress OFSocketAddressMakeAppleTalk (uint16_t network, uint8_t node, uint8_t port)
 Creates an AppleTalk address for the specified network, node and port.
 
bool OFSocketAddressEqual (const OFSocketAddress *address1, const OFSocketAddress *address2)
 Compares two OFSocketAddress for equality.
 
unsigned long OFSocketAddressHash (const OFSocketAddress *address)
 Returns the hash for the specified OFSocketAddress.
 
OFStringOFSocketAddressString (const OFSocketAddress *address)
 Converts the specified OFSocketAddress to a string.
 
OFStringOFSocketAddressDescription (const OFSocketAddress *address)
 Returns a description for the specified OFSocketAddress.
 
void OFSocketAddressSetIPPort (OFSocketAddress *address, uint16_t port)
 Sets the IP port of the specified OFSocketAddress.
 
uint16_t OFSocketAddressIPPort (const OFSocketAddress *address)
 Returns the IP port of the specified OFSocketAddress.
 
OFStringOFSocketAddressUNIXPath (const OFSocketAddress *address)
 Gets the UNIX socket path of the specified OFSocketAddress.
 
void OFSocketAddressSetIPXNetwork (OFSocketAddress *address, uint32_t network)
 Sets the IPX network of the specified OFSocketAddress.
 
uint32_t OFSocketAddressIPXNetwork (const OFSocketAddress *address)
 Returns the IPX network of the specified OFSocketAddress.
 
void OFSocketAddressSetIPXNode (OFSocketAddress *address, const unsigned char node[IPX_NODE_LEN])
 Sets the IPX node of the specified OFSocketAddress.
 
void OFSocketAddressGetIPXNode (const OFSocketAddress *address, unsigned char node[IPX_NODE_LEN])
 Gets the IPX node of the specified OFSocketAddress.
 
void OFSocketAddressSetIPXPort (OFSocketAddress *address, uint16_t port)
 Sets the IPX port of the specified OFSocketAddress.
 
uint16_t OFSocketAddressIPXPort (const OFSocketAddress *address)
 Returns the IPX port of the specified OFSocketAddress.
 
void OFSocketAddressSetAppleTalkNetwork (OFSocketAddress *address, uint16_t network)
 Sets the AppleTalk network of the specified OFSocketAddress.
 
uint16_t OFSocketAddressAppleTalkNetwork (const OFSocketAddress *address)
 Returns the AppleTalk network of the specified OFSocketAddress.
 
void OFSocketAddressSetAppleTalkNode (OFSocketAddress *address, uint8_t node)
 Sets the AppleTalk node of the specified OFSocketAddress.
 
uint8_t OFSocketAddressAppleTalkNode (const OFSocketAddress *address)
 Gets the AppleTalk node of the specified OFSocketAddress.
 
void OFSocketAddressSetAppleTalkPort (OFSocketAddress *address, uint8_t port)
 Sets the AppleTalk port of the specified OFSocketAddress.
 
uint8_t OFSocketAddressAppleTalkPort (const OFSocketAddress *address)
 Returns the AppleTalk port of the specified OFSocketAddress.
 

Enumeration Type Documentation

◆ OFSocketAddressFamily

A socket address family.

Enumerator
OFSocketAddressFamilyUnknown 

An unknown address family.

OFSocketAddressFamilyIPv4 

IPv4

OFSocketAddressFamilyIPv6 

IPv6

OFSocketAddressFamilyUNIX 

UNIX

OFSocketAddressFamilyIPX 

IPX

OFSocketAddressFamilyAppleTalk 

AppleTalk

OFSocketAddressFamilyAny 

Any address family

Function Documentation

◆ OFSocketAddressAppleTalkNetwork()

uint16_t OFSocketAddressAppleTalkNetwork ( const OFSocketAddress * address)
extern

Returns the AppleTalk network of the specified OFSocketAddress.

Parameters
addressThe address on which to get the AppleTalk network
Returns
The AppleTalk network of the address

◆ OFSocketAddressAppleTalkNode()

uint8_t OFSocketAddressAppleTalkNode ( const OFSocketAddress * address)
extern

Gets the AppleTalk node of the specified OFSocketAddress.

Parameters
addressThe address on which to get the AppleTalk node
Returns
The AppleTalk node of the address

◆ OFSocketAddressAppleTalkPort()

uint8_t OFSocketAddressAppleTalkPort ( const OFSocketAddress * address)
extern

Returns the AppleTalk port of the specified OFSocketAddress.

Parameters
addressThe address on which to get the port
Returns
The port of the address

◆ OFSocketAddressDescription()

OFString * OFSocketAddressDescription ( const OFSocketAddress * address)
extern

Returns a description for the specified OFSocketAddress.

This is similar to OFSocketAddressString, but it also contains the port.

Parameters
addressThe address to return a description for
Returns
The address as an string, with the port

◆ OFSocketAddressEqual()

bool OFSocketAddressEqual ( const OFSocketAddress * address1,
const OFSocketAddress * address2 )
extern

Compares two OFSocketAddress for equality.

Parameters
address1The address to compare with the second address
address2The second address
Returns
Whether the two addresses are equal

◆ OFSocketAddressGetIPXNode()

void OFSocketAddressGetIPXNode ( const OFSocketAddress * address,
unsigned char node[IPX_NODE_LEN] )
extern

Gets the IPX node of the specified OFSocketAddress.

Parameters
addressThe address on which to get the IPX node
nodeA byte array to store the IPX node of the address

◆ OFSocketAddressHash()

unsigned long OFSocketAddressHash ( const OFSocketAddress * address)
extern

Returns the hash for the specified OFSocketAddress.

Parameters
addressThe address to hash
Returns
The hash for the specified OFSocketAddress

◆ OFSocketAddressIPPort()

uint16_t OFSocketAddressIPPort ( const OFSocketAddress * address)
extern

Returns the IP port of the specified OFSocketAddress.

Parameters
addressThe address on which to get the port
Returns
The port of the address

◆ OFSocketAddressIPXNetwork()

uint32_t OFSocketAddressIPXNetwork ( const OFSocketAddress * address)
extern

Returns the IPX network of the specified OFSocketAddress.

Parameters
addressThe address on which to get the IPX network
Returns
The IPX network of the address

◆ OFSocketAddressIPXPort()

uint16_t OFSocketAddressIPXPort ( const OFSocketAddress * address)
extern

Returns the IPX port of the specified OFSocketAddress.

Parameters
addressThe address on which to get the port
Returns
The port of the address

◆ OFSocketAddressMakeAppleTalk()

OFSocketAddress OFSocketAddressMakeAppleTalk ( uint16_t network,
uint8_t node,
uint8_t port )
extern

Creates an AppleTalk address for the specified network, node and port.

Parameters
networkThe AppleTalk network
nodeThe node in the AppleTalk network
portThe AppleTalk (sometimes called socket number) on the node
Returns
An AppleTalk socket address with the specified node, network and port.

◆ OFSocketAddressMakeIPX()

OFSocketAddress OFSocketAddressMakeIPX ( uint32_t network,
const unsigned char node[IPX_NODE_LEN],
uint16_t port )
extern

Creates an IPX address for the specified network, node and port.

Parameters
networkThe IPX network
nodeThe node in the IPX network
portThe IPX port (sometimes called socket number) on the node
Returns
An IPX socket address with the specified node, network and port.

◆ OFSocketAddressMakeUNIX()

OFSocketAddress OFSocketAddressMakeUNIX ( OFString * path)
extern

Creates a UNIX socket address from the specified path.

Parameters
pathThe path of the UNIX socket
Returns
A UNIX socket address with the specified path

◆ OFSocketAddressParseIP()

OFSocketAddress OFSocketAddressParseIP ( OFString * IP,
uint16_t port )
extern

Parses the specified IP (either v4 or v6) and port into an OFSocketAddress.

Parameters
IPThe IP to parse
portThe port to use
Returns
The parsed IP and port as an OFSocketAddress
Exceptions
OFInvalidFormatExceptionThe specified string is not a valid IP

◆ OFSocketAddressParseIPv4()

OFSocketAddress OFSocketAddressParseIPv4 ( OFString * IP,
uint16_t port )
extern

Parses the specified IPv4 and port into an OFSocketAddress.

Parameters
IPThe IPv4 to parse
portThe port to use
Returns
The parsed IPv4 and port as an OFSocketAddress
Exceptions
OFInvalidFormatExceptionThe specified string is not a valid IPv4

◆ OFSocketAddressParseIPv6()

OFSocketAddress OFSocketAddressParseIPv6 ( OFString * IP,
uint16_t port )
extern

Parses the specified IPv6 and port into an OFSocketAddress.

Parameters
IPThe IPv6 to parse
portThe port to use
Returns
The parsed IPv6 and port as an OFSocketAddress
Exceptions
OFInvalidFormatExceptionThe specified string is not a valid IPv6

◆ OFSocketAddressSetAppleTalkNetwork()

void OFSocketAddressSetAppleTalkNetwork ( OFSocketAddress * address,
uint16_t network )
extern

Sets the AppleTalk network of the specified OFSocketAddress.

Parameters
addressThe address on which to set the AppleTalk network
networkThe AppleTalk network to set on the address

◆ OFSocketAddressSetAppleTalkNode()

void OFSocketAddressSetAppleTalkNode ( OFSocketAddress * address,
uint8_t node )
extern

Sets the AppleTalk node of the specified OFSocketAddress.

Parameters
addressThe address on which to set the AppleTalk node
nodeThe AppleTalk node to set on the address

◆ OFSocketAddressSetAppleTalkPort()

void OFSocketAddressSetAppleTalkPort ( OFSocketAddress * address,
uint8_t port )
extern

Sets the AppleTalk port of the specified OFSocketAddress.

Parameters
addressThe address on which to set the port
portThe port to set on the address

◆ OFSocketAddressSetIPPort()

void OFSocketAddressSetIPPort ( OFSocketAddress * address,
uint16_t port )
extern

Sets the IP port of the specified OFSocketAddress.

Parameters
addressThe address on which to set the port
portThe port to set on the address

◆ OFSocketAddressSetIPXNetwork()

void OFSocketAddressSetIPXNetwork ( OFSocketAddress * address,
uint32_t network )
extern

Sets the IPX network of the specified OFSocketAddress.

Parameters
addressThe address on which to set the IPX network
networkThe IPX network to set on the address

◆ OFSocketAddressSetIPXNode()

void OFSocketAddressSetIPXNode ( OFSocketAddress * address,
const unsigned char node[IPX_NODE_LEN] )
extern

Sets the IPX node of the specified OFSocketAddress.

Parameters
addressThe address on which to set the IPX node
nodeThe IPX node to set on the address

◆ OFSocketAddressSetIPXPort()

void OFSocketAddressSetIPXPort ( OFSocketAddress * address,
uint16_t port )
extern

Sets the IPX port of the specified OFSocketAddress.

Parameters
addressThe address on which to set the port
portThe port to set on the address

◆ OFSocketAddressString()

OFString * OFSocketAddressString ( const OFSocketAddress * address)
extern

Converts the specified OFSocketAddress to a string.

Parameters
addressThe address to convert to a string
Returns
The address as a string, without the port

◆ OFSocketAddressUNIXPath()

OFString * OFSocketAddressUNIXPath ( const OFSocketAddress * address)
extern

Gets the UNIX socket path of the specified OFSocketAddress.

Parameters
addressThe address on which to get the UNIX socket path
Returns
The UNIX socket path