summaryrefslogtreecommitdiff
path: root/lib/tsocket/tsocket.h
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-05-21 11:39:38 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:17 +0200
commit36b97d0bb9fe004f3d8a500f3af83dff34f86d7b (patch)
treed95abbb1f1a83051f9f3a526f57197cf4c4d55c9 /lib/tsocket/tsocket.h
parent3a8b7b0518b33b016d2dbb8dd23d35ef1c6aaa5c (diff)
downloadsamba-36b97d0bb9fe004f3d8a500f3af83dff34f86d7b.tar.gz
lib/tsocket: add tdgram_inet_udp_broadcast_socket()
This is similar to tdgram_inet_udp_socket(), but it allows the use of ipv4 broadcast traffic. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/tsocket/tsocket.h')
-rw-r--r--lib/tsocket/tsocket.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket.h b/lib/tsocket/tsocket.h
index 296c7c555ae..f52b7466dfb 100644
--- a/lib/tsocket/tsocket.h
+++ b/lib/tsocket/tsocket.h
@@ -705,6 +705,8 @@ bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram,
* communication. The function will allocate the memory.
*
* @return 0 on success, -1 on error with errno set.
+ *
+ * @see tdgram_inet_udp_broadcast_socket()
*/
int tdgram_inet_udp_socket(const struct tsocket_address *local,
const struct tsocket_address *remote,
@@ -722,6 +724,33 @@ int _tdgram_inet_udp_socket(const struct tsocket_address *local,
#ifdef DOXYGEN
/**
+ * @brief Create a tdgram_context for a ipv4 UDP broadcast (and unicast) communication.
+ *
+ * @param[in] local An 'inet' (ipv4 only) tsocket_address for the local endpoint.
+ *
+ * @param[in] mem_ctx The talloc memory context to use.
+ *
+ * @param[in] dgram The tdgram_context pointer to setup the udp
+ * communication. The function will allocate the memory.
+ *
+ * @return 0 on success, -1 on error with errno set.
+ *
+ * @see tdgram_inet_udp_socket()
+ */
+int tdgram_inet_udp_broadcast_socket(const struct tsocket_address *local,
+ TALLOC_CTX *mem_ctx,
+ struct tdgram_context **dgram);
+#else
+int _tdgram_inet_udp_broadcast_socket(const struct tsocket_address *local,
+ TALLOC_CTX *mem_ctx,
+ struct tdgram_context **dgram,
+ const char *location);
+#define tdgram_inet_udp_broadcast_socket(local, mem_ctx, dgram) \
+ _tdgram_inet_udp_broadcast_socket(local, mem_ctx, dgram, __location__)
+#endif
+
+#ifdef DOXYGEN
+/**
* @brief Create a tdgram_context for unix domain datagram communication.
*
* @param[in] local An 'unix' tsocket_address for the local endpoint.