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.
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>
65 __RCSID("@(#) $FreeBSD$");
74 static char indent[MAX_INDENT + 1];
78 * Value-name translation table entry
84 typedef struct type_name Type_name;
88 * SCSP name-type tables
90 static Type_name if_msg_types[] = {
91 { "Config Request", SCSP_CFG_REQ },
92 { "Config Response", SCSP_CFG_RSP },
93 { "Cache Indication", SCSP_CACHE_IND },
94 { "Cache Response", SCSP_CACHE_RSP },
95 { "Solicit Indication", SCSP_SOLICIT_IND },
96 { "Solicit Response", SCSP_SOLICIT_RSP },
97 { "Cache Update Indication", SCSP_UPDATE_IND },
98 { "Cache Update Request", SCSP_UPDATE_REQ },
99 { "Cache Update Response", SCSP_UPDATE_RSP },
103 static Type_name msg_types[] = {
104 { "Cache Alignment", SCSP_CA_MSG },
105 { "CSU Request", SCSP_CSU_REQ_MSG },
106 { "CSU Reply", SCSP_CSU_REPLY_MSG },
107 { "CSU Solicit", SCSP_CSUS_MSG },
108 { "Hello", SCSP_HELLO_MSG },
112 static Type_name proto_types[] = {
113 { "ATMARP", SCSP_PROTO_ATMARP },
114 { "NHRP", SCSP_PROTO_NHRP },
115 { "MARS", SCSP_PROTO_MARS },
116 { "DHCP", SCSP_PROTO_DHCP },
117 { "LNNI", SCSP_PROTO_LNNI },
121 static Type_name ext_types[] = {
122 { "End of Extensions", SCSP_EXT_END },
123 { "Authentication", SCSP_EXT_AUTH },
124 { "Vendor Private", SCSP_EXT_VENDOR },
128 static Type_name hfsm_state_names[] = {
129 { "Down", SCSP_HFSM_DOWN },
130 { "Waiting", SCSP_HFSM_WAITING },
131 { "Unidirectional", SCSP_HFSM_UNI_DIR },
132 { "Bidirectional", SCSP_HFSM_BI_DIR },
136 static Type_name hfsm_event_names[] = {
137 { "VC open", SCSP_HFSM_VC_ESTAB },
138 { "VC closed", SCSP_HFSM_VC_CLOSED },
139 { "Hello timer", SCSP_HFSM_HELLO_T },
140 { "Receive timer", SCSP_HFSM_RCV_T },
141 { "Msg received", SCSP_HFSM_RCVD },
145 static Type_name cafsm_state_names[] = {
146 { "Down", SCSP_CAFSM_DOWN },
147 { "Master/Slave negotiation", SCSP_CAFSM_NEG },
148 { "Master", SCSP_CAFSM_MASTER },
149 { "Slave", SCSP_CAFSM_SLAVE },
150 { "Update cache", SCSP_CAFSM_UPDATE },
151 { "Aligned", SCSP_CAFSM_ALIGNED },
155 static Type_name cafsm_event_names[] = {
156 { "Hello FSM up", SCSP_CAFSM_HELLO_UP },
157 { "Hello FSM down", SCSP_CAFSM_HELLO_DOWN },
158 { "CA received", SCSP_CAFSM_CA_MSG },
159 { "CSU Solicit received", SCSP_CAFSM_CSUS_MSG },
160 { "CSU Request received", SCSP_CAFSM_CSU_REQ },
161 { "CSU Reply received", SCSP_CAFSM_CSU_REPLY },
162 { "CA timer", SCSP_CAFSM_CA_T },
163 { "CSUS timer", SCSP_CAFSM_CSUS_T },
164 { "CSU timer", SCSP_CAFSM_CSU_T },
165 { "Cache Update", SCSP_CAFSM_CACHE_UPD },
166 { "Cache Response", SCSP_CAFSM_CACHE_RSP },
170 static Type_name cifsm_state_names[] = {
171 { "Null", SCSP_CIFSM_NULL },
172 { "Summarize", SCSP_CIFSM_SUM },
173 { "Update", SCSP_CIFSM_UPD },
174 { "Aligned", SCSP_CIFSM_ALIGN },
178 static Type_name cifsm_event_names[] = {
179 { "CA FSM down", SCSP_CIFSM_CA_DOWN },
180 { "CA FSM to Summarize",SCSP_CIFSM_CA_SUMM },
181 { "CA FSM to Update", SCSP_CIFSM_CA_UPD },
182 { "CA FSM to Aligned", SCSP_CIFSM_CA_ALIGN },
183 { "Solicit Rsp", SCSP_CIFSM_SOL_RSP },
184 { "Update Req", SCSP_CIFSM_UPD_REQ },
185 { "Update Rsp", SCSP_CIFSM_UPD_RSP },
186 { "CSU Request", SCSP_CIFSM_CSU_REQ },
187 { "CSU Reply", SCSP_CIFSM_CSU_REPLY },
188 { "CSU Solicit", SCSP_CIFSM_CSU_SOL },
192 static Type_name atmarp_state_names[] = {
193 { "New", SCSP_ASTATE_NEW },
194 { "Updated", SCSP_ASTATE_UPD },
195 { "Deleted", SCSP_ASTATE_DEL },
201 * Initialize the indent string
218 * Increment the indent string
230 if (strlen(indent) >= MAX_INDENT)
237 * Decrement the indent string
249 if (strlen(indent) < MIN_INDENT)
251 indent[strlen(indent) - 2] = '\0';
257 * Search for a type in a name-type table
260 * type the value being searched for
261 * tbl pointer to the table to search
264 * pointer to a string identifying the type
268 scsp_type_name(type, tbl)
277 for (i = 0; tbl[i].name != (char *)0 && tbl[i].type != type;
282 * Check the result and return the appropriate value
292 * Format a Hello FSM state name
298 * pointer to a string identifying the state
302 format_hfsm_state(state)
305 return(scsp_type_name((u_char)state, hfsm_state_names));
310 * Format a Hello FSM event name
316 * pointer to a string identifying the event
320 format_hfsm_event(event)
325 cp = scsp_type_name((u_char)event, hfsm_event_names);
331 * Format a CA FSM state name
337 * pointer to a string identifying the state
341 format_cafsm_state(state)
344 return(scsp_type_name((u_char)state, cafsm_state_names));
349 * Format a CA FSM event name
355 * pointer to a string identifying the event
359 format_cafsm_event(event)
362 return(scsp_type_name((u_char)event, cafsm_event_names));
367 * Format a client interface FSM state name
373 * pointer to a string identifying the state
377 format_cifsm_state(state)
380 return(scsp_type_name((u_char)state, cifsm_state_names));
385 * Format a client interface FSM event name
391 * pointer to a string identifying the event
395 format_cifsm_event(event)
398 return(scsp_type_name((u_char)event, cifsm_event_names));
403 * Print a Sender or Receiver ID structure
406 * fp file to print message to
407 * idp pointer to ID to be printed
414 print_scsp_id(fp, idp)
421 fprintf(fp, "%sNext: %p\n", indent, idp->next);
422 fprintf(fp, "%sLength: %d\n", indent,
424 fprintf(fp, "%sID: 0x", indent);
425 for (i = 0; i < idp->id_len; i++)
426 fprintf(fp, "%02x ", idp->id[i]);
433 * Print a Cache Key structure
436 * fp file to print message to
437 * ckp pointer to cache key structure
444 print_scsp_cache_key(fp, ckp)
451 fprintf(fp, "%sLength: %d\n", indent,
453 fprintf(fp, "%sKey: 0x", indent);
454 for (i = 0; i < ckp->key_len; i++)
455 fprintf(fp, "%02x ", ckp->key[i]);
462 * Print the mandatory common part of a message
465 * fp file to print message to
466 * mcp pointer to mandatory common part structure
473 print_scsp_mcp(fp, mcp)
478 fprintf(fp, "%sProtocol ID: %s (0x%02x)\n", indent,
479 scsp_type_name(mcp->pid, proto_types),
481 fprintf(fp, "%sServer Group ID: %d\n", indent, mcp->sgid);
482 fprintf(fp, "%sFlags: 0x%04x\n", indent,
484 fprintf(fp, "%sRecord Count: %d\n", indent,
486 fprintf(fp, "%sSender ID:\n", indent);
487 print_scsp_id(fp, &mcp->sid);
488 fprintf(fp, "%sReceiver ID:\n", indent);
489 print_scsp_id(fp, &mcp->rid);
498 * fp file to print message to
499 * exp pointer to extension
506 print_scsp_ext(fp, exp)
514 fprintf(fp, "%sNext: %p\n", indent, exp->next);
515 fprintf(fp, "%sType: %s (0x%02x)\n", indent,
516 scsp_type_name(exp->type, ext_types),
518 fprintf(fp, "%sLength: %d\n", indent, exp->len);
520 fprintf(fp, "%sValue: 0x", indent);
521 cp = (u_char *)((caddr_t)exp + sizeof(Scsp_ext));
522 for (i = 0; i < exp->len; i++)
523 fprintf(fp, "%02x ", *cp++);
531 * Print an ATMARP Cache State Advertisement record
534 * fp file to print message to
535 * acsp pointer to extension
542 print_scsp_atmarp_csa(fp, acsp)
544 Scsp_atmarp_csa *acsp;
547 fprintf(fp, "%sState: %s (%d)\n", indent,
548 scsp_type_name(acsp->sa_state,
551 fprintf(fp, "%sSource ATM addr: %s\n", indent,
552 format_atm_addr(&acsp->sa_sha));
553 fprintf(fp, "%sSource ATM subaddr: %s\n", indent,
554 format_atm_addr(&acsp->sa_ssa));
555 fprintf(fp, "%sSource IP addr: %s\n", indent,
556 format_ip_addr(&acsp->sa_spa));
557 fprintf(fp, "%sTarget ATM addr: %s\n", indent,
558 format_atm_addr(&acsp->sa_tha));
559 fprintf(fp, "%sTarget ATM subaddr: %s\n", indent,
560 format_atm_addr(&acsp->sa_tsa));
561 fprintf(fp, "%sTarget IP addr: %s\n", indent,
562 format_ip_addr(&acsp->sa_tpa));
568 * Print a Cache State Advertisement record or
569 * Cache State Advertisement Summary record
572 * fp file to print message to
573 * csap pointer to CSA or CSAS
580 print_scsp_csa(fp, csap)
585 fprintf(fp, "%sNext: %p\n", indent, csap->next);
586 fprintf(fp, "%sHops: %d\n", indent, csap->hops);
587 fprintf(fp, "%sNull Flag: %s\n", indent,
588 csap->null ? "True" : "False");
589 fprintf(fp, "%sSequence no.: %ld (0x%lx)\n",
590 indent, csap->seq, csap->seq);
591 fprintf(fp, "%sCache Key:\n", indent);
592 print_scsp_cache_key(fp, &csap->key);
593 fprintf(fp, "%sOriginator ID:\n", indent);
594 print_scsp_id(fp, &csap->oid);
595 if (csap->atmarp_data) {
596 fprintf(fp, "%sATMARP data:\n", indent);
597 print_scsp_atmarp_csa(fp, csap->atmarp_data);
604 * Print a Cache Alignment message
607 * fp file to print message to
608 * cap pointer to extension
615 print_scsp_ca(fp, cap)
623 fprintf(fp, "%sCA Seq. No.: %ld\n", indent,
625 fprintf(fp, "%sM bit: %s\n", indent,
626 cap->ca_m ? "True" : "False");
627 fprintf(fp, "%sI bit: %s\n", indent,
628 cap->ca_i ? "True" : "False");
629 fprintf(fp, "%sO bit: %s\n", indent,
630 cap->ca_o ? "True" : "False");
631 fprintf(fp, "%sMandatory Common Part:\n", indent);
632 print_scsp_mcp(fp, &cap->ca_mcp);
633 for (csap = cap->ca_csa_rec, n = 1; csap;
634 csap = csap->next, n++) {
635 fprintf(fp, "%sCSA Record %d (%p):\n", indent, n, csap);
636 print_scsp_csa(fp, csap);
643 * Print a Cache State Update Request, Cache State Update Reply, or
644 * Cache State Update Solicit message
647 * fp file to print message to
648 * csup pointer to CSU message
655 print_scsp_csu(fp, csup)
663 fprintf(fp, "%sMandatory Common Part:\n", indent);
664 print_scsp_mcp(fp, &csup->csu_mcp);
665 for (csap = csup->csu_csa_rec, i = 1; csap;
666 csap = csap->next, i++) {
667 fprintf(fp, "%sCSA Record %d:\n", indent, i);
668 print_scsp_csa(fp, csap);
675 * Print a Hello message
678 * fp file to print message to
679 * hp pointer to hello message
686 print_scsp_hello(fp, hp)
693 fprintf(fp, "%sHello Interval: %d\n", indent,
695 fprintf(fp, "%sDead Factor: %d\n", indent,
697 fprintf(fp, "%sFamily ID: %d\n", indent,
699 fprintf(fp, "%sMandatory Common Part:\n", indent);
700 print_scsp_mcp(fp, &hp->hello_mcp);
701 ridp = hp->hello_mcp.rid.next;
703 fprintf(fp, "%sAdditional Receiver IDs:\n", indent);
704 for (; ridp; ridp = ridp->next)
705 print_scsp_id(fp, ridp);
713 * NHRP-specific Cache State Advertisement record
715 struct scsp_nhrp_csa {
716 u_char req_id; /* Request ID */
717 u_char state; /* State */
718 u_char pref_len; /* Prefix length */
719 u_short flags; /* See below */
720 u_short mtu; /* Maximim transmission unit */
721 u_short hold_time; /* Entry holding time */
722 u_char caddr_tlen; /* Client addr type/length */
723 u_char csaddr_tlen; /* Client subaddr type/length */
724 u_char cproto_len; /* Client proto addr length */
725 u_char pref; /* Preference */
726 Atm_addr caddr; /* Client address */
727 Atm_addr csaddr; /* Client subaddress */
728 struct in_addr cproto_addr; /* Client protocol address */
730 typedef struct scsp_nhrp Scsp_nhrp;
732 #define SCSP_NHRP_UNIQ 0x8000
733 #define SCSP_NHRP_ARP 0x4000
739 * Print an SCSP message
742 * fp file to print message to
743 * msg pointer to message to be printed
750 print_scsp_msg(fp, msg)
763 * Print the message type
766 fprintf(fp, "%sMessage type: %s (0x%02x)\n", indent,
767 scsp_type_name(msg->sc_msg_type, msg_types),
771 * Print the body of the message
773 switch(msg->sc_msg_type) {
775 print_scsp_ca(fp, msg->sc_ca);
777 case SCSP_CSU_REQ_MSG:
778 case SCSP_CSU_REPLY_MSG:
780 print_scsp_csu(fp, msg->sc_csu_msg);
783 print_scsp_hello(fp, msg->sc_hello);
788 * Print any extensions
790 for (exp = msg->sc_ext, n = 1; exp; exp = exp->next, n++) {
791 fprintf(fp, "%sExtension %d:\n", indent, n);
792 print_scsp_ext(fp, exp);
801 * Print an SCSP ATMARP message
804 * fp file to print message to
805 * acp pointer to ATMARP message
812 print_scsp_if_atmarp(fp, amp)
814 Scsp_atmarp_msg *amp;
817 fprintf(fp, "%sState: %s (%d)\n", indent,
818 scsp_type_name(amp->sa_state,
821 fprintf(fp, "%sCached protocol addr: %s\n", indent,
822 format_ip_addr(&->sa_cpa));
823 fprintf(fp, "%sCached ATM addr: %s\n", indent,
824 format_atm_addr(&->sa_cha));
825 fprintf(fp, "%sCached ATM subaddr: %s\n", indent,
826 format_atm_addr(&->sa_csa));
827 fprintf(fp, "%sCache key:\n", indent);
828 print_scsp_cache_key(fp, &->sa_key);
829 fprintf(fp, "%sOriginator ID:\n", indent);
830 print_scsp_id(fp, &->sa_oid);
831 fprintf(fp, "%sSequence number: %ld (0x%08lx)\n", indent,
832 amp->sa_seq, (u_long)amp->sa_seq);
838 * Print an SCSP client interface message
841 * fp file to print message to
842 * imsg pointer to message to be printed
849 print_scsp_if_msg(fp, imsg)
860 fprintf(fp, "SCSP Client Interface Message at %p\n", imsg);
863 * Print the message header
866 fprintf(fp, "%sMessage type: %s (0x%02x)\n", indent,
867 scsp_type_name(imsg->si_type, if_msg_types),
869 fprintf(fp, "%sResponse code: %d\n", indent,
871 fprintf(fp, "%sProtocol type: %s (%d)\n", indent,
872 scsp_type_name(imsg->si_proto, proto_types),
874 fprintf(fp, "%sLength: %d\n", indent,
876 fprintf(fp, "%sToken: 0x%lx\n", indent,
880 * Print the body of the message
882 switch(imsg->si_type) {
884 fprintf(fp, "%sInterface: %s\n", indent,
885 imsg->si_cfg.atmarp_netif);
888 case SCSP_UPDATE_IND:
889 case SCSP_UPDATE_REQ:
890 len = imsg->si_len - sizeof(Scsp_if_msg_hdr);
891 ap = &imsg->si_atmarp;
893 switch(imsg->si_proto) {
894 case SCSP_PROTO_ATMARP:
895 fprintf(fp, "%sATMARP CSA:\n", indent);
896 print_scsp_if_atmarp(fp, ap);
897 len -= sizeof(Scsp_atmarp_msg);
900 case SCSP_PROTO_NHRP:
901 case SCSP_PROTO_MARS:
902 case SCSP_PROTO_DHCP:
903 case SCSP_PROTO_LNNI:
905 fprintf(fp, "Protocol type not implemented\n");
918 * Print an SCSP pending connection block
921 * fp file to print message to
922 * pp pointer to pending control block
929 print_scsp_pending(fp, pp)
941 fprintf(fp, "Pending control block at %p\n", pp);
944 * Print the fields of the control block
947 fprintf(fp, "%sNext: %p\n", indent, pp->sp_next);
948 fprintf(fp, "%sSocket: %d\n", indent,
956 * Print an SCSP server control block
959 * fp file to print message to
960 * ssp pointer to server control block
967 print_scsp_server(fp, ssp)
979 fprintf(fp, "Server control block at %p\n", ssp);
982 * Print the fields of the client control block
985 fprintf(fp, "%sNext: %p\n", indent,
987 fprintf(fp, "%sName: %s\n", indent,
989 fprintf(fp, "%sNetwork Interface: %s\n", indent,
991 fprintf(fp, "%sState: %d\n", indent,
993 fprintf(fp, "%sProtocol ID: 0x%lx\n", indent,
995 fprintf(fp, "%sID length: %d\n", indent,
997 fprintf(fp, "%sCache key length: %d\n", indent,
999 fprintf(fp, "%sServer Group ID: 0x%lx\n", indent,
1001 fprintf(fp, "%sFamily ID: 0x%lx\n", indent,
1003 fprintf(fp, "%sSocket: %d\n", indent,
1005 fprintf(fp, "%sDCS Listen Socket: %d\n", indent,
1007 fprintf(fp, "%sLocal Server ID:\n", indent);
1008 print_scsp_id(fp, &ssp->ss_lsid);
1009 fprintf(fp, "%sATM address: %s\n", indent,
1010 format_atm_addr(&ssp->ss_addr));
1011 fprintf(fp, "%sATM subaddress: %s\n", indent,
1012 format_atm_addr(&ssp->ss_subaddr));
1013 fprintf(fp, "%sInterface MTU: %d\n", indent,
1015 fprintf(fp, "%sMark: %d\n", indent,
1022 * Print an SCSP client cache summary entry control block
1025 * fp file to print message to
1026 * csep pointer to summary entry
1033 print_scsp_cse(fp, csep)
1038 * Print the fields of the cache summary entry
1041 fprintf(fp, "%sNext CSE: %p\n", indent, csep->sc_next);
1042 fprintf(fp, "%sCSA sequence no.: %ld (0x%lx)\n", indent,
1043 csep->sc_seq, csep->sc_seq);
1044 fprintf(fp, "%sCache key:\n", indent);
1045 print_scsp_cache_key(fp, &csep->sc_key);
1046 fprintf(fp, "%sOrigin ID:\n", indent);
1047 print_scsp_id(fp, &csep->sc_oid);
1053 * Print an SCSP CSU Request retransmission control block
1056 * fp file to print message to
1057 * csurp pointer to retransmission entry
1064 print_scsp_csu_rexmt(fp, rxp)
1066 Scsp_csu_rexmt *rxp;
1072 fprintf(fp, "%sNext CSU Req rexmt: %p\n", indent, rxp->sr_next);
1073 fprintf(fp, "%sDCS address: %p\n", indent, rxp->sr_dcs);
1074 for (csap = rxp->sr_csa, i = 1; csap;
1075 csap = csap->next, i++) {
1076 fprintf(fp, "%sCSA %d:\n", indent, i);
1077 print_scsp_csa(fp, csap);
1084 * Print an SCSP DCS control block
1087 * fp file to print message to
1088 * dcsp pointer to DCS control block
1095 print_scsp_dcs(fp, dcsp)
1101 Scsp_csu_rexmt *rxp;
1111 fprintf(fp, "DCS control block at %p\n", dcsp);
1114 * Print the fields of the DCS control block
1117 fprintf(fp, "%sNext DCS block: %p\n", indent, dcsp->sd_next);
1118 fprintf(fp, "%sServer control block: %p\n", indent, dcsp->sd_server);
1119 fprintf(fp, "%sDCS ID:\n", indent);
1120 print_scsp_id(fp, &dcsp->sd_dcsid);
1121 fprintf(fp, "%sDCS address: %s\n", indent,
1122 format_atm_addr(&dcsp->sd_addr));
1123 fprintf(fp, "%sDCS subaddress %s\n", indent,
1124 format_atm_addr(&dcsp->sd_subaddr));
1125 fprintf(fp, "%sSocket: %d\n", indent,
1127 fprintf(fp, "%sOpen VCC Retry Timer:\n", indent);
1128 fprintf(fp, "%sHello FSM State: %s\n", indent,
1129 format_hfsm_state(dcsp->sd_hello_state));
1130 fprintf(fp, "%sHello Interval: %d\n", indent,
1131 dcsp->sd_hello_int);
1132 fprintf(fp, "%sHello Dead Factor: %d\n", indent,
1134 fprintf(fp, "%sHello Rcvd: %d\n", indent,
1135 dcsp->sd_hello_rcvd);
1136 fprintf(fp, "%sCA FSM State: %s\n", indent,
1137 format_cafsm_state(dcsp->sd_ca_state));
1138 fprintf(fp, "%sCA Seq. No.: 0x%lx\n", indent,
1140 fprintf(fp, "%sCA Rexmit Int: %d\n", indent,
1141 dcsp->sd_ca_rexmt_int);
1142 fprintf(fp, "%sCA Retransmit Msg: %p\n", indent,
1143 dcsp->sd_ca_rexmt_msg);
1144 fprintf(fp, "%sCSASs to send: ", indent);
1145 if (dcsp->sd_ca_csas == (Scsp_cse *)0) {
1146 fprintf(fp, "Empty\n");
1148 fprintf(fp, "%p\n", dcsp->sd_ca_csas);
1150 fprintf(fp, "%sCSUS Rexmit Int: %d\n", indent,
1151 dcsp->sd_csus_rexmt_int);
1152 fprintf(fp, "%sCache Request List: ", indent);
1153 if (dcsp->sd_crl == (Scsp_csa *)0) {
1154 fprintf(fp, "Empty\n");
1156 fprintf(fp, "%p\n", dcsp->sd_crl);
1158 fprintf(fp, "%sCSUS Rexmit Msg: %p\n", indent,
1159 dcsp->sd_csus_rexmt_msg);
1160 fprintf(fp, "%sCSA Hop count: %d\n", indent,
1162 fprintf(fp, "%sCSAs Pending ACK: %p\n", indent,
1163 dcsp->sd_csu_ack_pend);
1164 fprintf(fp, "%sCSAs ACKed: %p\n", indent,
1166 fprintf(fp, "%sCSU Req Rexmit Int: %d\n", indent,
1167 dcsp->sd_csu_rexmt_int);
1168 fprintf(fp, "%sCSU Req Rexmit Max: %d\n", indent,
1169 dcsp->sd_csu_rexmt_max);
1170 fprintf(fp, "%sCSU Req Rexmit Queue ", indent);
1171 if (!dcsp->sd_csu_rexmt) {
1172 fprintf(fp, "Empty\n");
1174 fprintf(fp, "%p\n", dcsp->sd_csu_rexmt);
1176 fprintf(fp, "%sClient I/F state: %d\n", indent,
1177 dcsp->sd_client_state);
1180 * Print the list of CSASs waiting to be sent
1182 if (dcsp->sd_ca_csas) {
1183 fprintf(fp, "\n%sCSASs to send:", indent);
1185 for (csep = dcsp->sd_ca_csas; csep;
1186 csep = csep->sc_next) {
1187 fprintf(fp, "%sCache summary entry at %p\n",
1189 print_scsp_cse(fp, csep);
1195 * Print the Cache Request List
1198 fprintf(fp, "\n%sCache Request List:\n", indent);
1200 for (csap = dcsp->sd_crl; csap; csap = csap->next) {
1201 fprintf(fp, "%sCSA at %p\n", indent, csap);
1202 print_scsp_csa(fp, csap);
1208 * Print the CSU retransmit queue
1210 if (dcsp->sd_csu_rexmt) {
1211 fprintf(fp, "\n%sCSU Req Rexmit Queue:\n", indent);
1213 for (rxp = dcsp->sd_csu_rexmt; rxp;
1214 rxp = rxp->sr_next) {
1215 fprintf(fp, "%sCSU Rexmit Block at %p\n",
1217 print_scsp_csu_rexmt(fp, rxp);
1227 * Print SCSP's control blocks
1246 static int dump_no = 0;
1251 UM_ZERO(fname, sizeof(fname));
1252 sprintf(fname, "/tmp/scspd.%d.%03d.out", getpid(), dump_no++);
1255 * Open the output file
1257 df = fopen(fname, "w");
1258 if (df == (FILE *)0)
1262 * Dump the server control blocks
1264 for (ssp = scsp_server_head; ssp; ssp = ssp->ss_next) {
1265 print_scsp_server(df, ssp);
1269 * Print the client's cache summary
1271 for (i = 0; i < SCSP_HASHSZ; i++) {
1272 for (scp = ssp->ss_cache[i]; scp;
1273 scp = scp->sc_next) {
1274 print_scsp_cse(df, scp);
1280 * Print the client's DCS control blocks
1282 for (dcsp = ssp->ss_dcs; dcsp; dcsp = dcsp->sd_next) {
1283 print_scsp_dcs(df, dcsp);
1284 fprintf(df, "\n\n");
1286 fprintf(df, "\n\n");
1290 * Print the pending connection blocks
1292 for (pp = scsp_pending_head; pp; pp = pp->sp_next) {
1293 print_scsp_pending(df, pp);
1298 * Close the output file