]> arthur.barton.de Git - netatalk.git/blob - libatalk/dsi/dsi_init.c
Fix build
[netatalk.git] / libatalk / dsi / dsi_init.c
1 /*
2  * Copyright (c) 2012, Frank Lahm <franklahm@googlemail.com>
3  * All rights reserved. See COPYRIGHT.
4  */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif /* HAVE_CONFIG_H */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <signal.h>
13 #include <atalk/dsi.h>
14
15 DSI *dsi_init(AFPObj *obj, const char *hostname, const char *address, const char *port)
16 {
17     DSI         *dsi;
18
19     if ((dsi = (DSI *)calloc(1, sizeof(DSI))) == NULL)
20         return NULL;
21
22     dsi->attn_quantum = DSI_DEFQUANT;
23     dsi->server_quantum = obj->options.server_quantum;
24     dsi->dsireadbuf = obj->options.dsireadbuf;
25
26     /* currently the only transport protocol that exists for dsi */
27     if (dsi_tcp_init(dsi, hostname, address, port) != 0) {
28         free(dsi);
29         dsi = NULL;
30     }
31
32     return dsi;
33 }