Lines Matching refs:port

49  * Find a port with a given number
54 struct ccport *port;
56 TAILQ_FOREACH(port, &cc->port_list, node_link)
57 if (port->param.port == portno)
58 return (port);
63 * Create a new port structure, initialize it and link it to the node.
69 struct ccport *port, *p1;
74 TAILQ_FOREACH(port, &cc->port_list, node_link)
75 if (port->param.port == portno)
78 port = CCZALLOC(sizeof(*port));
79 if (port == NULL)
82 port->uarg = uarg;
83 port->cc = cc;
84 port->admin = CCPORT_STOPPED;
85 LIST_INIT(&port->conn_list);
86 TAILQ_INIT(&port->addr_list);
87 port->param.port = portno;
88 port->param.pcr = 350053;
89 port->param.max_vpi_bits = 0;
90 port->param.max_vci_bits = 8;
91 port->param.max_svpc_vpi = 0;
92 port->param.max_svcc_vpi = 0;
93 port->param.min_svcc_vci = 32;
94 port->param.num_addrs = 0;
95 TAILQ_INIT(&port->cookies);
98 if (p1->param.port > portno) {
99 TAILQ_INSERT_BEFORE(p1, port, node_link);
103 TAILQ_INSERT_TAIL(&cc->port_list, port, node_link);
105 return (port);
109 * Destroy a port. This closes all connections and aborts all the users of
115 cc_port_destroy(struct ccport *port, int shutdown)
120 TAILQ_REMOVE(&port->cc->port_list, port, node_link);
122 while ((r = TAILQ_FIRST(&port->cookies)) != NULL) {
123 TAILQ_REMOVE(&port->cookies, r, link);
130 while (!LIST_EMPTY(&port->conn_list))
131 cc_conn_abort(LIST_FIRST(&port->conn_list), shutdown);
136 while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
137 TAILQ_REMOVE(&port->addr_list, addr, port_link);
141 CCFREE(port);
145 * Management is given up on this node. Remove all addresses from the port.
150 struct ccport *port;
153 TAILQ_FOREACH(port, &cc->port_list, node_link) {
154 while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
155 TAILQ_REMOVE(&port->addr_list, addr, port_link);
179 struct ccport *port = NULL;
185 * If a port number is specified and the port does not exist,
189 if ((port = find_port(cc, portno)) == NULL)
197 TAILQ_FOREACH(addr, &port->addr_list, port_link)
200 TAILQ_FOREACH(port, &cc->port_list, node_link)
201 TAILQ_FOREACH(addr, &port->addr_list, port_link)
218 TAILQ_FOREACH(addr, &port->addr_list, port_link) {
223 TAILQ_FOREACH(port, &cc->port_list, node_link)
224 TAILQ_FOREACH(addr, &port->addr_list, port_link) {
226 *pports++ = port->param.port;
235 * return port number
238 cc_port_no(struct ccport *port)
240 return (port->param.port);
249 struct ccport *port;
252 if ((port = find_port(cc, portno)) == NULL)
256 TAILQ_FOREACH(a, &port->addr_list, port_link)
258 TAILQ_REMOVE(&port->addr_list, a, port_link);
272 struct ccport *port, *p1;
275 if ((port = find_port(cc, portno)) == NULL)
279 TAILQ_FOREACH(p1, &port->cc->port_list, node_link)
289 TAILQ_INSERT_TAIL(&port->addr_list, a, port_link);
295 * Set/get port parameters.
301 struct ccport *port;
303 if ((port = find_port(cc, portno)) == NULL)
306 *param = port->param;
314 struct ccport *port;
317 if ((port = find_port(cc, param->port)) == NULL)
320 port->param = *param;
322 port->param.num_addrs = 0;
323 TAILQ_FOREACH(addr, &port->addr_list, port_link)
324 port->param.num_addrs++;
330 * get port list
348 (*ports)[n++] = p->param.port;
360 struct ccport *port;
362 if ((port = find_port(cc, portno)) == NULL)
364 if (port->admin != CCPORT_STOPPED)
367 cc->funcs->send_uni_glob(port, port->uarg,
369 port->admin = CCPORT_RUNNING;
377 struct ccport *port;
379 if ((port = find_port(cc, portno)) == NULL)
381 if (port->admin != CCPORT_RUNNING)
384 port->admin = CCPORT_STOPPED;
389 while (!LIST_EMPTY(&port->conn_list))
390 cc_conn_destroy(LIST_FIRST(&port->conn_list));
396 * is port running?
401 struct ccport *port;
403 if ((port = find_port(cc, portno)) == NULL)
405 if (port->admin == CCPORT_RUNNING)
413 * Clear address and prefix information from the named port.
419 struct ccport *port;
421 if ((port = find_port(cc, portno)) == NULL)
424 while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
425 TAILQ_REMOVE(&port->addr_list, addr, port_link);
441 struct ccport *port;
449 TAILQ_FOREACH(port, &cc->port_list, node_link) {
450 if (portno == 0 || port->param.port == portno) {
452 TAILQ_FOREACH(addr, &port->addr_list, port_link)
475 TAILQ_FOREACH(port, &cc->port_list, node_link) {
476 if (portno == 0 || port->param.port == portno) {
477 *pp = port->param;
479 TAILQ_FOREACH(addr, &port->addr_list, port_link) {
491 find_cookie(struct ccport *port, u_int cookie)
495 TAILQ_FOREACH(r, &port->cookies, link)
505 cc_uni_response(struct ccport *port, u_int cookie, u_int reason, u_int state)
513 if (port->admin != CCPORT_RUNNING)
516 if ((req = find_cookie(port, cookie)) == NULL) {
517 cc_port_log(port, "UNI response for unknown cookie %u", cookie);
522 TAILQ_REMOVE(&port->cookies, req, link);
534 find_cref(const struct ccport *port, const struct uni_cref *cref)
538 LIST_FOREACH(conn, &port->conn_list, port_link)
546 * Signal from UNI on this port
549 cc_uni_signal(struct ccport *port, u_int cookie, u_int sig, struct uni_msg *msg)
556 if (port->admin != CCPORT_RUNNING) {
566 cc_port_log(port, "bad UNIAPI_ERROR cookie=%u", cookie);
579 if ((req = find_cookie(port, cookie)) == NULL) {
580 cc_port_log(port, "bad cookie %u in CREATE",
588 if ((conn = cc_conn_create(port->cc)) == NULL) {
592 cc_conn_ins_port(conn, port);
605 if ((conn = find_cref(port, cref)) == NULL)
616 if (port->admin == CCPORT_RUNNING)
617 port->cc->funcs->send_uni_glob(port, port->uarg,
628 if ((conn = find_cref(port, cref)) == NULL)
644 if ((conn = find_cref(port, cref)) == NULL)
659 if ((conn = find_cref(port, cref)) == NULL)
689 port->cc->funcs->send_uni_glob(port, port->uarg,
703 if ((conn = find_cref(port, cref)) == NULL)
718 if ((conn = find_cref(port, cref)) == NULL)
733 if ((conn = find_cref(port, cref)) == NULL)
749 if ((conn = find_cref(port, cref)) == NULL)
765 if ((conn = find_cref(port, cref)) == NULL)
781 if ((conn = find_cref(port, cref)) == NULL)
797 if ((conn = find_cref(port, cref)) == NULL)
812 if ((conn = find_cref(port, cref)) == NULL)
827 if ((conn = find_cref(port, cref)) == NULL)
842 if ((conn = find_cref(port, cref)) == NULL)
857 if ((conn = find_cref(port, cref)) == NULL)
905 cc_port_log(port, "bad signal %u", sig);
910 cc_port_log(port, "signal %u bad length: %zu, need %zu", len, ilen);
915 cc_port_log(port, "unknown call %u/%u", cref->cref, cref->flag);