+ * do tracing
+ */
+int admin_trace(struct admin_list *admin, struct admin_trace_req *trace)
+{
+ memcpy(&admin->trace, trace, sizeof(struct admin_trace_req));
+ return(0);
+}
+
+
+/*
+ * do blocking
+ *
+ * 0 = make port available
+ * 1 = make port administratively blocked
+ * 2 = unload port
+ * the result is returned:
+ * 0 = port is now available
+ * 1 = port is now blocked
+ * 2 = port cannot be loaded or has been unloaded
+ * -1 = port doesn't exist
+ */
+int admin_block(struct admin_queue **responsep, int portnum, int block)
+{
+ struct admin_queue *response; /* response pointer */
+ struct interface *interface;
+ struct interface_port *ifport;
+
+ /* create block response */
+ response = (struct admin_queue *)MALLOC(sizeof(struct admin_queue)+sizeof(admin_message));
+ memuse++;
+ response->num = 1;
+ /* message */
+ response->am[0].message = ADMIN_RESPONSE_CMD_BLOCK;
+ response->am[0].u.x.portnum = portnum;
+
+ /* search for port */
+ interface = interface_first;
+ while(interface)
+ {
+ ifport = interface->ifport;
+ while(ifport)
+ {
+ if (ifport->portnum == portnum)
+ break;
+ ifport = ifport->next;
+ }
+ if (ifport)
+ break;
+ interface = interface->next;
+ }
+ /* not found, we return -1 */
+ if (!ifport)
+ {
+ response->am[0].u.x.block = -1;
+ response->am[0].u.x.error = 1;
+ SPRINT(response->am[0].u.x.message, "Port %d does not exist.", portnum);
+ goto out;
+ }
+
+ /* no interface */
+ if (!ifport->mISDNport)
+ {
+ /* not loaded anyway */
+ if (block >= 2)
+ {
+ response->am[0].u.x.block = 2;
+ goto out;
+ }
+
+ /* try loading interface */
+ ifport->block = block;
+ load_port(ifport);
+
+ /* port cannot load */
+ if (ifport->block >= 2)
+ {
+ response->am[0].u.x.block = 2;
+ response->am[0].u.x.error = 1;
+ SPRINT(response->am[0].u.x.message, "Port %d will not load.", portnum);
+ goto out;
+ }
+
+ /* port loaded */
+ response->am[0].u.x.block = ifport->block;
+ goto out;
+ }
+
+ /* if we shall unload interface */
+ if (block >= 2)
+ {
+ mISDNport_close(ifport->mISDNport);
+ ifport->mISDNport = 0;
+ ifport->block = 2;
+ goto out;
+ }
+
+ /* port new blocking state */
+ ifport->block = response->am[0].u.x.block = block;
+
+ out:
+ /* attach to response chain */
+ *responsep = response;
+ responsep = &response->next;
+ return(0);
+}
+
+
+/*