]> arthur.barton.de Git - netatalk.git/blob - libatalk/dsi/dsi_init.c
568f9ffdfd9f6565547f453f45a0f1ea49ed409e
[netatalk.git] / libatalk / dsi / dsi_init.c
1 /*
2  * $Id: dsi_init.c,v 1.10 2009-11-05 14:38:08 franklahm Exp $
3  *
4  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
5  * All rights reserved. See COPYRIGHT.
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif /* HAVE_CONFIG_H */
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <signal.h>
15 #include <atalk/dsi.h>
16 #include "dsi_private.h"
17
18 DSI *dsi_init(AFPObj *obj, const char *hostname, const char *address, const char *port)
19 {
20     DSI         *dsi;
21
22     if ((dsi = (DSI *)calloc(1, sizeof(DSI))) == NULL)
23         return NULL;
24
25     dsi->attn_quantum = DSI_DEFQUANT;
26     dsi->server_quantum = obj->options.server_quantum;
27     dsi->dsireadbuf = obj->options->dsireadbuf;
28
29     /* currently the only transport protocol that exists for dsi */
30     if (dsi_tcp_init(dsi, hostname, address, port) != 0) {
31         free(dsi);
32         dsi = NULL;
33     }
34
35     return dsi;
36 }
37
38 void dsi_setstatus(DSI *dsi, char *status, const size_t slen)
39 {
40     dsi->status = status;
41     dsi->statuslen = slen;
42 }