1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy.
2141cc406Sopenharmony_ci   Copyright (C) 1997 David Mosberger-Tang
3141cc406Sopenharmony_ci   Copyright (C) 2003 Julien BLACHE <jb@jblache.org>
4141cc406Sopenharmony_ci      AF-independent code + IPv6
5141cc406Sopenharmony_ci
6141cc406Sopenharmony_ci   This file is part of the SANE package.
7141cc406Sopenharmony_ci
8141cc406Sopenharmony_ci   This program is free software; you can redistribute it and/or
9141cc406Sopenharmony_ci   modify it under the terms of the GNU General Public License as
10141cc406Sopenharmony_ci   published by the Free Software Foundation; either version 2 of the
11141cc406Sopenharmony_ci   License, or (at your option) any later version.
12141cc406Sopenharmony_ci
13141cc406Sopenharmony_ci   This program is distributed in the hope that it will be useful, but
14141cc406Sopenharmony_ci   WITHOUT ANY WARRANTY; without even the implied warranty of
15141cc406Sopenharmony_ci   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16141cc406Sopenharmony_ci   General Public License for more details.
17141cc406Sopenharmony_ci
18141cc406Sopenharmony_ci   You should have received a copy of the GNU General Public License
19141cc406Sopenharmony_ci   along with this program.  If not, see <https://www.gnu.org/licenses/>.
20141cc406Sopenharmony_ci
21141cc406Sopenharmony_ci   As a special exception, the authors of SANE give permission for
22141cc406Sopenharmony_ci   additional uses of the libraries contained in this release of SANE.
23141cc406Sopenharmony_ci
24141cc406Sopenharmony_ci   The exception is that, if you link a SANE library with other files
25141cc406Sopenharmony_ci   to produce an executable, this does not by itself cause the
26141cc406Sopenharmony_ci   resulting executable to be covered by the GNU General Public
27141cc406Sopenharmony_ci   License.  Your use of that executable is in no way restricted on
28141cc406Sopenharmony_ci   account of linking the SANE library code into it.
29141cc406Sopenharmony_ci
30141cc406Sopenharmony_ci   This exception does not, however, invalidate any other reasons why
31141cc406Sopenharmony_ci   the executable file might be covered by the GNU General Public
32141cc406Sopenharmony_ci   License.
33141cc406Sopenharmony_ci
34141cc406Sopenharmony_ci   If you submit changes to SANE to the maintainers to be included in
35141cc406Sopenharmony_ci   a subsequent release, you agree by submitting the changes that
36141cc406Sopenharmony_ci   those changes may be distributed with this exception intact.
37141cc406Sopenharmony_ci
38141cc406Sopenharmony_ci   If you write modifications of your own for SANE, it is your choice
39141cc406Sopenharmony_ci   whether to permit this exception to apply to your modifications.
40141cc406Sopenharmony_ci   If you do not wish that, delete this exception notice.  */
41141cc406Sopenharmony_ci#ifndef net_h
42141cc406Sopenharmony_ci#define net_h
43141cc406Sopenharmony_ci
44141cc406Sopenharmony_ci#include <sys/types.h>
45141cc406Sopenharmony_ci#include <sys/socket.h>
46141cc406Sopenharmony_ci
47141cc406Sopenharmony_ci#include "../include/sane/sanei_wire.h"
48141cc406Sopenharmony_ci#include "../include/sane/config.h"
49141cc406Sopenharmony_ci
50141cc406Sopenharmony_citypedef struct Net_Device
51141cc406Sopenharmony_ci  {
52141cc406Sopenharmony_ci    struct Net_Device *next;
53141cc406Sopenharmony_ci    const char *name;
54141cc406Sopenharmony_ci#if defined (HAVE_GETADDRINFO) && defined (HAVE_GETNAMEINFO)
55141cc406Sopenharmony_ci    struct addrinfo *addr;
56141cc406Sopenharmony_ci    struct addrinfo *addr_used;
57141cc406Sopenharmony_ci#else
58141cc406Sopenharmony_ci    struct sockaddr addr;
59141cc406Sopenharmony_ci#endif /* HAVE_GETADDRINFO && HAVE_GETNAMEINFO */
60141cc406Sopenharmony_ci    int ctl;			/* socket descriptor (or -1) */
61141cc406Sopenharmony_ci    Wire wire;
62141cc406Sopenharmony_ci    int auth_active;
63141cc406Sopenharmony_ci  }
64141cc406Sopenharmony_ciNet_Device;
65141cc406Sopenharmony_ci
66141cc406Sopenharmony_citypedef struct Net_Scanner
67141cc406Sopenharmony_ci  {
68141cc406Sopenharmony_ci    /* all the state needed to define a scan request: */
69141cc406Sopenharmony_ci    struct Net_Scanner *next;
70141cc406Sopenharmony_ci
71141cc406Sopenharmony_ci    int options_valid;			/* are the options current? */
72141cc406Sopenharmony_ci    SANE_Option_Descriptor_Array opt, local_opt;
73141cc406Sopenharmony_ci
74141cc406Sopenharmony_ci    SANE_Word handle;		/* remote handle (it's a word, not a ptr!) */
75141cc406Sopenharmony_ci
76141cc406Sopenharmony_ci    int data;			/* data socket descriptor */
77141cc406Sopenharmony_ci    int reclen_buf_offset;
78141cc406Sopenharmony_ci    u_char reclen_buf[4];
79141cc406Sopenharmony_ci    size_t bytes_remaining;	/* how many bytes left in this record? */
80141cc406Sopenharmony_ci
81141cc406Sopenharmony_ci    /* device (host) info: */
82141cc406Sopenharmony_ci    Net_Device *hw;
83141cc406Sopenharmony_ci  }
84141cc406Sopenharmony_ciNet_Scanner;
85141cc406Sopenharmony_ci
86141cc406Sopenharmony_ci#endif /* net_h */
87