/** * @brief Resets the MAC layer * * The MLME-RESET.request primitive allows the next higher layer to request * that the MLME performs a reset operation. * * @param m Pointer to the MLME_RESET.request given by the NHLE */ void mlme_reset_request(uint8_t *m) { mlme_reset_req_t *mrr = (mlme_reset_req_t *)BMM_BUFFER_POINTER((buffer_t *)m); /* Wakeup the radio */ mac_trx_wakeup(); /* Start MAC reset functionality */ uint8_t status = mac_reset(mrr->SetDefaultPIB); /* Set radio to sleep if allowed */ mac_sleep_trans(); /* * As this is a mlme_reset request, all the requests, data (whether * direct * or indirect), incoming frames are removed from the queues */ flush_queues(); send_reset_conf((buffer_t *)m, status); } /* mlme_reset_request() */
void close_socket (DESCRIPTOR_DATA * d) { DESCRIPTOR_DATA *tmp; char buf[100]; if (d->connected == CON_SOFT_REBOOT) /* Soft reboot sockets. */ return; if (d->character) /* I don't know about this one. . . */ d->character->desc = 0; close (d->hSocketFD); flush_queues (d); if (d->hSocketFD == maxdesc) --maxdesc; if (d->character && d->connected != CON_PLYNG) { unload_pc (d->character); d->character = NULL; } else if (d->character && d->connected == CON_PLYNG) { if (d->character->pc) d->character->pc->last_disconnect = time (0); save_char (d->character, true); /* KLUDGE: If the player is disconnecting is staff, he will get a message about himself disconnecting. However, he will be gone before that message gets to him, and the message will sit around in memory. By saying he isn't connected, the message will not be sent. (connected = -1) */ if (d->original) { d->character = d->original; d->original = NULL; } sprintf (s_buf, "%s has lost link.\n", d->character->tname); d->connected = CON_LINKDEAD; send_to_gods (s_buf); d->connected = CON_PLYNG; if (d->snoop.snooping && d->snoop.snooping->desc) { d->snoop.snooping->desc->snoop.snoop_by = 0; d->snoop.snooping = 0; } if (d->snoop.snoop_by && d->snoop.snoop_by->desc) { d->snoop.snoop_by->desc->snoop.snooping = 0; d->snoop.snoop_by = 0; } if (d->character->pc) d->character->pc->owner = 0; if (IS_MORTAL (d->character) && !IS_SET (d->character->flags, FLAG_GUEST)) { act ("$n has lost link.", true, d->character, 0, 0, TO_ROOM); sprintf (buf, "Closing link to: %s.", GET_NAME (d->character)); system_log (buf, false); d->character->desc = 0; } else if (IS_SET (d->character->flags, FLAG_GUEST)) do_quit (d->character, "", 0); } if (d->acct) delete d->acct; if (next_to_process == d) next_to_process = next_to_process->next; if (d == descriptor_list) { /* this is the head of the list */ descriptor_list = descriptor_list->next; } else { for (tmp = descriptor_list; tmp->next; tmp = tmp->next) if (tmp->next == d) { tmp->next = tmp->next->next; break; } } d->next = NULL; free_descriptor (d); socket_closed = true; }