| 50 | Next, we need to call the new callbacks upon the receipt of the two relevant IPC messages. We already have the case of {{{IPC_MBOX_TOKEN_END_RESERVATION}}} from our previous implementation of TokenMAC. This function called the {{{token_new_reservation_callback()}}} function pointer to let the AP know that it should issue a new token reservation period. We want to keep this behavior, but now we should additionally call the new {{{token_stats_end_callback}}} callback. We should also add the {{{IPC_MBOX_TOKEN_NEW_RESERVATION}}} case to the switch statement can call the {{{token_stats_start_callback()}}} function pointer. Furthermore, we should pass the address of the whichever device owns this reservation period as well as the duration of the reservation period as arguments to the call. |
| 51 | |
| 52 | {{{ |
| 53 | #!c |
| 54 | |
| 55 | case IPC_MBOX_TOKEN_END_RESERVATION: |
| 56 | token_stats_end_callback(); |
| 57 | token_new_reservation_callback(); |
| 58 | break; |
| 59 | case IPC_MBOX_TOKEN_NEW_RESERVATION: |
| 60 | token_stats_start_callback( ((ipc_token_new_reservation*)msg->payload_ptr)->addr, |
| 61 | ((ipc_token_new_reservation*)msg->payload_ptr)->res_duration ); |
| 62 | break; |
| 63 | }}} |
| 64 | |