vfs_fruit: Avoid double initialization
[Samba.git] / libcli / named_pipe_auth / npa_tstream.h
blobe7a1ac76d43bf6b34d8659a65faa9d2072b6b577
1 /*
2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2009
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef NPA_TSTREAM_H
21 #define NPA_TSTREAM_H
23 struct tevent_req;
24 struct tevent_context;
25 struct auth_session_info_transport;
26 struct tsocket_address;
28 struct tevent_req *tstream_npa_connect_send(TALLOC_CTX *mem_ctx,
29 struct tevent_context *ev,
30 const char *directory,
31 const char *npipe,
32 const struct tsocket_address *client,
33 const char *client_name_in,
34 const struct tsocket_address *server,
35 const char *server_name,
36 const struct auth_session_info_transport *session_info);
37 int _tstream_npa_connect_recv(struct tevent_req *req,
38 int *perrno,
39 TALLOC_CTX *mem_ctx,
40 struct tstream_context **stream,
41 uint16_t *file_type,
42 uint16_t *device_state,
43 uint64_t *allocation_size,
44 const char *location);
45 #define tstream_npa_connect_recv(req, perrno, mem_ctx, stream, f, d, a) \
46 _tstream_npa_connect_recv(req, perrno, mem_ctx, stream, f, d, a, \
47 __location__)
49 int _tstream_npa_existing_socket(TALLOC_CTX *mem_ctx,
50 int fd,
51 uint16_t file_type,
52 struct tstream_context **_stream,
53 const char *location);
54 #define tstream_npa_existing_socket(mem_ctx, fd, ft, stream) \
55 _tstream_npa_existing_socket(mem_ctx, fd, ft, stream, \
56 __location__)
59 /**
60 * @brief Accepts a connection for authenticated named pipes
62 * @param[in] mem_ctx The memory context for the operation
63 * @param[in] ev The tevent_context for the operation
64 * @param[in] plain The plain tstream_context of the bsd unix
65 * domain socket.
66 * This must be valid for the whole life of the
67 * resulting npa tstream_context!
68 * @param[in] file_type The file_type, message mode or byte mode
69 * @param[in] device_state The reported device state
70 * @param[in] allocation_size The reported allocation size
72 * @return the tevent_req handle
74 struct tevent_req *tstream_npa_accept_existing_send(TALLOC_CTX *mem_ctx,
75 struct tevent_context *ev,
76 struct tstream_context *plain,
77 uint16_t file_type,
78 uint16_t device_state,
79 uint64_t allocation_size);
81 /**
82 * @brief The receive end of the previous async function
84 * @param[in] req The tevent_req handle
85 * @param[out] perrno Pointer to store the errno in case of error
86 * @param[in] mem_ctx The memory context for the results
87 * @param[out] stream The resulting stream
88 * @param[out] client The resulting client address
89 * @param[out] client_name The resulting client name
90 * @param[out] server The resulting server address
91 * @param[out] server_name The resulting server name
92 * @param[out] info3 The info3 auth for the connecting user.
93 * @param[out] session_key The resulting session key
94 * @param[out] delegated_creds Delegated credentials
96 * @return 0 if successful, -1 on failure with *perror filled.
98 int _tstream_npa_accept_existing_recv(struct tevent_req *req,
99 int *perrno,
100 TALLOC_CTX *mem_ctx,
101 struct tstream_context **stream,
102 struct tsocket_address **client,
103 char **_client_name,
104 struct tsocket_address **server,
105 char **server_name,
106 struct auth_session_info_transport **session_info,
107 const char *location);
108 #define tstream_npa_accept_existing_recv(req, perrno, \
109 mem_ctx, stream, \
110 client, client_name, \
111 server, server_name, \
112 session_info) \
113 _tstream_npa_accept_existing_recv(req, perrno, \
114 mem_ctx, stream, \
115 client, client_name, \
116 server, server_name, \
117 session_info, \
118 __location__)
120 int _tstream_npa_socketpair(uint16_t file_type,
121 TALLOC_CTX *mem_ctx1,
122 struct tstream_context **pstream1,
123 TALLOC_CTX *mem_ctx2,
124 struct tstream_context **pstream2,
125 const char *location);
126 #define tstream_npa_socketpair(ft, mem1, stream1, mem2, stream2) \
127 _tstream_npa_socketpair(ft, mem1, stream1, mem2, stream2, \
128 __location__)
130 #endif /* NPA_TSTREAM_H */