Lines Matching refs:pcb

78   struct raw_pcb *pcb, *prev;
89 pcb = raw_pcbs;
92 while ((eaten == 0) && (pcb != NULL)) {
93 if ((pcb->protocol == proto) &&
94 (ip_addr_isany(&pcb->local_ip) ||
95 ip_addr_cmp(&(pcb->local_ip), &current_iphdr_dest))) {
98 if (ip_get_option(pcb, SOF_BROADCAST) || !ip_addr_isbroadcast(&current_iphdr_dest, inp))
102 if (pcb->recv != NULL) {
104 if (pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr()) != 0) {
109 /* move the pcb to the front of raw_pcbs so that is
111 prev->next = pcb->next;
112 pcb->next = raw_pcbs;
113 raw_pcbs = pcb;
121 prev = pcb;
122 pcb = pcb->next;
130 * @param pcb RAW PCB to be bound with a local address ipaddr.
142 raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr)
144 ip_addr_set(&pcb->local_ip, ipaddr);
154 * @param pcb RAW PCB to be connected with remote address ipaddr and port.
162 raw_connect(struct raw_pcb *pcb, ip_addr_t *ipaddr)
164 ip_addr_set(&pcb->remote_ip, ipaddr);
183 raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg)
186 pcb->recv = recv;
187 pcb->recv_arg = recv_arg;
197 * @param pcb the raw pcb which to send
203 raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
248 if (!ip_get_option(pcb, SOF_BROADCAST) && ip_addr_isbroadcast(ipaddr, netif)) {
249 LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb));
258 if (ip_addr_isany(&pcb->local_ip)) {
263 src_ip = &(pcb->local_ip);
266 NETIF_SET_HWADDRHINT(netif, &pcb->addr_hint);
267 err = ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif);
281 * @param pcb the raw pcb which to send
286 raw_send(struct raw_pcb *pcb, struct pbuf *p)
288 return raw_sendto(pcb, p, &pcb->remote_ip);
294 * @param pcb RAW PCB to be removed. The PCB is removed from the list of
300 raw_remove(struct raw_pcb *pcb)
303 /* pcb to be removed is first in list? */
304 if (raw_pcbs == pcb) {
305 /* make list start at 2nd pcb */
307 /* pcb not 1st in list */
310 /* find pcb in raw_pcbs list */
311 if (pcb2->next != NULL && pcb2->next == pcb) {
312 /* remove pcb from list */
313 pcb2->next = pcb->next;
317 memp_free(MEMP_RAW_PCB, pcb);
333 struct raw_pcb *pcb;
337 pcb = (struct raw_pcb *)memp_malloc(MEMP_RAW_PCB);
339 if (pcb != NULL) {
341 memset(pcb, 0, sizeof(struct raw_pcb));
342 pcb->protocol = proto;
343 pcb->ttl = RAW_TTL;
344 pcb->next = raw_pcbs;
345 raw_pcbs = pcb;
347 return pcb;