5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
23 * Revision 1.2 2000/07/05 06:06:35 priikone
24 * Global cosmetic change.
26 * Revision 1.1.1.1 2000/06/27 11:36:55 priikone
27 * Imported from internal CVS/Added Log headers.
32 #include "silcincludes.h"
34 /* Allocates a new socket connection object. The allocated object is
35 returned to the new_socket argument. */
37 void silc_socket_alloc(int sock, SilcSocketType type, void *user_data,
38 SilcSocketConnection *new_socket)
40 SILC_LOG_DEBUG(("Allocating new socket connection object"));
42 /* Set the pointers. Incoming and outgoing data buffers
43 are allocated by the server when they are first used. */
44 *new_socket = silc_calloc(1, sizeof(**new_socket));
45 (*new_socket)->sock = sock;
46 (*new_socket)->type = type;
47 (*new_socket)->user_data = user_data;
48 (*new_socket)->protocol = NULL;
49 (*new_socket)->flags = 0;
50 (*new_socket)->inbuf = NULL;
51 (*new_socket)->outbuf = NULL;
54 /* Free's the Socket connection object. */
56 void silc_socket_free(SilcSocketConnection sock)
59 // silc_protocol_free(sock->protocol);
60 silc_buffer_free(sock->inbuf);
61 silc_buffer_free(sock->outbuf);