icmp_poll.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /****************************************************************************
  2. * net/icmp/icmp_poll.c
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. /****************************************************************************
  21. * Included Files
  22. ****************************************************************************/
  23. #include <nuttx/config.h>
  24. #if defined(CONFIG_NET) && defined(CONFIG_NET_ICMP) && \
  25. defined(CONFIG_NET_ICMP_SOCKET)
  26. #include <debug.h>
  27. #include <nuttx/net/netconfig.h>
  28. #include <nuttx/net/netdev.h>
  29. #include <nuttx/net/icmp.h>
  30. #include "devif/devif.h"
  31. #include "icmp/icmp.h"
  32. /****************************************************************************
  33. * Public Functions
  34. ****************************************************************************/
  35. /****************************************************************************
  36. * Name: icmp_poll
  37. *
  38. * Description:
  39. * Poll a device "connection" structure for availability of ICMP TX data
  40. *
  41. * Input Parameters:
  42. * dev - The device driver structure to use in the send operation
  43. * conn - A pointer to the ICMP connection structure
  44. *
  45. * Returned Value:
  46. * None
  47. *
  48. * Assumptions:
  49. * The network is locked.
  50. *
  51. ****************************************************************************/
  52. void icmp_poll(FAR struct net_driver_s *dev, FAR struct icmp_conn_s *conn)
  53. {
  54. /* Setup for the application callback */
  55. dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMP_HDRLEN];
  56. dev->d_len = 0;
  57. dev->d_sndlen = 0;
  58. /* Perform the application callback */
  59. devif_conn_event(dev, conn, ICMP_POLL, conn->list);
  60. }
  61. #endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_SOCKET */