1 /*
2 dst_addr.cc
3
4 $Id: dst_addr.cc,v 1.3 2002/05/07 03:15:36 evertonm Exp $
5 */
6
7 #include <syslog.h>
8 #include <stdlib.h>
9 #include <string.h>
10
11 #include "util.h"
12 #include "addr.h"
13 #include "dst_addr.hpp"
14 #include "solve.h"
15
show() const16 void dst_addr::show() const
17 {
18 show_addr(&address);
19 syslog(LOG_INFO, ":%d", port);
20 }
21
get_addr(const char * protoname,const struct sockaddr_in * cli_sa,const struct sockaddr_in * local_cli_sa,const struct ip_addr ** addr,int * prt)22 int dst_addr::get_addr(const char *protoname,
23 const struct sockaddr_in *cli_sa,
24 const struct sockaddr_in *local_cli_sa,
25 const struct ip_addr **addr, int *prt)
26 {
27 if (name) {
28 free(address.addr);
29 struct ip_addr ad = solve_hostname(name);
30 memcpy((void *) &address, (void *) &ad, sizeof(ad));
31 }
32
33 *addr = &address;
34 *prt = port;
35
36 return 0;
37 }
38
39 /* Eof: dst_addr.cc */
40