ObjFW
resolver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFString.h"
18 
19 #import "socket.h"
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
30 typedef struct {
31  int family, type, protocol;
32  struct sockaddr *address;
33  socklen_t addressLength;
34  void *private_;
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
52 extern of_resolver_result_t *OF_NULLABLE *OF_NONNULL
53  of_resolve_host(OFString *host, uint16_t port, int protocol);
54 
65 extern void of_address_to_string_and_port(struct sockaddr *address,
66  socklen_t addressLength,
67  OFString *__autoreleasing OF_NONNULL *OF_NULLABLE host,
68  uint16_t *OF_NULLABLE port);
69 
75 extern void of_resolver_free(
76  of_resolver_result_t *OF_NULLABLE *OF_NONNULL results);
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 OF_ASSUME_NONNULL_END
of_resolver_result_t *OF_NULLABLE *OF_NONNULL of_resolve_host(OFString *host, uint16_t port, int protocol)
Resolves the specified host.
Definition: resolver.m:57
void of_resolver_free(of_resolver_result_t *OF_NULLABLE *OF_NONNULL results)
Frees the results returned by of_resolve_host.
A struct representing one result from the resolver.
Definition: resolver.h:30
A class for handling strings.
Definition: OFString.h:91
void of_address_to_string_and_port(struct sockaddr *address, socklen_t addressLength, OFString *__autoreleasing OF_NONNULL *OF_NULLABLE host, uint16_t *OF_NULLABLE port)
Converts the specified address to a string and port pair.