mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
s4:lib/stream: s/private/private_data
metze
This commit is contained in:
parent
7db458a56c
commit
79ae2de001
@ -37,7 +37,7 @@ struct packet_context {
|
|||||||
struct socket_context *sock;
|
struct socket_context *sock;
|
||||||
struct tevent_context *ev;
|
struct tevent_context *ev;
|
||||||
size_t packet_size;
|
size_t packet_size;
|
||||||
void *private;
|
void *private_data;
|
||||||
struct tevent_fd *fde;
|
struct tevent_fd *fde;
|
||||||
bool serialise;
|
bool serialise;
|
||||||
int processing;
|
int processing;
|
||||||
@ -105,9 +105,9 @@ _PUBLIC_ void packet_set_error_handler(struct packet_context *pc, packet_error_h
|
|||||||
/*
|
/*
|
||||||
set the private pointer passed to the callback functions
|
set the private pointer passed to the callback functions
|
||||||
*/
|
*/
|
||||||
_PUBLIC_ void packet_set_private(struct packet_context *pc, void *private)
|
_PUBLIC_ void packet_set_private(struct packet_context *pc, void *private_data)
|
||||||
{
|
{
|
||||||
pc->private = private;
|
pc->private_data = private_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,15 +184,15 @@ static void packet_error(struct packet_context *pc, NTSTATUS status)
|
|||||||
{
|
{
|
||||||
pc->sock = NULL;
|
pc->sock = NULL;
|
||||||
if (pc->error_handler) {
|
if (pc->error_handler) {
|
||||||
pc->error_handler(pc->private, status);
|
pc->error_handler(pc->private_data, status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* default error handler is to free the callers private pointer */
|
/* default error handler is to free the callers private pointer */
|
||||||
if (!NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
|
if (!NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
|
||||||
DEBUG(0,("packet_error on %s - %s\n",
|
DEBUG(0,("packet_error on %s - %s\n",
|
||||||
talloc_get_name(pc->private), nt_errstr(status)));
|
talloc_get_name(pc->private_data), nt_errstr(status)));
|
||||||
}
|
}
|
||||||
talloc_free(pc->private);
|
talloc_free(pc->private_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,9 +210,9 @@ static void packet_eof(struct packet_context *pc)
|
|||||||
used to put packets on event boundaries
|
used to put packets on event boundaries
|
||||||
*/
|
*/
|
||||||
static void packet_next_event(struct tevent_context *ev, struct tevent_timer *te,
|
static void packet_next_event(struct tevent_context *ev, struct tevent_timer *te,
|
||||||
struct timeval t, void *private)
|
struct timeval t, void *private_data)
|
||||||
{
|
{
|
||||||
struct packet_context *pc = talloc_get_type(private, struct packet_context);
|
struct packet_context *pc = talloc_get_type(private_data, struct packet_context);
|
||||||
if (pc->num_read != 0 && pc->packet_size != 0 &&
|
if (pc->num_read != 0 && pc->packet_size != 0 &&
|
||||||
pc->packet_size <= pc->num_read) {
|
pc->packet_size <= pc->num_read) {
|
||||||
packet_recv(pc);
|
packet_recv(pc);
|
||||||
@ -330,7 +330,7 @@ next_partial:
|
|||||||
/* see if its a full request */
|
/* see if its a full request */
|
||||||
blob = pc->partial;
|
blob = pc->partial;
|
||||||
blob.length = pc->num_read;
|
blob.length = pc->num_read;
|
||||||
status = pc->full_request(pc->private, blob, &pc->packet_size);
|
status = pc->full_request(pc->private_data, blob, &pc->packet_size);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
packet_error(pc, status);
|
packet_error(pc, status);
|
||||||
return;
|
return;
|
||||||
@ -375,7 +375,7 @@ next_partial:
|
|||||||
|
|
||||||
pc->busy = true;
|
pc->busy = true;
|
||||||
|
|
||||||
status = pc->callback(pc->private, blob);
|
status = pc->callback(pc->private_data, blob);
|
||||||
|
|
||||||
pc->busy = false;
|
pc->busy = false;
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ next_partial:
|
|||||||
blob = pc->partial;
|
blob = pc->partial;
|
||||||
blob.length = pc->num_read;
|
blob.length = pc->num_read;
|
||||||
|
|
||||||
status = pc->full_request(pc->private, blob, &pc->packet_size);
|
status = pc->full_request(pc->private_data, blob, &pc->packet_size);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
packet_error(pc, status);
|
packet_error(pc, status);
|
||||||
return;
|
return;
|
||||||
@ -495,7 +495,7 @@ _PUBLIC_ void packet_queue_run(struct packet_context *pc)
|
|||||||
*/
|
*/
|
||||||
_PUBLIC_ NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob,
|
_PUBLIC_ NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob,
|
||||||
packet_send_callback_fn_t send_callback,
|
packet_send_callback_fn_t send_callback,
|
||||||
void *private)
|
void *private_data)
|
||||||
{
|
{
|
||||||
struct send_element *el;
|
struct send_element *el;
|
||||||
el = talloc(pc, struct send_element);
|
el = talloc(pc, struct send_element);
|
||||||
@ -505,7 +505,7 @@ _PUBLIC_ NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob
|
|||||||
el->blob = blob;
|
el->blob = blob;
|
||||||
el->nsent = 0;
|
el->nsent = 0;
|
||||||
el->send_callback = send_callback;
|
el->send_callback = send_callback;
|
||||||
el->send_callback_private = private;
|
el->send_callback_private = private_data;
|
||||||
|
|
||||||
/* if we aren't going to free the packet then we must reference it
|
/* if we aren't going to free the packet then we must reference it
|
||||||
to ensure it doesn't disappear before going out */
|
to ensure it doesn't disappear before going out */
|
||||||
@ -517,7 +517,7 @@ _PUBLIC_ NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob
|
|||||||
talloc_steal(el, blob.data);
|
talloc_steal(el, blob.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (private && !talloc_reference(el, private)) {
|
if (private_data && !talloc_reference(el, private_data)) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ _PUBLIC_ NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob)
|
|||||||
/*
|
/*
|
||||||
a full request checker for NBT formatted packets (first 3 bytes are length)
|
a full request checker for NBT formatted packets (first 3 bytes are length)
|
||||||
*/
|
*/
|
||||||
_PUBLIC_ NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *size)
|
_PUBLIC_ NTSTATUS packet_full_request_nbt(void *private_data, DATA_BLOB blob, size_t *size)
|
||||||
{
|
{
|
||||||
if (blob.length < 4) {
|
if (blob.length < 4) {
|
||||||
return STATUS_MORE_ENTRIES;
|
return STATUS_MORE_ENTRIES;
|
||||||
@ -555,7 +555,7 @@ _PUBLIC_ NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t
|
|||||||
work out if a packet is complete for protocols that use a 32 bit network byte
|
work out if a packet is complete for protocols that use a 32 bit network byte
|
||||||
order length
|
order length
|
||||||
*/
|
*/
|
||||||
_PUBLIC_ NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size)
|
_PUBLIC_ NTSTATUS packet_full_request_u32(void *private_data, DATA_BLOB blob, size_t *size)
|
||||||
{
|
{
|
||||||
if (blob.length < 4) {
|
if (blob.length < 4) {
|
||||||
return STATUS_MORE_ENTRIES;
|
return STATUS_MORE_ENTRIES;
|
||||||
|
@ -24,20 +24,20 @@ struct packet_context;
|
|||||||
struct tevent_context;
|
struct tevent_context;
|
||||||
struct tevent_fd;
|
struct tevent_fd;
|
||||||
|
|
||||||
typedef NTSTATUS (*packet_full_request_fn_t)(void *private,
|
typedef NTSTATUS (*packet_full_request_fn_t)(void *private_data,
|
||||||
DATA_BLOB blob, size_t *packet_size);
|
DATA_BLOB blob, size_t *packet_size);
|
||||||
typedef NTSTATUS (*packet_callback_fn_t)(void *private, DATA_BLOB blob);
|
typedef NTSTATUS (*packet_callback_fn_t)(void *private_data, DATA_BLOB blob);
|
||||||
|
|
||||||
/* Used to notify that a packet has been sent, and is on the wire */
|
/* Used to notify that a packet has been sent, and is on the wire */
|
||||||
typedef void (*packet_send_callback_fn_t)(void *private);
|
typedef void (*packet_send_callback_fn_t)(void *private_data);
|
||||||
typedef void (*packet_error_handler_fn_t)(void *private, NTSTATUS status);
|
typedef void (*packet_error_handler_fn_t)(void *private_data, NTSTATUS status);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct packet_context *packet_init(TALLOC_CTX *mem_ctx);
|
struct packet_context *packet_init(TALLOC_CTX *mem_ctx);
|
||||||
void packet_set_callback(struct packet_context *pc, packet_callback_fn_t callback);
|
void packet_set_callback(struct packet_context *pc, packet_callback_fn_t callback);
|
||||||
void packet_set_error_handler(struct packet_context *pc, packet_error_handler_fn_t handler);
|
void packet_set_error_handler(struct packet_context *pc, packet_error_handler_fn_t handler);
|
||||||
void packet_set_private(struct packet_context *pc, void *private);
|
void packet_set_private(struct packet_context *pc, void *private_data);
|
||||||
void packet_set_full_request(struct packet_context *pc, packet_full_request_fn_t callback);
|
void packet_set_full_request(struct packet_context *pc, packet_full_request_fn_t callback);
|
||||||
void packet_set_socket(struct packet_context *pc, struct socket_context *sock);
|
void packet_set_socket(struct packet_context *pc, struct socket_context *sock);
|
||||||
void packet_set_event_context(struct packet_context *pc, struct tevent_context *ev);
|
void packet_set_event_context(struct packet_context *pc, struct tevent_context *ev);
|
||||||
@ -51,13 +51,13 @@ void packet_recv_enable(struct packet_context *pc);
|
|||||||
NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob);
|
NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob);
|
||||||
NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob,
|
NTSTATUS packet_send_callback(struct packet_context *pc, DATA_BLOB blob,
|
||||||
packet_send_callback_fn_t send_callback,
|
packet_send_callback_fn_t send_callback,
|
||||||
void *private);
|
void *private_data);
|
||||||
void packet_queue_run(struct packet_context *pc);
|
void packet_queue_run(struct packet_context *pc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pre-canned handlers
|
pre-canned handlers
|
||||||
*/
|
*/
|
||||||
NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *size);
|
NTSTATUS packet_full_request_nbt(void *private_data, DATA_BLOB blob, size_t *size);
|
||||||
NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size);
|
NTSTATUS packet_full_request_u32(void *private_data, DATA_BLOB blob, size_t *size);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user