2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2009
6 ** NOTE! The following LGPL license applies to the tevent
7 ** library. This does NOT imply that all of Samba is released
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, see <http://www.gnu.org/licenses/>.
30 struct tsocket_address;
31 struct tdgram_context;
35 * tsocket_address related functions
37 char *tsocket_address_string(const struct tsocket_address *addr,
40 struct tsocket_address *_tsocket_address_copy(const struct tsocket_address *addr,
42 const char *location);
44 #define tsocket_address_copy(addr, mem_ctx) \
45 _tsocket_address_copy(addr, mem_ctx, __location__)
48 * tdgram_context related functions
50 struct tevent_req *tdgram_recvfrom_send(TALLOC_CTX *mem_ctx,
51 struct tevent_context *ev,
52 struct tdgram_context *dgram);
53 ssize_t tdgram_recvfrom_recv(struct tevent_req *req,
57 struct tsocket_address **src);
59 struct tevent_req *tdgram_sendto_send(TALLOC_CTX *mem_ctx,
60 struct tevent_context *ev,
61 struct tdgram_context *dgram,
62 const uint8_t *buf, size_t len,
63 const struct tsocket_address *dst);
64 ssize_t tdgram_sendto_recv(struct tevent_req *req,
67 struct tevent_req *tdgram_disconnect_send(TALLOC_CTX *mem_ctx,
68 struct tevent_context *ev,
69 struct tdgram_context *dgram);
70 int tdgram_disconnect_recv(struct tevent_req *req,
74 * BSD sockets: inet, inet6 and unix
77 int _tsocket_address_inet_from_strings(TALLOC_CTX *mem_ctx,
81 struct tsocket_address **_addr,
82 const char *location);
83 #define tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr) \
84 _tsocket_address_inet_from_strings(mem_ctx, fam, addr, port, _addr, \
87 char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
89 uint16_t tsocket_address_inet_port(const struct tsocket_address *addr);
90 int tsocket_address_inet_set_port(struct tsocket_address *addr,
92 void tsocket_address_inet_set_broadcast(struct tsocket_address *addr,
95 int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
97 struct tsocket_address **_addr,
98 const char *location);
99 #define tsocket_address_unix_from_path(mem_ctx, path, _addr) \
100 _tsocket_address_unix_from_path(mem_ctx, path, _addr, \
102 char *tsocket_address_unix_path(const struct tsocket_address *addr,
103 TALLOC_CTX *mem_ctx);
105 int _tdgram_inet_udp_socket(const struct tsocket_address *local,
106 const struct tsocket_address *remote,
108 struct tdgram_context **dgram,
109 const char *location);
110 #define tdgram_inet_udp_socket(local, remote, mem_ctx, dgram) \
111 _tdgram_inet_udp_socket(local, remote, mem_ctx, dgram, __location__)
113 int _tdgram_unix_dgram_socket(const struct tsocket_address *local,
114 const struct tsocket_address *remote,
116 struct tdgram_context **dgram,
117 const char *location);
118 #define tdgram_unix_dgram_socket(local, remote, mem_ctx, dgram) \
119 _tdgram_unix_dgram_socket(local, remote, mem_ctx, dgram, __location__)
125 struct tevent_req *tdgram_sendto_queue_send(TALLOC_CTX *mem_ctx,
126 struct tevent_context *ev,
127 struct tdgram_context *dgram,
128 struct tevent_queue *queue,
131 struct tsocket_address *dst);
132 ssize_t tdgram_sendto_queue_recv(struct tevent_req *req, int *perrno);
134 #endif /* _TSOCKET_H */