* Get the local or remote IP address and port of a netconn. * For RAW netconns, this returns the protocol instead of a port! * * @param conn the netconn to query * @param addr a pointer to which to save the IP address * @param port a pointer to which to save the port (or protocol for RAW) * @param local 1 to get the local IP address, 0 to get the remote one * @return ERR_CONN for invalid co
| 132 | * ERR_OK if the information was retrieved |
| 133 | */ |
| 134 | err_t |
| 135 | netconn_getaddr(struct netconn *conn, ip_addr_t *addr, u16_t *port, u8_t local) |
| 136 | { |
| 137 | struct api_msg msg; |
| 138 | err_t err; |
| 139 | |
| 140 | LWIP_ERROR("netconn_getaddr: invalid conn", (conn != NULL), return ERR_ARG;); |
| 141 | LWIP_ERROR("netconn_getaddr: invalid addr", (addr != NULL), return ERR_ARG;); |
| 142 | LWIP_ERROR("netconn_getaddr: invalid port", (port != NULL), return ERR_ARG;); |
| 143 | |
| 144 | msg.function = do_getaddr; |
| 145 | msg.msg.conn = conn; |
| 146 | msg.msg.msg.ad.ipaddr = addr; |
| 147 | msg.msg.msg.ad.port = port; |
| 148 | msg.msg.msg.ad.local = local; |
| 149 | err = TCPIP_APIMSG(&msg); |
| 150 | |
| 151 | NETCONN_SET_SAFE_ERR(conn, err); |
| 152 | return err; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Bind a netconn to a specific local IP address and port. |
no outgoing calls
no test coverage detected