PacketRecvInterface.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @file PacketRecvInterface.c
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #include <flow/PacketRecvInterface.h>
  23. void _PacketRecvInterface_job_operation (PacketRecvInterface *i)
  24. {
  25. ASSERT(i->state == PRI_STATE_OPERATION_PENDING)
  26. DebugObject_Access(&i->d_obj);
  27. // set state
  28. i->state = PRI_STATE_BUSY;
  29. // call handler
  30. i->handler_operation(i->user_provider, i->job_operation_data);
  31. return;
  32. }
  33. void _PacketRecvInterface_job_done (PacketRecvInterface *i)
  34. {
  35. ASSERT(i->state == PRI_STATE_DONE_PENDING)
  36. DebugObject_Access(&i->d_obj);
  37. // set state
  38. i->state = PRI_STATE_NONE;
  39. // call handler
  40. i->handler_done(i->user_user, i->job_done_len);
  41. return;
  42. }