File: host.h

package info (click to toggle)
yafc 1.1.1.dfsg.1-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,248 kB
  • ctags: 1,679
  • sloc: ansic: 19,338; sh: 10,365; makefile: 155; perl: 38; ruby: 33
file content (44 lines) | stat: -rw-r--r-- 1,426 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* $Id: host.h,v 1.3 2001/05/12 18:44:04 mhe Exp $
 *
 * host.h -- DNS lookups of hostnames
 *
 * Yet Another FTP Client
 * Copyright (C) 1998-2001, Martin Hedenfalk <mhe@stacken.kth.se>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. See COPYING for more details.
 */

#ifndef _host_h_included
#define _host_h_included

#include "syshdr.h"
#include "url.h"

typedef struct Host
{
	char *ipnum; /* aaa.bbb.ccc.ddd */
	char *hostname;
	char *ohostname;
	int port; /* ftp port number in network byte order */

	/* alternative address if we got an IPnumber and we couldn't resolv it */
	struct in_addr alt_h_addr;
	int alt_h_length;

	struct hostent *hep;
} Host;

Host *host_create(const url_t *urlp);
void host_destroy(Host *hostp);

int host_lookup(Host *hostp);
unsigned short int host_getport(const Host *hostp); /* returns port in network byte order */
unsigned short int host_gethport(const Host *hostp); /* returns port in host byte order */
const char *host_getip(const Host *hostp); /* returns IP number */
const char *host_getname(const Host *hostp); /* returns name as passed to host_set() */
const char *host_getoname(const Host *hostp); /* returns official name (as returned from gethostbyname()) */

#endif