3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/usr.sbin/atm/scspd/scsp_print.c,v 1.3 1999/08/28 01:15:34 peter Exp $
27 * @(#) $DragonFly: src/usr.sbin/atm/scspd/scsp_print.c,v 1.2 2003/06/17 04:29:52 dillon Exp $
32 * Server Cache Synchronization Protocol (SCSP) Support
33 * ----------------------------------------------------
39 #include <sys/types.h>
40 #include <sys/param.h>
41 #include <sys/socket.h>
43 #include <netinet/in.h>
44 #include <netatm/port.h>
45 #include <netatm/queue.h>
46 #include <netatm/atm.h>
47 #include <netatm/atm_if.h>
48 #include <netatm/atm_sap.h>
49 #include <netatm/atm_sys.h>
50 #include <netatm/atm_ioctl.h>
69 static char indent[MAX_INDENT + 1];
73 * Value-name translation table entry
79 typedef struct type_name Type_name;
83 * SCSP name-type tables
85 static Type_name if_msg_types[] = {
86 { "Config Request", SCSP_CFG_REQ },
87 { "Config Response", SCSP_CFG_RSP },
88 { "Cache Indication", SCSP_CACHE_IND },
89 { "Cache Response", SCSP_CACHE_RSP },
90 { "Solicit Indication", SCSP_SOLICIT_IND },
91 { "Solicit Response", SCSP_SOLICIT_RSP },
92 { "Cache Update Indication", SCSP_UPDATE_IND },
93 { "Cache Update Request", SCSP_UPDATE_REQ },
94 { "Cache Update Response", SCSP_UPDATE_RSP },
98 static Type_name msg_types[] = {
99 { "Cache Alignment", SCSP_CA_MSG },
100 { "CSU Request", SCSP_CSU_REQ_MSG },
101 { "CSU Reply", SCSP_CSU_REPLY_MSG },
102 { "CSU Solicit", SCSP_CSUS_MSG },
103 { "Hello", SCSP_HELLO_MSG },
107 static Type_name proto_types[] = {
108 { "ATMARP", SCSP_PROTO_ATMARP },
109 { "NHRP", SCSP_PROTO_NHRP },
110 { "MARS", SCSP_PROTO_MARS },
111 { "DHCP", SCSP_PROTO_DHCP },
112 { "LNNI", SCSP_PROTO_LNNI },
116 static Type_name ext_types[] = {
117 { "End of Extensions", SCSP_EXT_END },
118 { "Authentication", SCSP_EXT_AUTH },
119 { "Vendor Private", SCSP_EXT_VENDOR },
123 static Type_name hfsm_state_names[] = {
124 { "Down", SCSP_HFSM_DOWN },
125 { "Waiting", SCSP_HFSM_WAITING },
126 { "Unidirectional", SCSP_HFSM_UNI_DIR },
127 { "Bidirectional", SCSP_HFSM_BI_DIR },
131 static Type_name hfsm_event_names[] = {
132 { "VC open", SCSP_HFSM_VC_ESTAB },
133 { "VC closed", SCSP_HFSM_VC_CLOSED },
134 { "Hello timer", SCSP_HFSM_HELLO_T },
135 { "Receive timer", SCSP_HFSM_RCV_T },
136 { "Msg received", SCSP_HFSM_RCVD },
140 static Type_name cafsm_state_names[] = {
141 { "Down", SCSP_CAFSM_DOWN },
142 { "Master/Slave negotiation", SCSP_CAFSM_NEG },
143 { "Master", SCSP_CAFSM_MASTER },
144 { "Slave", SCSP_CAFSM_SLAVE },
145 { "Update cache", SCSP_CAFSM_UPDATE },
146 { "Aligned", SCSP_CAFSM_ALIGNED },
150 static Type_name cafsm_event_names[] = {
151 { "Hello FSM up", SCSP_CAFSM_HELLO_UP },
152 { "Hello FSM down", SCSP_CAFSM_HELLO_DOWN },
153 { "CA received", SCSP_CAFSM_CA_MSG },
154 { "CSU Solicit received", SCSP_CAFSM_CSUS_MSG },
155 { "CSU Request received", SCSP_CAFSM_CSU_REQ },
156 { "CSU Reply received", SCSP_CAFSM_CSU_REPLY },
157 { "CA timer", SCSP_CAFSM_CA_T },
158 { "CSUS timer", SCSP_CAFSM_CSUS_T },
159 { "CSU timer", SCSP_CAFSM_CSU_T },
160 { "Cache Update", SCSP_CAFSM_CACHE_UPD },
161 { "Cache Response", SCSP_CAFSM_CACHE_RSP },
165 static Type_name cifsm_state_names[] = {
166 { "Null", SCSP_CIFSM_NULL },
167 { "Summarize", SCSP_CIFSM_SUM },
168 { "Update", SCSP_CIFSM_UPD },
169 { "Aligned", SCSP_CIFSM_ALIGN },
173 static Type_name cifsm_event_names[] = {
174 { "CA FSM down", SCSP_CIFSM_CA_DOWN },
175 { "CA FSM to Summarize",SCSP_CIFSM_CA_SUMM },
176 { "CA FSM to Update", SCSP_CIFSM_CA_UPD },
177 { "CA FSM to Aligned", SCSP_CIFSM_CA_ALIGN },
178 { "Solicit Rsp", SCSP_CIFSM_SOL_RSP },
179 { "Update Req", SCSP_CIFSM_UPD_REQ },
180 { "Update Rsp", SCSP_CIFSM_UPD_RSP },
181 { "CSU Request", SCSP_CIFSM_CSU_REQ },
182 { "CSU Reply", SCSP_CIFSM_CSU_REPLY },
183 { "CSU Solicit", SCSP_CIFSM_CSU_SOL },
187 static Type_name atmarp_state_names[] = {
188 { "New", SCSP_ASTATE_NEW },
189 { "Updated", SCSP_ASTATE_UPD },
190 { "Deleted", SCSP_ASTATE_DEL },
196 * Initialize the indent string
213 * Increment the indent string
225 if (strlen(indent) >= MAX_INDENT)
232 * Decrement the indent string
244 if (strlen(indent) < MIN_INDENT)
246 indent[strlen(indent) - 2] = '\0';
252 * Search for a type in a name-type table
255 * type the value being searched for
256 * tbl pointer to the table to search
259 * pointer to a string identifying the type
263 scsp_type_name(type, tbl)
272 for (i = 0; tbl[i].name != (char *)0 && tbl[i].type != type;
277 * Check the result and return the appropriate value
287 * Format a Hello FSM state name
293 * pointer to a string identifying the state
297 format_hfsm_state(state)
300 return(scsp_type_name((u_char)state, hfsm_state_names));
305 * Format a Hello FSM event name
311 * pointer to a string identifying the event
315 format_hfsm_event(event)
320 cp = scsp_type_name((u_char)event, hfsm_event_names);
326 * Format a CA FSM state name
332 * pointer to a string identifying the state
336 format_cafsm_state(state)
339 return(scsp_type_name((u_char)state, cafsm_state_names));
344 * Format a CA FSM event name
350 * pointer to a string identifying the event
354 format_cafsm_event(event)
357 return(scsp_type_name((u_char)event, cafsm_event_names));
362 * Format a client interface FSM state name
368 * pointer to a string identifying the state
372 format_cifsm_state(state)
375 return(scsp_type_name((u_char)state, cifsm_state_names));
380 * Format a client interface FSM event name
386 * pointer to a string identifying the event
390 format_cifsm_event(event)
393 return(scsp_type_name((u_char)event, cifsm_event_names));
398 * Print a Sender or Receiver ID structure
401 * fp file to print message to
402 * idp pointer to ID to be printed
409 print_scsp_id(fp, idp)
416 fprintf(fp, "%sNext: %p\n", indent, idp->next);
417 fprintf(fp, "%sLength: %d\n", indent,
419 fprintf(fp, "%sID: 0x", indent);
420 for (i = 0; i < idp->id_len; i++)
421 fprintf(fp, "%02x ", idp->id[i]);
428 * Print a Cache Key structure
431 * fp file to print message to
432 * ckp pointer to cache key structure
439 print_scsp_cache_key(fp, ckp)
446 fprintf(fp, "%sLength: %d\n", indent,
448 fprintf(fp, "%sKey: 0x", indent);
449 for (i = 0; i < ckp->key_len; i++)
450 fprintf(fp, "%02x ", ckp->key[i]);
457 * Print the mandatory common part of a message
460 * fp file to print message to
461 * mcp pointer to mandatory common part structure
468 print_scsp_mcp(fp, mcp)
473 fprintf(fp, "%sProtocol ID: %s (0x%02x)\n", indent,
474 scsp_type_name(mcp->pid, proto_types),
476 fprintf(fp, "%sServer Group ID: %d\n", indent, mcp->sgid);
477 fprintf(fp, "%sFlags: 0x%04x\n", indent,
479 fprintf(fp, "%sRecord Count: %d\n", indent,
481 fprintf(fp, "%sSender ID:\n", indent);
482 print_scsp_id(fp, &mcp->sid);
483 fprintf(fp, "%sReceiver ID:\n", indent);
484 print_scsp_id(fp, &mcp->rid);
493 * fp file to print message to
494 * exp pointer to extension
501 print_scsp_ext(fp, exp)
509 fprintf(fp, "%sNext: %p\n", indent, exp->next);
510 fprintf(fp, "%sType: %s (0x%02x)\n", indent,
511 scsp_type_name(exp->type, ext_types),
513 fprintf(fp, "%sLength: %d\n", indent, exp->len);
515 fprintf(fp, "%sValue: 0x", indent);
516 cp = (u_char *)((caddr_t)exp + sizeof(Scsp_ext));
517 for (i = 0; i < exp->len; i++)
518 fprintf(fp, "%02x ", *cp++);
526 * Print an ATMARP Cache State Advertisement record
529 * fp file to print message to
530 * acsp pointer to extension
537 print_scsp_atmarp_csa(fp, acsp)
539 Scsp_atmarp_csa *acsp;
542 fprintf(fp, "%sState: %s (%d)\n", indent,
543 scsp_type_name(acsp->sa_state,
546 fprintf(fp, "%sSource ATM addr: %s\n", indent,
547 format_atm_addr(&acsp->sa_sha));
548 fprintf(fp, "%sSource ATM subaddr: %s\n", indent,
549 format_atm_addr(&acsp->sa_ssa));
550 fprintf(fp, "%sSource IP addr: %s\n", indent,
551 format_ip_addr(&acsp->sa_spa));
552 fprintf(fp, "%sTarget ATM addr: %s\n", indent,
553 format_atm_addr(&acsp->sa_tha));
554 fprintf(fp, "%sTarget ATM subaddr: %s\n", indent,
555 format_atm_addr(&acsp->sa_tsa));
556 fprintf(fp, "%sTarget IP addr: %s\n", indent,
557 format_ip_addr(&acsp->sa_tpa));
563 * Print a Cache State Advertisement record or
564 * Cache State Advertisement Summary record
567 * fp file to print message to
568 * csap pointer to CSA or CSAS
575 print_scsp_csa(fp, csap)
580 fprintf(fp, "%sNext: %p\n", indent, csap->next);
581 fprintf(fp, "%sHops: %d\n", indent, csap->hops);
582 fprintf(fp, "%sNull Flag: %s\n", indent,
583 csap->null ? "True" : "False");
584 fprintf(fp, "%sSequence no.: %ld (0x%lx)\n",
585 indent, csap->seq, csap->seq);
586 fprintf(fp, "%sCache Key:\n", indent);
587 print_scsp_cache_key(fp, &csap->key);
588 fprintf(fp, "%sOriginator ID:\n", indent);
589 print_scsp_id(fp, &csap->oid);
590 if (csap->atmarp_data) {
591 fprintf(fp, "%sATMARP data:\n", indent);
592 print_scsp_atmarp_csa(fp, csap->atmarp_data);
599 * Print a Cache Alignment message
602 * fp file to print message to
603 * cap pointer to extension
610 print_scsp_ca(fp, cap)
618 fprintf(fp, "%sCA Seq. No.: %ld\n", indent,
620 fprintf(fp, "%sM bit: %s\n", indent,
621 cap->ca_m ? "True" : "False");
622 fprintf(fp, "%sI bit: %s\n", indent,
623 cap->ca_i ? "True" : "False");
624 fprintf(fp, "%sO bit: %s\n", indent,
625 cap->ca_o ? "True" : "False");
626 fprintf(fp, "%sMandatory Common Part:\n", indent);
627 print_scsp_mcp(fp, &cap->ca_mcp);
628 for (csap = cap->ca_csa_rec, n = 1; csap;
629 csap = csap->next, n++) {
630 fprintf(fp, "%sCSA Record %d (%p):\n", indent, n, csap);
631 print_scsp_csa(fp, csap);
638 * Print a Cache State Update Request, Cache State Update Reply, or
639 * Cache State Update Solicit message
642 * fp file to print message to
643 * csup pointer to CSU message
650 print_scsp_csu(fp, csup)
658 fprintf(fp, "%sMandatory Common Part:\n", indent);
659 print_scsp_mcp(fp, &csup->csu_mcp);
660 for (csap = csup->csu_csa_rec, i = 1; csap;
661 csap = csap->next, i++) {
662 fprintf(fp, "%sCSA Record %d:\n", indent, i);
663 print_scsp_csa(fp, csap);
670 * Print a Hello message
673 * fp file to print message to
674 * hp pointer to hello message
681 print_scsp_hello(fp, hp)
688 fprintf(fp, "%sHello Interval: %d\n", indent,
690 fprintf(fp, "%sDead Factor: %d\n", indent,
692 fprintf(fp, "%sFamily ID: %d\n", indent,
694 fprintf(fp, "%sMandatory Common Part:\n", indent);
695 print_scsp_mcp(fp, &hp->hello_mcp);
696 ridp = hp->hello_mcp.rid.next;
698 fprintf(fp, "%sAdditional Receiver IDs:\n", indent);
699 for (; ridp; ridp = ridp->next)
700 print_scsp_id(fp, ridp);
708 * NHRP-specific Cache State Advertisement record
710 struct scsp_nhrp_csa {
711 u_char req_id; /* Request ID */
712 u_char state; /* State */
713 u_char pref_len; /* Prefix length */
714 u_short flags; /* See below */
715 u_short mtu; /* Maximim transmission unit */
716 u_short hold_time; /* Entry holding time */
717 u_char caddr_tlen; /* Client addr type/length */
718 u_char csaddr_tlen; /* Client subaddr type/length */
719 u_char cproto_len; /* Client proto addr length */
720 u_char pref; /* Preference */
721 Atm_addr caddr; /* Client address */
722 Atm_addr csaddr; /* Client subaddress */
723 struct in_addr cproto_addr; /* Client protocol address */
725 typedef struct scsp_nhrp Scsp_nhrp;
727 #define SCSP_NHRP_UNIQ 0x8000
728 #define SCSP_NHRP_ARP 0x4000
734 * Print an SCSP message
737 * fp file to print message to
738 * msg pointer to message to be printed
745 print_scsp_msg(fp, msg)
758 * Print the message type
761 fprintf(fp, "%sMessage type: %s (0x%02x)\n", indent,
762 scsp_type_name(msg->sc_msg_type, msg_types),
766 * Print the body of the message
768 switch(msg->sc_msg_type) {
770 print_scsp_ca(fp, msg->sc_ca);
772 case SCSP_CSU_REQ_MSG:
773 case SCSP_CSU_REPLY_MSG:
775 print_scsp_csu(fp, msg->sc_csu_msg);
778 print_scsp_hello(fp, msg->sc_hello);
783 * Print any extensions
785 for (exp = msg->sc_ext, n = 1; exp; exp = exp->next, n++) {
786 fprintf(fp, "%sExtension %d:\n", indent, n);
787 print_scsp_ext(fp, exp);
796 * Print an SCSP ATMARP message
799 * fp file to print message to
800 * acp pointer to ATMARP message
807 print_scsp_if_atmarp(fp, amp)
809 Scsp_atmarp_msg *amp;
812 fprintf(fp, "%sState: %s (%d)\n", indent,
813 scsp_type_name(amp->sa_state,
816 fprintf(fp, "%sCached protocol addr: %s\n", indent,
817 format_ip_addr(&->sa_cpa));
818 fprintf(fp, "%sCached ATM addr: %s\n", indent,
819 format_atm_addr(&->sa_cha));
820 fprintf(fp, "%sCached ATM subaddr: %s\n", indent,
821 format_atm_addr(&->sa_csa));
822 fprintf(fp, "%sCache key:\n", indent);
823 print_scsp_cache_key(fp, &->sa_key);
824 fprintf(fp, "%sOriginator ID:\n", indent);
825 print_scsp_id(fp, &->sa_oid);
826 fprintf(fp, "%sSequence number: %ld (0x%08lx)\n", indent,
827 amp->sa_seq, (u_long)amp->sa_seq);
833 * Print an SCSP client interface message
836 * fp file to print message to
837 * imsg pointer to message to be printed
844 print_scsp_if_msg(fp, imsg)
855 fprintf(fp, "SCSP Client Interface Message at %p\n", imsg);
858 * Print the message header
861 fprintf(fp, "%sMessage type: %s (0x%02x)\n", indent,
862 scsp_type_name(imsg->si_type, if_msg_types),
864 fprintf(fp, "%sResponse code: %d\n", indent,
866 fprintf(fp, "%sProtocol type: %s (%d)\n", indent,
867 scsp_type_name(imsg->si_proto, proto_types),
869 fprintf(fp, "%sLength: %d\n", indent,
871 fprintf(fp, "%sToken: 0x%lx\n", indent,
875 * Print the body of the message
877 switch(imsg->si_type) {
879 fprintf(fp, "%sInterface: %s\n", indent,
880 imsg->si_cfg.atmarp_netif);
883 case SCSP_UPDATE_IND:
884 case SCSP_UPDATE_REQ:
885 len = imsg->si_len - sizeof(Scsp_if_msg_hdr);
886 ap = &imsg->si_atmarp;
888 switch(imsg->si_proto) {
889 case SCSP_PROTO_ATMARP:
890 fprintf(fp, "%sATMARP CSA:\n", indent);
891 print_scsp_if_atmarp(fp, ap);
892 len -= sizeof(Scsp_atmarp_msg);
895 case SCSP_PROTO_NHRP:
896 case SCSP_PROTO_MARS:
897 case SCSP_PROTO_DHCP:
898 case SCSP_PROTO_LNNI:
900 fprintf(fp, "Protocol type not implemented\n");
913 * Print an SCSP pending connection block
916 * fp file to print message to
917 * pp pointer to pending control block
924 print_scsp_pending(fp, pp)
936 fprintf(fp, "Pending control block at %p\n", pp);
939 * Print the fields of the control block
942 fprintf(fp, "%sNext: %p\n", indent, pp->sp_next);
943 fprintf(fp, "%sSocket: %d\n", indent,
951 * Print an SCSP server control block
954 * fp file to print message to
955 * ssp pointer to server control block
962 print_scsp_server(fp, ssp)
974 fprintf(fp, "Server control block at %p\n", ssp);
977 * Print the fields of the client control block
980 fprintf(fp, "%sNext: %p\n", indent,
982 fprintf(fp, "%sName: %s\n", indent,
984 fprintf(fp, "%sNetwork Interface: %s\n", indent,
986 fprintf(fp, "%sState: %d\n", indent,
988 fprintf(fp, "%sProtocol ID: 0x%lx\n", indent,
990 fprintf(fp, "%sID length: %d\n", indent,
992 fprintf(fp, "%sCache key length: %d\n", indent,
994 fprintf(fp, "%sServer Group ID: 0x%lx\n", indent,
996 fprintf(fp, "%sFamily ID: 0x%lx\n", indent,
998 fprintf(fp, "%sSocket: %d\n", indent,
1000 fprintf(fp, "%sDCS Listen Socket: %d\n", indent,
1002 fprintf(fp, "%sLocal Server ID:\n", indent);
1003 print_scsp_id(fp, &ssp->ss_lsid);
1004 fprintf(fp, "%sATM address: %s\n", indent,
1005 format_atm_addr(&ssp->ss_addr));
1006 fprintf(fp, "%sATM subaddress: %s\n", indent,
1007 format_atm_addr(&ssp->ss_subaddr));
1008 fprintf(fp, "%sInterface MTU: %d\n", indent,
1010 fprintf(fp, "%sMark: %d\n", indent,
1017 * Print an SCSP client cache summary entry control block
1020 * fp file to print message to
1021 * csep pointer to summary entry
1028 print_scsp_cse(fp, csep)
1033 * Print the fields of the cache summary entry
1036 fprintf(fp, "%sNext CSE: %p\n", indent, csep->sc_next);
1037 fprintf(fp, "%sCSA sequence no.: %ld (0x%lx)\n", indent,
1038 csep->sc_seq, csep->sc_seq);
1039 fprintf(fp, "%sCache key:\n", indent);
1040 print_scsp_cache_key(fp, &csep->sc_key);
1041 fprintf(fp, "%sOrigin ID:\n", indent);
1042 print_scsp_id(fp, &csep->sc_oid);
1048 * Print an SCSP CSU Request retransmission control block
1051 * fp file to print message to
1052 * csurp pointer to retransmission entry
1059 print_scsp_csu_rexmt(fp, rxp)
1061 Scsp_csu_rexmt *rxp;
1067 fprintf(fp, "%sNext CSU Req rexmt: %p\n", indent, rxp->sr_next);
1068 fprintf(fp, "%sDCS address: %p\n", indent, rxp->sr_dcs);
1069 for (csap = rxp->sr_csa, i = 1; csap;
1070 csap = csap->next, i++) {
1071 fprintf(fp, "%sCSA %d:\n", indent, i);
1072 print_scsp_csa(fp, csap);
1079 * Print an SCSP DCS control block
1082 * fp file to print message to
1083 * dcsp pointer to DCS control block
1090 print_scsp_dcs(fp, dcsp)
1096 Scsp_csu_rexmt *rxp;
1106 fprintf(fp, "DCS control block at %p\n", dcsp);
1109 * Print the fields of the DCS control block
1112 fprintf(fp, "%sNext DCS block: %p\n", indent, dcsp->sd_next);
1113 fprintf(fp, "%sServer control block: %p\n", indent, dcsp->sd_server);
1114 fprintf(fp, "%sDCS ID:\n", indent);
1115 print_scsp_id(fp, &dcsp->sd_dcsid);
1116 fprintf(fp, "%sDCS address: %s\n", indent,
1117 format_atm_addr(&dcsp->sd_addr));
1118 fprintf(fp, "%sDCS subaddress %s\n", indent,
1119 format_atm_addr(&dcsp->sd_subaddr));
1120 fprintf(fp, "%sSocket: %d\n", indent,
1122 fprintf(fp, "%sOpen VCC Retry Timer:\n", indent);
1123 fprintf(fp, "%sHello FSM State: %s\n", indent,
1124 format_hfsm_state(dcsp->sd_hello_state));
1125 fprintf(fp, "%sHello Interval: %d\n", indent,
1126 dcsp->sd_hello_int);
1127 fprintf(fp, "%sHello Dead Factor: %d\n", indent,
1129 fprintf(fp, "%sHello Rcvd: %d\n", indent,
1130 dcsp->sd_hello_rcvd);
1131 fprintf(fp, "%sCA FSM State: %s\n", indent,
1132 format_cafsm_state(dcsp->sd_ca_state));
1133 fprintf(fp, "%sCA Seq. No.: 0x%lx\n", indent,
1135 fprintf(fp, "%sCA Rexmit Int: %d\n", indent,
1136 dcsp->sd_ca_rexmt_int);
1137 fprintf(fp, "%sCA Retransmit Msg: %p\n", indent,
1138 dcsp->sd_ca_rexmt_msg);
1139 fprintf(fp, "%sCSASs to send: ", indent);
1140 if (dcsp->sd_ca_csas == (Scsp_cse *)0) {
1141 fprintf(fp, "Empty\n");
1143 fprintf(fp, "%p\n", dcsp->sd_ca_csas);
1145 fprintf(fp, "%sCSUS Rexmit Int: %d\n", indent,
1146 dcsp->sd_csus_rexmt_int);
1147 fprintf(fp, "%sCache Request List: ", indent);
1148 if (dcsp->sd_crl == (Scsp_csa *)0) {
1149 fprintf(fp, "Empty\n");
1151 fprintf(fp, "%p\n", dcsp->sd_crl);
1153 fprintf(fp, "%sCSUS Rexmit Msg: %p\n", indent,
1154 dcsp->sd_csus_rexmt_msg);
1155 fprintf(fp, "%sCSA Hop count: %d\n", indent,
1157 fprintf(fp, "%sCSAs Pending ACK: %p\n", indent,
1158 dcsp->sd_csu_ack_pend);
1159 fprintf(fp, "%sCSAs ACKed: %p\n", indent,
1161 fprintf(fp, "%sCSU Req Rexmit Int: %d\n", indent,
1162 dcsp->sd_csu_rexmt_int);
1163 fprintf(fp, "%sCSU Req Rexmit Max: %d\n", indent,
1164 dcsp->sd_csu_rexmt_max);
1165 fprintf(fp, "%sCSU Req Rexmit Queue ", indent);
1166 if (!dcsp->sd_csu_rexmt) {
1167 fprintf(fp, "Empty\n");
1169 fprintf(fp, "%p\n", dcsp->sd_csu_rexmt);
1171 fprintf(fp, "%sClient I/F state: %d\n", indent,
1172 dcsp->sd_client_state);
1175 * Print the list of CSASs waiting to be sent
1177 if (dcsp->sd_ca_csas) {
1178 fprintf(fp, "\n%sCSASs to send:", indent);
1180 for (csep = dcsp->sd_ca_csas; csep;
1181 csep = csep->sc_next) {
1182 fprintf(fp, "%sCache summary entry at %p\n",
1184 print_scsp_cse(fp, csep);
1190 * Print the Cache Request List
1193 fprintf(fp, "\n%sCache Request List:\n", indent);
1195 for (csap = dcsp->sd_crl; csap; csap = csap->next) {
1196 fprintf(fp, "%sCSA at %p\n", indent, csap);
1197 print_scsp_csa(fp, csap);
1203 * Print the CSU retransmit queue
1205 if (dcsp->sd_csu_rexmt) {
1206 fprintf(fp, "\n%sCSU Req Rexmit Queue:\n", indent);
1208 for (rxp = dcsp->sd_csu_rexmt; rxp;
1209 rxp = rxp->sr_next) {
1210 fprintf(fp, "%sCSU Rexmit Block at %p\n",
1212 print_scsp_csu_rexmt(fp, rxp);
1222 * Print SCSP's control blocks
1241 static int dump_no = 0;
1246 UM_ZERO(fname, sizeof(fname));
1247 sprintf(fname, "/tmp/scspd.%d.%03d.out", getpid(), dump_no++);
1250 * Open the output file
1252 df = fopen(fname, "w");
1253 if (df == (FILE *)0)
1257 * Dump the server control blocks
1259 for (ssp = scsp_server_head; ssp; ssp = ssp->ss_next) {
1260 print_scsp_server(df, ssp);
1264 * Print the client's cache summary
1266 for (i = 0; i < SCSP_HASHSZ; i++) {
1267 for (scp = ssp->ss_cache[i]; scp;
1268 scp = scp->sc_next) {
1269 print_scsp_cse(df, scp);
1275 * Print the client's DCS control blocks
1277 for (dcsp = ssp->ss_dcs; dcsp; dcsp = dcsp->sd_next) {
1278 print_scsp_dcs(df, dcsp);
1279 fprintf(df, "\n\n");
1281 fprintf(df, "\n\n");
1285 * Print the pending connection blocks
1287 for (pp = scsp_pending_head; pp; pp = pp->sp_next) {
1288 print_scsp_pending(df, pp);
1293 * Close the output file