icmpv6.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. /****************************************************************************
  2. * net/icmpv6/icmpv6.h
  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. #ifndef __NET_ICMPv6_ICMPv6_H
  21. #define __NET_ICMPv6_ICMPv6_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <nuttx/config.h>
  26. #include <sys/types.h>
  27. #include <stdint.h>
  28. #include <queue.h>
  29. #include <assert.h>
  30. #include <nuttx/mm/iob.h>
  31. #include <nuttx/net/ip.h>
  32. #include <nuttx/net/netdev.h>
  33. #include <nuttx/semaphore.h>
  34. #if defined(CONFIG_NET_ICMPv6) && !defined(CONFIG_NET_ICMPv6_NO_STACK)
  35. /****************************************************************************
  36. * Pre-processor Definitions
  37. ****************************************************************************/
  38. #define NET_ICMPv6_HAVE_STACK 1
  39. /* Allocate a new ICMPv6 data callback */
  40. #define icmpv6_callback_alloc(dev, conn) \
  41. devif_callback_alloc((dev), &(conn)->list)
  42. #define icmpv6_callback_free(dev, conn, cb) \
  43. devif_conn_callback_free((dev), (cb), &(conn)->list)
  44. /****************************************************************************
  45. * Public Type Definitions
  46. ****************************************************************************/
  47. struct net_driver_s; /* Forward reference */
  48. struct socket; /* Forward reference */
  49. struct sockaddr; /* Forward reference */
  50. struct pollfd; /* Forward reference */
  51. #ifdef CONFIG_NET_ICMPv6_SOCKET
  52. /* Representation of a IPPROTO_ICMP socket connection */
  53. struct devif_callback_s; /* Forward reference */
  54. /* This is a container that holds the poll-related information */
  55. struct icmpv6_poll_s
  56. {
  57. FAR struct socket *psock; /* IPPROTO_ICMP6 socket structure */
  58. FAR struct pollfd *fds; /* Needed to handle poll events */
  59. FAR struct devif_callback_s *cb; /* Needed to teardown the poll */
  60. };
  61. struct icmpv6_conn_s
  62. {
  63. /* Common prologue of all connection structures. */
  64. dq_entry_t node; /* Supports a double linked list */
  65. /* This is a list of ICMPV6 callbacks. Each callback represents a thread
  66. * that is stalled, waiting for a device-specific event.
  67. */
  68. FAR struct devif_callback_s *list;
  69. /* ICMPv6-specific content follows */
  70. uint16_t id; /* ICMPv6 ECHO request ID */
  71. uint8_t nreqs; /* Number of requests with no response received */
  72. uint8_t crefs; /* Reference counts on this instance */
  73. /* The device that the ICMPv6 request was sent on */
  74. FAR struct net_driver_s *dev; /* Needed to free the callback structure */
  75. /* ICMPv6 response read-ahead list. A singly linked list of type struct
  76. * iob_qentry_s where the ICMPv6 read-ahead data for the current ID is
  77. * retained.
  78. */
  79. struct iob_queue_s readahead; /* Read-ahead buffering */
  80. /* The following is a list of poll structures of threads waiting for
  81. * socket events.
  82. */
  83. struct icmpv6_poll_s pollinfo[CONFIG_NET_ICMPv6_NPOLLWAITERS];
  84. };
  85. #endif
  86. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  87. /* Used to notify a thread waiting for a particular Neighbor Advertisement */
  88. struct icmpv6_notify_s
  89. {
  90. FAR struct icmpv6_notify_s *nt_flink; /* Supports singly linked list */
  91. net_ipv6addr_t nt_ipaddr; /* Waited for IP address in the mapping */
  92. sem_t nt_sem; /* Will wake up the waiter */
  93. int nt_result; /* The result of the wait */
  94. };
  95. #endif
  96. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  97. /* Used to notify a thread waiting for a particular Router Advertisement */
  98. struct icmpv6_rnotify_s
  99. {
  100. FAR struct icmpv6_rnotify_s *rn_flink; /* Supports singly linked list */
  101. char rn_ifname[IFNAMSIZ]; /* Device name */
  102. sem_t rn_sem; /* Will wake up the waiter */
  103. int rn_result; /* The result of the wait */
  104. };
  105. #endif
  106. /****************************************************************************
  107. * Public Data
  108. ****************************************************************************/
  109. #ifdef __cplusplus
  110. # define EXTERN extern "C"
  111. extern "C"
  112. {
  113. #else
  114. # define EXTERN extern
  115. #endif
  116. #ifdef CONFIG_NET_ICMPv6_SOCKET
  117. /* PF_INET6 socket address family, IPPROTO_ICMP6 protocol interface */
  118. EXTERN const struct sock_intf_s g_icmpv6_sockif;
  119. #endif
  120. /****************************************************************************
  121. * Public Function Prototypes
  122. ****************************************************************************/
  123. /****************************************************************************
  124. * Name: icmpv6_input
  125. *
  126. * Description:
  127. * Handle incoming ICMPv6 input
  128. *
  129. * Input Parameters:
  130. * dev - The device driver structure containing the received ICMPv6
  131. * packet
  132. * iplen - The size of the IPv6 header. This may be larger than
  133. * IPv6_HDRLEN the IPv6 header if IPv6 extension headers are
  134. * present.
  135. *
  136. * Returned Value:
  137. * None
  138. *
  139. * Assumptions:
  140. * The network is locked.
  141. *
  142. ****************************************************************************/
  143. void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen);
  144. /****************************************************************************
  145. * Name: icmpv6_neighbor
  146. *
  147. * Description:
  148. * The icmpv6_solicit() call may be to send an ICMPv6 Neighbor
  149. * Solicitation to resolve an IPv6 address. This function first checks if
  150. * the IPv6 address is already in the Neighbor Table. If so, then it
  151. * returns success immediately.
  152. *
  153. * If the requested IPv6 address in not in the Neighbor Table, then this
  154. * function will send the Neighbor Solicitation, delay, then check if the
  155. * IP address is now in the Neighbor able. It will repeat this sequence
  156. * until either (1) the IPv6 address mapping is now in the Neighbor table,
  157. * or (2) a configurable number of timeouts occur without receiving the
  158. * ICMPv6 Neighbor Advertisement.
  159. *
  160. * Input Parameters:
  161. * ipaddr The IPv6 address to be queried.
  162. *
  163. * Returned Value:
  164. * Zero (OK) is returned on success and the IP address mapping can now be
  165. * found in the Neighbor Table.
  166. * On error a negated errno value is returned:
  167. *
  168. * -ETIMEDOUT: The number or retry counts has been exceed.
  169. * -EHOSTUNREACH: Could not find a route to the host
  170. *
  171. * Assumptions:
  172. * This function is called from the normal tasking context.
  173. *
  174. ****************************************************************************/
  175. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  176. int icmpv6_neighbor(const net_ipv6addr_t ipaddr);
  177. #else
  178. # define icmpv6_neighbor(i) (0)
  179. #endif
  180. /****************************************************************************
  181. * Name: icmpv6_poll
  182. *
  183. * Description:
  184. * Poll a UDP "connection" structure for availability of ICMPv6 TX data
  185. *
  186. * Input Parameters:
  187. * dev - The device driver structure to use in the send operation
  188. *
  189. * Returned Value:
  190. * None
  191. *
  192. * Assumptions:
  193. * The network is locked.
  194. *
  195. ****************************************************************************/
  196. #if defined(CONFIG_NET_ICMPv6_SOCKET) || defined(CONFIG_NET_ICMPv6_NEIGHBOR)
  197. void icmpv6_poll(FAR struct net_driver_s *dev,
  198. FAR struct icmpv6_conn_s *conn);
  199. #endif
  200. /****************************************************************************
  201. * Name: icmpv6_solicit
  202. *
  203. * Description:
  204. * Set up to send an ICMPv6 Neighbor Solicitation message
  205. *
  206. * Input Parameters:
  207. * dev - Reference to a device driver structure
  208. * ipaddr - IP address of Neighbor to be solicited
  209. *
  210. * Returned Value:
  211. * None
  212. *
  213. ****************************************************************************/
  214. void icmpv6_solicit(FAR struct net_driver_s *dev,
  215. FAR const net_ipv6addr_t ipaddr);
  216. /****************************************************************************
  217. * Name: icmpv6_rsolicit
  218. *
  219. * Description:
  220. * Set up to send an ICMPv6 Router Solicitation message. This version
  221. * is for a standalone solicitation. If formats:
  222. *
  223. * - The IPv6 header
  224. * - The ICMPv6 Neighbor Router Message
  225. *
  226. * The device IP address should have been set to the link local address
  227. * prior to calling this function.
  228. *
  229. * Input Parameters:
  230. * dev - Reference to a device driver structure
  231. *
  232. * Returned Value:
  233. * None
  234. *
  235. ****************************************************************************/
  236. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  237. void icmpv6_rsolicit(FAR struct net_driver_s *dev);
  238. #endif
  239. /****************************************************************************
  240. * Name: icmpv6_advertise
  241. *
  242. * Description:
  243. * Send an ICMPv6 Neighbor Advertisement
  244. *
  245. * Input Parameters:
  246. * dev - The device driver structure containing the outgoing ICMPv6 packet
  247. * buffer
  248. *
  249. * Returned Value:
  250. * None.
  251. *
  252. * Assumptions:
  253. * The network is locked
  254. *
  255. ****************************************************************************/
  256. void icmpv6_advertise(FAR struct net_driver_s *dev,
  257. const net_ipv6addr_t destipaddr);
  258. /****************************************************************************
  259. * Name: icmpv6_radvertise
  260. *
  261. * Description:
  262. * Send an ICMPv6 Router Advertisement
  263. *
  264. * Input Parameters:
  265. * dev - The device driver structure containing the outgoing ICMPv6 packet
  266. * buffer
  267. *
  268. * Returned Value:
  269. * None
  270. *
  271. * Assumptions:
  272. * The network is locked
  273. *
  274. ****************************************************************************/
  275. #ifdef CONFIG_NET_ICMPv6_ROUTER
  276. void icmpv6_radvertise(FAR struct net_driver_s *dev);
  277. #endif
  278. /****************************************************************************
  279. * Name: icmpv6_wait_setup
  280. *
  281. * Description:
  282. * Called BEFORE an Neighbor Solicitation is sent. This function sets up
  283. * the Neighbor Advertisement timeout before the Neighbor Solicitation
  284. * is sent so that there is no race condition when icmpv6_wait() is called.
  285. *
  286. * Assumptions:
  287. * This function is called from icmpv6_neighbor() and executes in the
  288. * normal tasking environment.
  289. *
  290. ****************************************************************************/
  291. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  292. void icmpv6_wait_setup(const net_ipv6addr_t ipaddr,
  293. FAR struct icmpv6_notify_s *notify);
  294. #else
  295. # define icmpv6_wait_setup(i,n)
  296. #endif
  297. /****************************************************************************
  298. * Name: icmpv6_wait_cancel
  299. *
  300. * Description:
  301. * Cancel any wait set after icmpv6_wait_setup is called but before
  302. * icmpv6_wait()is called (icmpv6_wait() will automatically cancel the
  303. * wait).
  304. *
  305. * Assumptions:
  306. * This function may execute in the interrupt context when called from
  307. * icmpv6_wait().
  308. *
  309. ****************************************************************************/
  310. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  311. int icmpv6_wait_cancel(FAR struct icmpv6_notify_s *notify);
  312. #else
  313. # define icmpv6_wait_cancel(n) (0)
  314. #endif
  315. /****************************************************************************
  316. * Name: icmpv6_wait
  317. *
  318. * Description:
  319. * Called each time that a Neighbor Solicitation is sent. This function
  320. * will sleep until either: (1) the matching Neighbor Advertisement is
  321. * received, or (2) a timeout occurs.
  322. *
  323. * Assumptions:
  324. * This function is called from icmpv6_neighbor() and must execute with
  325. * the network un-locked (interrupts may be disabled to keep the things
  326. * stable).
  327. *
  328. ****************************************************************************/
  329. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  330. int icmpv6_wait(FAR struct icmpv6_notify_s *notify, unsigned int timeout);
  331. #else
  332. # define icmpv6_wait(n,t) (0)
  333. #endif
  334. /****************************************************************************
  335. * Name: icmpv6_notify
  336. *
  337. * Description:
  338. * Called each time that a Neighbor Advertisement is received in order to
  339. * wake-up any threads that may be waiting for this particular Neighbor
  340. * Advertisement.
  341. *
  342. * Assumptions:
  343. * This function is called from the MAC device driver indirectly through
  344. * icmpv6_icmpv6in() will execute with the network locked.
  345. *
  346. ****************************************************************************/
  347. #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
  348. void icmpv6_notify(net_ipv6addr_t ipaddr);
  349. #else
  350. # define icmpv6_notify(i)
  351. #endif
  352. /****************************************************************************
  353. * Name: icmpv6_autoconfig
  354. *
  355. * Description:
  356. * Perform IPv6 auto-configuration to assign an IPv6 address to this
  357. * device.
  358. *
  359. * Input Parameters:
  360. * dev - The device driver structure to assign the address to
  361. *
  362. * Returned Value:
  363. * Zero (OK) is returned on success; A negated errno value is returned on
  364. * any failure.
  365. *
  366. ****************************************************************************/
  367. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  368. int icmpv6_autoconfig(FAR struct net_driver_s *dev);
  369. #endif
  370. /****************************************************************************
  371. * Name: icmpv6_rwait_setup
  372. *
  373. * Description:
  374. * Called BEFORE an Router Solicitation is sent. This function sets up
  375. * the Router Advertisement timeout before the Router Solicitation
  376. * is sent so that there is no race condition when icmpv6_rwait() is
  377. * called.
  378. *
  379. * Assumptions:
  380. * This function is called from icmpv6_autoconfig() and executes in the
  381. * normal tasking environment.
  382. *
  383. ****************************************************************************/
  384. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  385. void icmpv6_rwait_setup(FAR struct net_driver_s *dev,
  386. FAR struct icmpv6_rnotify_s *notify);
  387. #else
  388. # define icmpv6_rwait_setup(d,n)
  389. #endif
  390. /****************************************************************************
  391. * Name: icmpv6_rwait_cancel
  392. *
  393. * Description:
  394. * Cancel any wait set after icmpv6_rwait_setup() is called but before
  395. * icmpv6_rwait()is called (icmpv6_rwait() will automatically cancel the
  396. * wait).
  397. *
  398. * Assumptions:
  399. * This function may execute in the interrupt context when called from
  400. * icmpv6_rwait().
  401. *
  402. ****************************************************************************/
  403. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  404. int icmpv6_rwait_cancel(FAR struct icmpv6_rnotify_s *notify);
  405. #else
  406. # define icmpv6_rwait_cancel(n) (0)
  407. #endif
  408. /****************************************************************************
  409. * Name: icmpv6_rwait
  410. *
  411. * Description:
  412. * Called each time that a Router Solicitation is sent. This function
  413. * will sleep until either: (1) the matching Router Advertisement is
  414. * received, or (2) a timeout occurs.
  415. *
  416. * Assumptions:
  417. * This function is called from icmpv6_autoconfig() and must execute with
  418. * the network un-locked (interrupts may be disabled to keep the things
  419. * stable).
  420. *
  421. ****************************************************************************/
  422. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  423. int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify, unsigned int timeout);
  424. #else
  425. # define icmpv6_rwait(n,t) (0)
  426. #endif
  427. /****************************************************************************
  428. * Name: icmpv6_rnotify
  429. *
  430. * Description:
  431. * Called each time that a Router Advertisement is received in order to
  432. * wake-up any threads that may be waiting for this particular Router
  433. * Advertisement.
  434. *
  435. * Assumptions:
  436. * This function is called from the MAC device driver indirectly through
  437. * icmpv6_icmpv6in() will execute with the network locked.
  438. *
  439. ****************************************************************************/
  440. #ifdef CONFIG_NET_ICMPv6_AUTOCONF
  441. void icmpv6_rnotify(FAR struct net_driver_s *dev,
  442. const net_ipv6addr_t draddr,
  443. const net_ipv6addr_t prefix,
  444. unsigned int preflen);
  445. #else
  446. # define icmpv6_rnotify(d,p,l)
  447. #endif
  448. /****************************************************************************
  449. * Name: icmpv6_sock_initialize
  450. *
  451. * Description:
  452. * Initialize the IPPROTO_ICMP socket connection structures. Called once
  453. * and only from the network initialization layer.
  454. *
  455. ****************************************************************************/
  456. #ifdef CONFIG_NET_ICMPv6_SOCKET
  457. void icmpv6_sock_initialize(void);
  458. #endif
  459. /****************************************************************************
  460. * Name: icmpv6_alloc
  461. *
  462. * Description:
  463. * Allocate a new, uninitialized IPPROTO_ICMP socket connection structure.
  464. * This is normally something done by the implementation of the socket()
  465. * interface.
  466. *
  467. ****************************************************************************/
  468. #ifdef CONFIG_NET_ICMPv6_SOCKET
  469. FAR struct icmpv6_conn_s *icmpv6_alloc(void);
  470. #endif
  471. /****************************************************************************
  472. * Name: icmpv6_free
  473. *
  474. * Description:
  475. * Free a IPPROTO_ICMP socket connection structure that is no longer in
  476. * use. This should be done by the implementation of close().
  477. *
  478. ****************************************************************************/
  479. #ifdef CONFIG_NET_ICMPv6_SOCKET
  480. void icmpv6_free(FAR struct icmpv6_conn_s *conn);
  481. #endif
  482. /****************************************************************************
  483. * Name: icmpv6_active()
  484. *
  485. * Description:
  486. * Find a connection structure that is the appropriate connection to be
  487. * used with the provided ECHO request ID.
  488. *
  489. * Assumptions:
  490. * This function is called from network logic at with the network locked.
  491. *
  492. ****************************************************************************/
  493. #ifdef CONFIG_NET_ICMPv6_SOCKET
  494. FAR struct icmpv6_conn_s *icmpv6_active(uint16_t id);
  495. #endif
  496. /****************************************************************************
  497. * Name: icmpv6_nextconn
  498. *
  499. * Description:
  500. * Traverse the list of allocated packet connections
  501. *
  502. * Assumptions:
  503. * This function is called from network logic at with the network locked.
  504. *
  505. ****************************************************************************/
  506. #ifdef CONFIG_NET_ICMPv6_SOCKET
  507. FAR struct icmpv6_conn_s *icmpv6_nextconn(FAR struct icmpv6_conn_s *conn);
  508. #endif
  509. /****************************************************************************
  510. * Name: icmpv6_findconn
  511. *
  512. * Description:
  513. * Find an ICMPv6 connection structure that is expecting a ICMPv6 ECHO
  514. * response with this ID from this device
  515. *
  516. * Assumptions:
  517. * This function is called from network logic at with the network locked.
  518. *
  519. ****************************************************************************/
  520. #ifdef CONFIG_NET_ICMPv6_SOCKET
  521. FAR struct icmpv6_conn_s *icmpv6_findconn(FAR struct net_driver_s *dev,
  522. uint16_t id);
  523. #endif
  524. /****************************************************************************
  525. * Name: icmpv6_sendmsg
  526. *
  527. * Description:
  528. * Implements the sendmsg() operation for the case of the IPPROTO_ICMP6
  529. * socket. The 'buf' parameter points to a block of memory that includes
  530. * an ICMPv6 request header, followed by any payload that accompanies the
  531. * request. The 'len' parameter includes both the size of the ICMPv6
  532. * header and the following payload.
  533. *
  534. * Input Parameters:
  535. * psock A pointer to a NuttX-specific, internal socket structure
  536. * msg Message to send
  537. * flags Send flags
  538. *
  539. * Returned Value:
  540. * On success, returns the number of characters sent. On error, a negated
  541. * errno value is returned (see sendmsg() for the list of appropriate error
  542. * values.
  543. *
  544. ****************************************************************************/
  545. #ifdef CONFIG_NET_ICMPv6_SOCKET
  546. ssize_t icmpv6_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
  547. int flags);
  548. #endif
  549. /****************************************************************************
  550. * Name: icmpv6_recvmsg
  551. *
  552. * Description:
  553. * Implements the socket recvfrom interface for the case of the AF_INET
  554. * data gram socket with the IPPROTO_ICMP6 protocol. icmpv6_recvmsg()
  555. * receives ICMPv6 ECHO replies for the a socket.
  556. *
  557. * If msg_name is not NULL, and the underlying protocol provides the source
  558. * address, this source address is filled in. The argument 'msg_namelen' is
  559. * initialized to the size of the buffer associated with msg_name, and
  560. * modified on return to indicate the actual size of the address stored
  561. * there.
  562. *
  563. * Input Parameters:
  564. * psock A pointer to a NuttX-specific, internal socket structure
  565. * msg Buffer to receive the message
  566. * flags Receive flags
  567. *
  568. * Returned Value:
  569. * On success, returns the number of characters received. If no data is
  570. * available to be received and the peer has performed an orderly shutdown,
  571. * recvmsg() will return 0. Otherwise, on errors, a negated errno value is
  572. * returned (see recvmsg() for the list of appropriate error values).
  573. *
  574. ****************************************************************************/
  575. #ifdef CONFIG_NET_ICMPv6_SOCKET
  576. ssize_t icmpv6_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
  577. int flags);
  578. #endif
  579. /****************************************************************************
  580. * Name: icmpv6_pollsetup
  581. *
  582. * Description:
  583. * Setup to monitor events on one ICMPv6 socket
  584. *
  585. * Input Parameters:
  586. * psock - The IPPROTO_ICMP6 socket of interest
  587. * fds - The structure describing the events to be monitored, OR NULL if
  588. * this is a request to stop monitoring events.
  589. *
  590. * Returned Value:
  591. * 0: Success; Negated errno on failure
  592. *
  593. ****************************************************************************/
  594. #ifdef CONFIG_NET_ICMPv6_SOCKET
  595. int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds);
  596. #endif
  597. /****************************************************************************
  598. * Name: icmpv6_pollteardown
  599. *
  600. * Description:
  601. * Teardown monitoring of events on an ICMPv6 socket
  602. *
  603. * Input Parameters:
  604. * psock - The IPPROTO_ICMP6 socket of interest
  605. * fds - The structure describing the events to be monitored, OR NULL if
  606. * this is a request to stop monitoring events.
  607. *
  608. * Returned Value:
  609. * 0: Success; Negated errno on failure
  610. *
  611. ****************************************************************************/
  612. #ifdef CONFIG_NET_ICMPv6_SOCKET
  613. int icmpv6_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
  614. #endif
  615. /****************************************************************************
  616. * Name: icmpv6_linkipaddr
  617. *
  618. * Description:
  619. * Generate the device link scope ipv6 address as below:
  620. * 128 112 96 80 64 48 32 16
  621. * ---- ---- ---- ---- ---- ---- ---- ----
  622. * fe80 0000 0000 0000 0000 00ff fe00 xx00 1-byte short addr IEEE 48-bit MAC
  623. * fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short addr IEEE 48-bit MAC
  624. * fe80 0000 0000 0000 xxxx xxff fexx xxxx 6-byte normal addr IEEE 48-bit MAC
  625. * fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended addr IEEE EUI-64
  626. *
  627. * Input Parameters:
  628. * dev - The device driver structure containing the link layer address
  629. * ipaddr - Receive the device link scope ipv6 address
  630. *
  631. * Returned Value:
  632. * None
  633. *
  634. ****************************************************************************/
  635. void icmpv6_linkipaddr(FAR struct net_driver_s *dev, net_ipv6addr_t ipaddr);
  636. #undef EXTERN
  637. #ifdef __cplusplus
  638. }
  639. #endif
  640. #endif /* CONFIG_NET_ICMPv6 && !CONFIG_NET_ICMPv6_NO_STACK */
  641. #endif /* __NET_ICMPv6_ICMPv6_H */