• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.5.8/xnu-1228.15.4/bsd/net/

Lines Matching defs:np

86 static int ndrv_setspec(struct ndrv_cb *np, struct sockopt *sopt);
90 static int ndrv_do_add_multicast(struct ndrv_cb *np, struct sockopt *sopt);
91 static int ndrv_do_remove_multicast(struct ndrv_cb *np, struct sockopt *sopt);
92 static struct ndrv_multiaddr* ndrv_have_multicast(struct ndrv_cb *np, struct sockaddr* addr);
93 static void ndrv_remove_all_multicast(struct ndrv_cb *np);
127 struct ndrv_cb *np = sotondrvcb(so);
128 struct ifnet *ifp = np->nd_if;
132 kprintf("NDRV output: %x, %x, %x\n", m, so, np);
148 result = ifnet_output_raw(ifp, np->nd_proto_family, m);
165 struct ndrv_cb *np;
180 np = ndrv_find_inbound(ifp, proto_family);
181 if (np == NULL)
185 so = np->nd_socket;
209 struct ndrv_cb *np = sotondrvcb(so);
215 kprintf("NDRV attach: %x, %x, %x\n", so, proto, np);
221 MALLOC(np, struct ndrv_cb *, sizeof(*np), M_PCB, M_WAITOK);
222 if (np == NULL)
224 so->so_pcb = (caddr_t)np;
225 bzero(np, sizeof(*np));
227 kprintf("NDRV attach: %x, %x, %x\n", so, proto, np);
229 TAILQ_INIT(&np->nd_dlist);
230 np->nd_signature = NDRV_SIGNATURE;
231 np->nd_socket = so;
232 np->nd_proto.sp_family = so->so_proto->pr_domain->dom_family;
233 np->nd_proto.sp_protocol = proto;
234 np->nd_if = NULL;
235 np->nd_proto_family = 0;
236 np->nd_family = 0;
237 np->nd_unit = 0;
238 TAILQ_INSERT_TAIL(&ndrvl, np, nd_next);
250 struct ndrv_cb *np = sotondrvcb(so);
252 if (np == 0)
254 return ndrv_do_detach(np);
270 struct ndrv_cb *np = sotondrvcb(so);
273 if (np == 0)
276 if (np->nd_faddr)
280 MALLOC(np->nd_faddr, struct sockaddr_ndrv*,
284 if (np->nd_faddr == NULL)
287 bcopy((caddr_t) nam, (caddr_t) np->nd_faddr, nam->sa_len);
319 struct ndrv_cb *np;
325 np = sotondrvcb(so);
326 if (np == 0)
329 if (np->nd_laddr)
333 np->nd_laddr = _MALLOC(sizeof(struct sockaddr_ndrv), M_IFADDR, M_WAITOK);
334 if (np->nd_laddr == NULL)
336 bcopy((caddr_t) sa, (caddr_t) np->nd_laddr, sizeof(struct sockaddr_ndrv));
341 kprintf("NDRV bind: %x, %x, %s\n", so, np, dname);
373 np->nd_proto_family = PF_NDRV;
376 np->nd_proto_family = 0;
379 np->nd_if = ifp;
380 np->nd_family = ifnet_family(ifp);
381 np->nd_unit = ifnet_unit(ifp);
389 struct ndrv_cb *np = sotondrvcb(so);
391 if (np == 0)
394 if (np->nd_faddr == 0)
397 ndrv_do_disconnect(np);
436 struct ndrv_cb *np = sotondrvcb(so);
438 if (np == 0)
441 ndrv_do_disconnect(np);
448 struct ndrv_cb *np = sotondrvcb(so);
451 if (np == 0)
454 if (np->nd_laddr == 0)
457 len = np->nd_laddr->snd_len;
461 bcopy((caddr_t)np->nd_laddr, *nam,
470 struct ndrv_cb *np = sotondrvcb(so);
473 if (np == 0)
476 if (np->nd_faddr == 0)
479 len = np->nd_faddr->snd_len;
483 bcopy((caddr_t)np->nd_faddr, *nam,
494 struct ndrv_cb *np = sotondrvcb(so);
508 error = ndrv_delspec(np);
511 error = ndrv_setspec(np, sopt);
514 error = ndrv_do_add_multicast(np, sopt);
517 error = ndrv_do_remove_multicast(np, sopt);
530 ndrv_do_detach(struct ndrv_cb *np)
533 struct socket *so = np->nd_socket;
538 kprintf("NDRV detach: %x, %x\n", so, np);
540 ndrv_remove_all_multicast(np);
542 ifp = np->nd_if;
544 TAILQ_REMOVE(&ndrvl, np, nd_next);
546 u_long proto_family = np->nd_proto_family;
556 if (cur_np->nd_family == np->nd_family &&
557 cur_np->nd_unit == np->nd_unit) {
569 if (np->nd_laddr != NULL) {
570 FREE((caddr_t)np->nd_laddr, M_IFADDR);
571 np->nd_laddr = NULL;
573 FREE((caddr_t)np, M_PCB);
581 ndrv_do_disconnect(struct ndrv_cb *np)
583 struct socket * so = np->nd_socket;
585 kprintf("NDRV disconnect: %x\n", np);
587 if (np->nd_faddr)
589 FREE(np->nd_faddr, M_IFADDR);
590 np->nd_faddr = 0;
593 ndrv_do_detach(np);
656 ndrv_setspec(struct ndrv_cb *np, struct sockopt *sopt)
662 struct socket * so = np->nd_socket;
666 if (np->nd_proto_family != PF_NDRV)
668 if (np->nd_if == NULL)
752 error = ifnet_attach_protocol(np->nd_if, ndrvSpec.protocol_family,
756 np->nd_proto_family = ndrvSpec.protocol_family;
793 ndrv_delspec(struct ndrv_cb *np)
797 if (np->nd_proto_family == PF_NDRV ||
798 np->nd_proto_family == 0)
802 result = ifnet_detach_protocol(np->nd_if, np->nd_proto_family);
803 np->nd_proto_family = PF_NDRV;
811 struct ndrv_cb* np;
815 TAILQ_FOREACH(np, &ndrvl, nd_next) {
816 if (np->nd_proto_family == protocol &&
817 np->nd_if == ifp) {
818 return np;
837 struct ndrv_cb* np;
842 TAILQ_FOREACH(np, &ndrvl, nd_next) {
843 if (np->nd_family == family &&
844 np->nd_unit == unit)
848 ifp = np->nd_if;
849 if (np->nd_proto_family != 0)
850 ndrv_delspec(np);
853 ndrv_remove_all_multicast(np);
856 np->nd_if = NULL;
857 np->nd_unit = 0;
858 np->nd_family = 0;
860 so = np->nd_socket;
876 ndrv_do_add_multicast(struct ndrv_cb *np, struct sockopt *sopt)
884 if (np->nd_if == NULL)
900 if (result == 0 && ndrv_have_multicast(np, &ndrv_multi->addr))
906 result = ifnet_add_multicast(np->nd_if, &ndrv_multi->addr,
913 ndrv_multi->next = np->nd_multiaddrs;
914 np->nd_multiaddrs = ndrv_multi;
926 ndrv_do_remove_multicast(struct ndrv_cb *np, struct sockopt *sopt)
935 if (np->nd_if == NULL)
954 ndrv_entry = ndrv_have_multicast(np, multi_addr);
969 struct ndrv_multiaddr* cur = np->nd_multiaddrs;
975 np->nd_multiaddrs = cur->next;
998 ndrv_have_multicast(struct ndrv_cb *np, struct sockaddr* inAddr)
1001 for (cur = np->nd_multiaddrs; cur != NULL; cur = cur->next)
1016 ndrv_remove_all_multicast(struct ndrv_cb* np)
1020 if (np->nd_if != NULL)
1022 while (np->nd_multiaddrs != NULL)
1024 cur = np->nd_multiaddrs;
1025 np->nd_multiaddrs = cur->next;