#include "configd.h"
#include "session.h"
__private_extern__
boolean_t
notify_server(mach_msg_header_t *request, mach_msg_header_t *reply)
{
mach_no_senders_notification_t *Request = (mach_no_senders_notification_t *)request;
mig_reply_error_t *Reply = (mig_reply_error_t *)reply;
reply->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request->msgh_bits), 0);
reply->msgh_remote_port = request->msgh_remote_port;
reply->msgh_size = sizeof(mig_reply_error_t);
reply->msgh_local_port = MACH_PORT_NULL;
reply->msgh_id = request->msgh_id + 100;
if ((Request->not_header.msgh_id > MACH_NOTIFY_LAST) ||
(Request->not_header.msgh_id < MACH_NOTIFY_FIRST)) {
Reply->NDR = NDR_record;
Reply->RetCode = MIG_BAD_ID;
return FALSE;
}
switch (Request->not_header.msgh_id) {
case MACH_NOTIFY_NO_SENDERS :
SCLog(_configd_verbose, LOG_DEBUG, CFSTR("No more senders for port %d, closing."),
Request->not_header.msgh_local_port);
cleanupSession(Request->not_header.msgh_local_port);
Reply->Head.msgh_bits = 0;
Reply->Head.msgh_remote_port = MACH_PORT_NULL;
Reply->RetCode = KERN_SUCCESS;
return TRUE;
default :
break;
}
SCLog(_configd_verbose, LOG_DEBUG, CFSTR("HELP!, Received notification: port=%d, msgh_id=%d"),
Request->not_header.msgh_local_port,
Request->not_header.msgh_id);
Reply->NDR = NDR_record;
Reply->RetCode = MIG_BAD_ID;
return FALSE;
}