2 * Bacula Sock Structure definition
6 * Zero msglen from other end indicates soft eof (usually
7 * end of some binary data stream, but not end of conversation).
9 * Negative msglen, is special "signal" (no data follows).
10 * See below for SIGNAL codes.
14 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
16 This program is free software; you can redistribute it and/or
17 modify it under the terms of the GNU General Public License as
18 published by the Free Software Foundation; either version 2 of
19 the License, or (at your option) any later version.
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 General Public License for more details.
26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
33 typedef struct s_bsock {
34 uint64_t read_seqno; /* read sequence number */
35 uint32_t in_msg_no; /* intput message number */
36 uint32_t out_msg_no; /* output message number */
37 int fd; /* socket file descriptor */
38 int32_t msglen; /* message length */
39 int port; /* desired port */
40 int errors; /* set if errors on socket */
41 int b_errno; /* bsock errno */
42 time_t timer_start; /* time started read/write */
43 int timed_out; /* timed out in read/write */
44 int timeout; /* time out after this value */
45 int terminated; /* set when BNET_TERMINATE arrives */
46 int duped; /* set if duped BSOCK */
47 char *msg; /* message pool buffer */
48 char *who; /* Name of daemon to which we are talking */
49 char *host; /* Host name/IP */
50 char *errmsg; /* edited error message (to be implemented) */
51 RES *res; /* Resource to which we are connected */
52 struct s_bsock *next; /* next BSOCK if duped */
55 /* Signal definitions for use in bnet_sig() */
56 #define BNET_EOF 0 /* Deprecated, use BNET_EOD */
57 #define BNET_EOD -1 /* End of data stream, new data may follow */
58 #define BNET_EOD_POLL -2 /* End of data and poll all in one */
59 #define BNET_STATUS -3 /* Send full status */
60 #define BNET_TERMINATE -4 /* Conversation terminated, doing close() */
61 #define BNET_POLL -5 /* Poll request, I'm hanging on a read */
62 #define BNET_HEARTBEAT -6 /* Heartbeat Response requested */
63 #define BNET_HB_RESPONSE -7 /* Only response permited to HB */
64 #define BNET_PROMPT -8 /* Prompt for UA */
66 #define BNET_SETBUF_READ 1 /* Arg for bnet_set_buffer_size */
67 #define BNET_SETBUF_WRITE 2 /* Arg for bnet_set_buffer_size */