Sending and receiving MAC command from Arduino

I am trying to perform the MAC command exchange between the end device and the server.

Now I have
Gateway: RPi3 + LoRaServer LoRa Gateway OS + RAK831 LoRa transceiver
End device: Arduino Due + Dragino lora shield

After researching, I nearly cannot find an Arduino LMIC library that can support interpreting MAC commands. For example, reading the opt field in the MAC message and changing the parameter accordingly.

For instance, I want the server to send a message with RXParamSetupReq to change the frequency of receiver window. After the end device receives it, it changes the frequency accordingly and reply a RXParamSetupAns to the server. Then the server use that frequency to transmit the downlink message.

Is there any Arduino library and reference to help my implementation? Thank you.