Lines Matching full:ncp

70 #include "ncp.h"
96 ncp_Init(struct ncp *ncp, struct bundle *bundle) in ncp_Init() argument
98 ncp->afq = AF_INET; in ncp_Init()
99 ncp->route = NULL; in ncp_Init()
101 ncp->cfg.urgent.tcp.port = (u_short *)malloc(NDEFTCPPORTS * sizeof(u_short)); in ncp_Init()
102 if (ncp->cfg.urgent.tcp.port == NULL) { in ncp_Init()
104 ncp->cfg.urgent.tcp.nports = ncp->cfg.urgent.tcp.maxports = 0; in ncp_Init()
106 ncp->cfg.urgent.tcp.nports = ncp->cfg.urgent.tcp.maxports = NDEFTCPPORTS; in ncp_Init()
107 memcpy(ncp->cfg.urgent.tcp.port, default_urgent_tcp_ports, in ncp_Init()
110 ncp->cfg.urgent.tos = 1; in ncp_Init()
112 ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = 0; in ncp_Init()
113 ncp->cfg.urgent.udp.port = NULL; in ncp_Init()
115 mp_Init(&ncp->mp, bundle); in ncp_Init()
118 ipcp_Init(&ncp->ipcp, bundle, &bundle->links->physical->link, in ncp_Init()
121 ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link, in ncp_Init()
127 ncp_Destroy(struct ncp *ncp) in ncp_Destroy() argument
129 ipcp_Destroy(&ncp->ipcp); in ncp_Destroy()
131 ipv6cp_Destroy(&ncp->ipv6cp); in ncp_Destroy()
134 if (ncp->cfg.urgent.tcp.maxports) { in ncp_Destroy()
135 ncp->cfg.urgent.tcp.nports = ncp->cfg.urgent.tcp.maxports = 0; in ncp_Destroy()
136 free(ncp->cfg.urgent.tcp.port); in ncp_Destroy()
137 ncp->cfg.urgent.tcp.port = NULL; in ncp_Destroy()
139 if (ncp->cfg.urgent.udp.maxports) { in ncp_Destroy()
140 ncp->cfg.urgent.udp.nports = ncp->cfg.urgent.udp.maxports = 0; in ncp_Destroy()
141 free(ncp->cfg.urgent.udp.port); in ncp_Destroy()
142 ncp->cfg.urgent.udp.port = NULL; in ncp_Destroy()
147 ncp_fsmStart(struct ncp *ncp, in ncp_fsmStart() argument
160 fsm_Up(&ncp->ipcp.fsm); in ncp_fsmStart()
161 fsm_Open(&ncp->ipcp.fsm); in ncp_fsmStart()
167 fsm_Up(&ncp->ipv6cp.fsm); in ncp_fsmStart()
168 fsm_Open(&ncp->ipv6cp.fsm); in ncp_fsmStart()
177 ncp_IfaceAddrAdded(struct ncp *ncp, const struct iface_addr *addr) in ncp_IfaceAddrAdded() argument
181 ipcp_IfaceAddrAdded(&ncp->ipcp, addr); in ncp_IfaceAddrAdded()
185 ipv6cp_IfaceAddrAdded(&ncp->ipv6cp, addr); in ncp_IfaceAddrAdded()
192 ncp_IfaceAddrDeleted(struct ncp *ncp, const struct iface_addr *addr) in ncp_IfaceAddrDeleted() argument
195 ipcp_IfaceAddrDeleted(&ncp->ipcp, addr); in ncp_IfaceAddrDeleted()
199 ncp_SetLink(struct ncp *ncp, struct link *l) in ncp_SetLink() argument
201 ipcp_SetLink(&ncp->ipcp, l); in ncp_SetLink()
203 ipv6cp_SetLink(&ncp->ipv6cp, l); in ncp_SetLink()
212 ncp_Enqueue(struct ncp *ncp, int af, unsigned pri, char *ptr, int count) in ncp_Enqueue() argument
215 struct ipv6cp *ipv6cp = &ncp->ipv6cp; in ncp_Enqueue()
217 struct ipcp *ipcp = &ncp->ipcp; in ncp_Enqueue()
265 ncp_QueueLen(struct ncp *ncp) in ncp_QueueLen() argument
269 result = ipcp_QueueLen(&ncp->ipcp); in ncp_QueueLen()
271 result += ipv6cp_QueueLen(&ncp->ipv6cp); in ncp_QueueLen()
273 result += mp_QueueLen(&ncp->mp); /* Usually empty */ in ncp_QueueLen()
284 ncp_DeleteQueues(struct ncp *ncp) in ncp_DeleteQueues() argument
287 struct ipv6cp *ipv6cp = &ncp->ipv6cp; in ncp_DeleteQueues()
289 struct ipcp *ipcp = &ncp->ipcp; in ncp_DeleteQueues()
290 struct mp *mp = &ncp->mp; in ncp_DeleteQueues()
313 ncp_FillPhysicalQueues(struct ncp *ncp, struct bundle *bundle) in ncp_FillPhysicalQueues() argument
317 if (bundle->ncp.mp.active) in ncp_FillPhysicalQueues()
327 add = ncp_PushPacket(ncp, &ncp->afq, &dl->physical->link); in ncp_FillPhysicalQueues()
332 return total + ncp_QueueLen(&bundle->ncp); in ncp_FillPhysicalQueues()
337 * of what is to be pushed next, coming either from mp->out or ncp->afq.
340 ncp_PushPacket(struct ncp *ncp __unused, in ncp_PushPacket()
353 if ((res = ipcp_PushPacket(&bundle->ncp.ipcp, l))) in ncp_PushPacket()
356 res = ipv6cp_PushPacket(&bundle->ncp.ipv6cp, l); in ncp_PushPacket()
358 if ((res = ipv6cp_PushPacket(&bundle->ncp.ipv6cp, l))) in ncp_PushPacket()
361 res = ipcp_PushPacket(&bundle->ncp.ipcp, l); in ncp_PushPacket()
364 res = ipcp_PushPacket(&bundle->ncp.ipcp, l); in ncp_PushPacket()
442 ncp_IsUrgentTcpLen(struct ncp *ncp, int len) in ncp_IsUrgentTcpLen() argument
444 if (len < ncp->cfg.urgent.len) in ncp_IsUrgentTcpLen()
451 ncp_SetUrgentTcpLen(struct ncp *ncp, int len) in ncp_SetUrgentTcpLen() argument
453 ncp->cfg.urgent.len = len; in ncp_SetUrgentTcpLen()
459 struct ncp *ncp = &arg->bundle->ncp; in ncp_Show() local
464 ncp->afq == AF_INET6 ? "inet6" : "inet"); in ncp_Show()
467 if (ncp->route) { in ncp_Show()
469 route_ShowSticky(arg->prompt, ncp->route, "Sticky routes", 1); in ncp_Show()
474 if (ncp->cfg.sendpipe > 0) in ncp_Show()
475 prompt_Printf(arg->prompt, "%-20ld\n", ncp->cfg.sendpipe); in ncp_Show()
479 if (ncp->cfg.recvpipe > 0) in ncp_Show()
480 prompt_Printf(arg->prompt, "%ld\n", ncp->cfg.recvpipe); in ncp_Show()
486 if (ncp->cfg.urgent.tcp.nports == 0) in ncp_Show()
489 for (p = 0; p < ncp->cfg.urgent.tcp.nports; p++) { in ncp_Show()
492 prompt_Printf(arg->prompt, "%u", ncp->cfg.urgent.tcp.port[p]); in ncp_Show()
496 if (ncp->cfg.urgent.udp.nports == 0) in ncp_Show()
499 for (p = 0; p < ncp->cfg.urgent.udp.nports; p++) { in ncp_Show()
502 prompt_Printf(arg->prompt, "%u", ncp->cfg.urgent.udp.port[p]); in ncp_Show()
505 ncp->cfg.urgent.tos ? "yes" : "no"); in ncp_Show()
511 ncp_LayersOpen(struct ncp *ncp) in ncp_LayersOpen() argument
515 n = !!(ncp->ipcp.fsm.state == ST_OPENED); in ncp_LayersOpen()
517 n += !!(ncp->ipv6cp.fsm.state == ST_OPENED); in ncp_LayersOpen()
524 ncp_LayersUnfinished(struct ncp *ncp) in ncp_LayersUnfinished() argument
528 if (ncp->ipcp.fsm.state > ST_CLOSED || in ncp_LayersUnfinished()
529 ncp->ipcp.fsm.state == ST_STARTING) in ncp_LayersUnfinished()
533 if (ncp->ipv6cp.fsm.state > ST_CLOSED || in ncp_LayersUnfinished()
534 ncp->ipv6cp.fsm.state == ST_STARTING) in ncp_LayersUnfinished()
542 ncp_Close(struct ncp *ncp) in ncp_Close() argument
544 if (ncp->ipcp.fsm.state > ST_CLOSED || in ncp_Close()
545 ncp->ipcp.fsm.state == ST_STARTING) in ncp_Close()
546 fsm_Close(&ncp->ipcp.fsm); in ncp_Close()
549 if (ncp->ipv6cp.fsm.state > ST_CLOSED || in ncp_Close()
550 ncp->ipv6cp.fsm.state == ST_STARTING) in ncp_Close()
551 fsm_Close(&ncp->ipv6cp.fsm); in ncp_Close()
556 ncp2initial(struct ncp *ncp) in ncp2initial() argument
558 fsm2initial(&ncp->ipcp.fsm); in ncp2initial()
560 fsm2initial(&ncp->ipv6cp.fsm); in ncp2initial()