summaryrefslogtreecommitdiff
path: root/source4/nbt_server/packet.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 12:22:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:52 -0500
commitfccbbf354634b31c9c3cb2bca15843f13e3b77f9 (patch)
tree6678adb19a88171fce5569d2183e212d08753aba /source4/nbt_server/packet.c
parent0b0c38d899db75e6954af2618e7f063dbfc09fd6 (diff)
downloadsamba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.tar.gz
samba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.tar.bz2
samba-fccbbf354634b31c9c3cb2bca15843f13e3b77f9.zip
r10997: r11980@SERNOX (orig r10037): metze | 2005-09-05 14:21:40 +0200
add struct nbt_peer_socket and use it instead of passing const char *addr, uint16 port everyhwere (tridge: can you review this please, (make test works) metze (This used to be commit a599d7a4ae881c94be2c2d908a398838549942bb)
Diffstat (limited to 'source4/nbt_server/packet.c')
-rw-r--r--source4/nbt_server/packet.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c
index c1e0c4411b..9c9983b63c 100644
--- a/source4/nbt_server/packet.c
+++ b/source4/nbt_server/packet.c
@@ -28,9 +28,9 @@
we received a badly formed packet - log it
*/
void nbtd_bad_packet(struct nbt_name_packet *packet,
- const char *src_address, const char *reason)
+ const struct nbt_peer_socket *src, const char *reason)
{
- DEBUG(2,("nbtd: bad packet '%s' from %s\n", reason, src_address));
+ DEBUG(2,("nbtd: bad packet '%s' from %s:%d\n", reason, src->addr, src->port));
if (DEBUGLVL(5)) {
NDR_PRINT_DEBUG(nbt_name_packet, packet);
}
@@ -43,7 +43,7 @@ void nbtd_bad_packet(struct nbt_name_packet *packet,
*/
BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *packet,
- const char *src_address, int src_port)
+ const struct nbt_peer_socket *src)
{
struct nbtd_interface *iface = talloc_get_type(nbtsock->incoming.private,
struct nbtd_interface);
@@ -55,7 +55,7 @@ BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock,
}
/* if its not from the nbt port, then it wasn't a broadcast from us */
- if (src_port != lp_nbt_port()) {
+ if (src->port != lp_nbt_port()) {
return False;
}
@@ -69,7 +69,7 @@ BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock,
/* we have to loop over our interface list, seeing if its from
one of our own interfaces */
for (iface=nbtsrv->interfaces;iface;iface=iface->next) {
- if (strcmp(src_address, iface->ip_address) == 0) {
+ if (strcmp(src->addr, iface->ip_address) == 0) {
return True;
}
}
@@ -83,7 +83,7 @@ BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock,
*/
void nbtd_name_query_reply(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
+ const struct nbt_peer_socket *src,
struct nbt_name *name, uint32_t ttl,
uint16_t nb_flags, const char **addresses)
{
@@ -132,10 +132,10 @@ void nbtd_name_query_reply(struct nbt_name_socket *nbtsock,
}
DEBUG(7,("Sending name query reply for %s at %s to %s:%d\n",
- nbt_name_string(packet, name), addresses[0], src_address, src_port));
+ nbt_name_string(packet, name), addresses[0], src->addr, src->port));
nbtsrv->stats.total_sent++;
- nbt_name_reply_send(nbtsock, src_address, src_port, packet);
+ nbt_name_reply_send(nbtsock, src, packet);
failed:
talloc_free(packet);
@@ -147,7 +147,7 @@ failed:
*/
void nbtd_negative_name_query_reply(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *request_packet,
- const char *src_address, int src_port)
+ const struct nbt_peer_socket *src)
{
struct nbt_name_packet *packet;
struct nbt_name *name = &request_packet->questions[0].name;
@@ -176,10 +176,10 @@ void nbtd_negative_name_query_reply(struct nbt_name_socket *nbtsock,
ZERO_STRUCT(packet->answers[0].rdata);
DEBUG(7,("Sending negative name query reply for %s to %s:%d\n",
- nbt_name_string(packet, name), src_address, src_port));
+ nbt_name_string(packet, name), src->addr, src->port));
nbtsrv->stats.total_sent++;
- nbt_name_reply_send(nbtsock, src_address, src_port, packet);
+ nbt_name_reply_send(nbtsock, src, packet);
failed:
talloc_free(packet);
@@ -190,7 +190,7 @@ failed:
*/
void nbtd_name_registration_reply(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
+ const struct nbt_peer_socket *src,
uint8_t rcode)
{
struct nbt_name_packet *packet;
@@ -223,10 +223,10 @@ void nbtd_name_registration_reply(struct nbt_name_socket *nbtsock,
DEBUG(7,("Sending %s name registration reply for %s to %s:%d\n",
rcode==0?"positive":"negative",
- nbt_name_string(packet, name), src_address, src_port));
+ nbt_name_string(packet, name), src->addr, src->port));
nbtsrv->stats.total_sent++;
- nbt_name_reply_send(nbtsock, src_address, src_port, packet);
+ nbt_name_reply_send(nbtsock, src, packet);
failed:
talloc_free(packet);
@@ -238,7 +238,7 @@ failed:
*/
void nbtd_name_release_reply(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
+ const struct nbt_peer_socket *src,
uint8_t rcode)
{
struct nbt_name_packet *packet;
@@ -269,10 +269,10 @@ void nbtd_name_release_reply(struct nbt_name_socket *nbtsock,
DEBUG(7,("Sending %s name release reply for %s to %s:%d\n",
rcode==0?"positive":"negative",
- nbt_name_string(packet, name), src_address, src_port));
+ nbt_name_string(packet, name), src->addr, src->port));
nbtsrv->stats.total_sent++;
- nbt_name_reply_send(nbtsock, src_address, src_port, packet);
+ nbt_name_reply_send(nbtsock, src, packet);
failed:
talloc_free(packet);
@@ -284,7 +284,7 @@ failed:
*/
void nbtd_wack_reply(struct nbt_name_socket *nbtsock,
struct nbt_name_packet *request_packet,
- const char *src_address, int src_port,
+ const struct nbt_peer_socket *src,
uint32_t ttl)
{
struct nbt_name_packet *packet;
@@ -316,10 +316,10 @@ void nbtd_wack_reply(struct nbt_name_socket *nbtsock,
RSSVAL(packet->answers[0].rdata.data.data, 0, request_packet->operation);
DEBUG(7,("Sending WACK reply for %s to %s:%d\n",
- nbt_name_string(packet, name), src_address, src_port));
+ nbt_name_string(packet, name), src->addr, src->port));
nbtsrv->stats.total_sent++;
- nbt_name_reply_send(nbtsock, src_address, src_port, packet);
+ nbt_name_reply_send(nbtsock, src, packet);
failed:
talloc_free(packet);