adbus_Socket

Helper functions for connecting BSD sockets. More...

Functions

adbus_Socket adbus_sock_connect (adbus_BusType type)
 Connects a BSD socket to the specified bus type.
adbus_Socket adbus_sock_bind (adbus_BusType type)
 Binds a BSD socket to the specified bus type.
adbus_Socket adbus_sock_connect_s (const char *envstr, int size)
 Connects a BSD socket to the specified address.
adbus_Socket adbus_sock_bind_s (const char *envstr, int size)
 Binds a BSD socket to the specified address.
int adbus_sock_cauth (adbus_Socket sock, adbus_Buffer *buffer)
 Run the client auth protocol for a blocking BSD socket.

Detailed Description

Helper functions for connecting BSD sockets.


Function Documentation

adbus_Socket adbus_sock_bind ( adbus_BusType  type  ) 

Binds a BSD socket to the specified bus type.

The address is looked up using adbus_bind_address(). Supported addresses are given by adbus_sock_bind_s().

Returns:
ADBUS_SOCK_INVALID on error
See also:
adbus_connect_address()
adbus_Socket adbus_sock_bind_s ( const char *  envstr,
int  size 
)

Binds a BSD socket to the specified address.

Supported address types are:

  • TCP sockets of the form "tcp:host=<hostname>,port=<port number>"
  • On unix: unix sockets of the form "unix:file=<filename>"
  • On linux: abstract unix sockets of the form "unix:abstract=<filename>"

For TCP: specifying a port of 0 will cause the underlying sockets API to choose a random available port. The chosen port can be found by using getsockname() on the returned socket.

Returns:
ADBUS_SOCK_INVALID on error

For example:

  adbus_Socket s = adbus_sock_bind_s("tcp:host=localhost,port=12345", -1);
See also:
adbus_connect_address()
int adbus_sock_cauth ( adbus_Socket  sock,
adbus_Buffer buffer 
)

Run the client auth protocol for a blocking BSD socket.

This includes sending the leading null byte.

Returns:
non-zero on error

For example:

  int main(int argc, char* argv[])
  {
      adbus_Socket s = adbus_sock_connect(ADBUS_DEFAULT_BUS);
      if (s == ADBUS_SOCK_INVALID || adbus_sock_cauth(s))
          return -1;
      ... use the socket
  }
adbus_Socket adbus_sock_connect ( adbus_BusType  type  ) 

Connects a BSD socket to the specified bus type.

The address is looked up using adbus_connect_address(). Supported addresses is given by adbus_sock_connect_s().

Returns:
ADBUS_SOCK_INVALID on error
See also:
adbus_connect_address()
adbus_Socket adbus_sock_connect_s ( const char *  envstr,
int  size 
)

Connects a BSD socket to the specified address.

Supported address types are:

  • TCP sockets of the form "tcp:host=<hostname>,port=<port number>"
  • On unix: unix sockets of the form "unix:file=<filename>"
  • On linux: abstract unix sockets of the form "unix:abstract=<filename>"
Returns:
ADBUS_SOCK_INVALID on error

For example:

  adbus_Socket s = adbus_sock_connect_s("tcp:host=localhost,port=12345", -1);
See also:
adbus_connect_address()
 All Data Structures Files Functions Variables Friends Defines

Generated on Mon Mar 22 00:10:02 2010 for adbus by  doxygen 1.6.1