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/>.
24 #ifndef _TSOCKET_INTERNAL_H
25 #define _TSOCKET_INTERNAL_H
27 struct tsocket_address_ops {
30 char *(*string)(const struct tsocket_address *addr,
33 struct tsocket_address *(*copy)(const struct tsocket_address *addr,
35 const char *location);
38 struct tsocket_address {
40 const struct tsocket_address_ops *ops;
45 struct tsocket_address *_tsocket_address_create(TALLOC_CTX *mem_ctx,
46 const struct tsocket_address_ops *ops,
50 const char *location);
51 #define tsocket_address_create(mem_ctx, ops, state, type, location) \
52 _tsocket_address_create(mem_ctx, ops, state, sizeof(type), \
55 struct tdgram_context_ops {
58 struct tevent_req *(*recvfrom_send)(TALLOC_CTX *mem_ctx,
59 struct tevent_context *ev,
60 struct tdgram_context *dgram);
61 ssize_t (*recvfrom_recv)(struct tevent_req *req,
65 struct tsocket_address **src);
67 struct tevent_req *(*sendto_send)(TALLOC_CTX *mem_ctx,
68 struct tevent_context *ev,
69 struct tdgram_context *dgram,
70 const uint8_t *buf, size_t len,
71 const struct tsocket_address *dst);
72 ssize_t (*sendto_recv)(struct tevent_req *req,
75 struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
76 struct tevent_context *ev,
77 struct tdgram_context *dgram);
78 int (*disconnect_recv)(struct tevent_req *req,
82 struct tdgram_context *_tdgram_context_create(TALLOC_CTX *mem_ctx,
83 const struct tdgram_context_ops *ops,
87 const char *location);
88 #define tdgram_context_create(mem_ctx, ops, state, type, location) \
89 _tdgram_context_create(mem_ctx, ops, state, sizeof(type), \
92 void *_tdgram_context_data(struct tdgram_context *dgram);
93 #define tdgram_context_data(_req, _type) \
94 talloc_get_type_abort(_tdgram_context_data(_req), _type)
96 int tsocket_simple_int_recv(struct tevent_req *req, int *perrno);
98 #endif /* _TSOCKET_H */