/* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. Blocks until the request is posted. Must not be called from interrupt context! */
err_t tcpip_callback(tcpip_callback_fn function, void *ctx)
/* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. Blocks until the request is posted. Must not be called from interrupt context! */
err_t tcpip_callback(tcpip_callback_fn function, void *ctx)
{
  struct tcpip_msg *msg;
  LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(tcpip_mbox));
  msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
  if (msg == NULL) {
    return ERR_MEM;
  }
  msg->type = TCPIP_MSG_CALLBACK;
  msg->msg.cb.function = function;
  msg->msg.cb.ctx = ctx;
  sys_mbox_post(&tcpip_mbox, msg);
  return ERR_OK;
}