• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/netatalk-2.2.5/libatalk/dsi/
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
18DSI *dsi_init(const dsi_proto protocol, const char *program,
19	      const char *hostname, const char *address,
20	      const char *port, const int proxy, const u_int32_t quantum)
21{
22    DSI		*dsi;
23
24    if ((dsi = (DSI *) calloc(1, sizeof(DSI))) == NULL) {
25      return( NULL );
26    }
27    dsi->attn_quantum = DSI_DEFQUANT; /* default quantum size */
28    dsi->server_quantum = quantum; /* default server quantum */
29    dsi->program = program;
30
31    switch (protocol) {
32      /* currently the only transport protocol that exists for dsi */
33    case DSI_TCPIP:
34      if (!dsi_tcp_init(dsi, hostname, address, port, proxy)) {
35	free(dsi);
36	dsi = NULL;
37      }
38      break;
39
40    default: /* unknown protocol */
41      free(dsi);
42      dsi = NULL;
43      break;
44    }
45
46    return dsi;
47}
48
49void dsi_setstatus(DSI *dsi, char *status, const size_t slen)
50{
51    dsi->status = status;
52    dsi->statuslen = slen;
53}
54