sock.h File Reference
`#include "config.h"`
`#include "status.h"`
`#include "wire/listener.h"`
`#include "wire/netio.h"`
`#include "wire/query.h"`

Go to the source code of this file.

## Data Structures

struct | sock_struct
struct | socklist_struct
struct | udp_data
struct | tcp_accept_data
struct | tcp_data

## Typedefs

typedef struct sock_struct | sock_type
typedef struct socklist_struct | socklist_type

## Functions

ods_status | sock_listen (socklist_type *sockets, listener_type *listener)
void | sock_handle_udp (netio_type *netio, netio_handler_type *handler, netio_events_type event_types)
void | sock_handle_tcp_accept (netio_type *netio, netio_handler_type *handler, netio_events_type event_types)
void | sock_handle_tcp_read (netio_type *netio, netio_handler_type *handler, netio_events_type event_types)
void | sock_handle_tcp_write (netio_type *netio, netio_handler_type *handler, netio_events_type event_types)

## Typedef Documentation

## sock_type

typedef struct sock_struct sock_type

Sockets. Socket.

Definition at line 45 of file sock.h.

## socklist_type

typedef struct socklist_struct socklist_type

List of sockets.

Definition at line 55 of file sock.h.

## Function Documentation

## sock_handle_tcp_accept()

void sock_handle_tcp_accept | ( | netio_type * | netio,
|  | netio_handler_type * | handler,
|  | netio_events_type | event_types
| ) |  |

Handle incoming tcp connections.

Parameters

  [in] | netio | network I/O event handler
  [in] | handler | event handler
  [in] | event_types | the types of events that should be checked for

Handle incoming tcp connections.

Definition at line 445 of file sock.c.

References NETIO_EVENT_READ, and netio_handler_struct::user_data.

## sock_handle_tcp_read()

void sock_handle_tcp_read | ( | netio_type * | netio,
|  | netio_handler_type * | handler,
|  | netio_events_type | event_types
| ) |  |

Handle incoming tcp queries.

Parameters

  [in] | netio | network I/O event handler
  [in] | handler | event handler
  [in] | event_types | the types of events that should be checked for

Handle incoming tcp queries.

Definition at line 519 of file sock.c.

References NETIO_EVENT_TIMEOUT, tcp_data::qstate, QUERY_PROCESSED, and netio_handler_struct::user_data.

## sock_handle_tcp_write()

void sock_handle_tcp_write | ( | netio_type * | netio,
|  | netio_handler_type * | handler,
|  | netio_events_type | event_types
| ) |  |

Handle outgoing tcp responses.

Parameters

  [in] | netio | network I/O event handler
  [in] | handler | event handler
  [in] | event_types | the types of events that should be checked for

Handle outgoing tcp responses.

Definition at line 644 of file sock.c.

References NETIO_EVENT_TIMEOUT, tcp_data::query, and netio_handler_struct::user_data.

## sock_handle_udp()

void sock_handle_udp | ( | netio_type * | netio,
|  | netio_handler_type * | handler,
|  | netio_events_type | event_types
| ) |  |

Handle incoming udp queries.

Parameters

  [in] | netio | network I/O event handler
  [in] | handler | event handler
  [in] | event_types | the types of events that should be checked for

## sock_listen()

ods_status sock_listen | ( | socklist_type * | sockets,
|  | listener_type * | listener
| ) |  |

Create sockets and listen.

Parameters

  [out] | sockets | sockets
  [in] | listener | interfaces

Returns
  ods_status status

Create sockets and listen.

Definition at line 292 of file sock.c.

References interface_struct::address, listener_struct::count, DNS_PORT_STRING, interface_struct::family, listener_struct::interfaces, MAX_INTERFACES, interface_struct::port, sock_struct::s, socklist_struct::tcp, and socklist_struct::udp.

Referenced by dnshandler_listen().