1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 1997 David Mosberger-Tang
3    Copyright (C) 2003 Julien BLACHE <jb@jblache.org>
4       AF-independent code + IPv6
5 
6    This file is part of the SANE package.
7 
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2 of the
11    License, or (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 
21    As a special exception, the authors of SANE give permission for
22    additional uses of the libraries contained in this release of SANE.
23 
24    The exception is that, if you link a SANE library with other files
25    to produce an executable, this does not by itself cause the
26    resulting executable to be covered by the GNU General Public
27    License.  Your use of that executable is in no way restricted on
28    account of linking the SANE library code into it.
29 
30    This exception does not, however, invalidate any other reasons why
31    the executable file might be covered by the GNU General Public
32    License.
33 
34    If you submit changes to SANE to the maintainers to be included in
35    a subsequent release, you agree by submitting the changes that
36    those changes may be distributed with this exception intact.
37 
38    If you write modifications of your own for SANE, it is your choice
39    whether to permit this exception to apply to your modifications.
40    If you do not wish that, delete this exception notice.  */
41 #ifndef net_h
42 #define net_h
43 
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 
47 #include "../include/sane/sanei_wire.h"
48 #include "../include/sane/config.h"
49 
50 typedef struct Net_Device
51   {
52     struct Net_Device *next;
53     const char *name;
54 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GETNAMEINFO)
55     struct addrinfo *addr;
56     struct addrinfo *addr_used;
57 #else
58     struct sockaddr addr;
59 #endif /* HAVE_GETADDRINFO && HAVE_GETNAMEINFO */
60     int ctl;			/* socket descriptor (or -1) */
61     Wire wire;
62     int auth_active;
63   }
64 Net_Device;
65 
66 typedef struct Net_Scanner
67   {
68     /* all the state needed to define a scan request: */
69     struct Net_Scanner *next;
70 
71     int options_valid;			/* are the options current? */
72     SANE_Option_Descriptor_Array opt, local_opt;
73 
74     SANE_Word handle;		/* remote handle (it's a word, not a ptr!) */
75 
76     int data;			/* data socket descriptor */
77     int reclen_buf_offset;
78     u_char reclen_buf[4];
79     size_t bytes_remaining;	/* how many bytes left in this record? */
80 
81     /* device (host) info: */
82     Net_Device *hw;
83   }
84 Net_Scanner;
85 
86 #endif /* net_h */
87