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.4 2004/12/18 22:48:02 swildner 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(u_char type
, Type_name
*tbl
)
270 for (i
= 0; tbl
[i
].name
!= NULL
&& tbl
[i
].type
!= type
;
275 * Check the result and return the appropriate value
285 * Format a Hello FSM state name
291 * pointer to a string identifying the state
295 format_hfsm_state(int state
)
297 return(scsp_type_name((u_char
)state
, hfsm_state_names
));
302 * Format a Hello FSM event name
308 * pointer to a string identifying the event
312 format_hfsm_event(int event
)
316 cp
= scsp_type_name((u_char
)event
, hfsm_event_names
);
322 * Format a CA FSM state name
328 * pointer to a string identifying the state
332 format_cafsm_state(int state
)
334 return(scsp_type_name((u_char
)state
, cafsm_state_names
));
339 * Format a CA FSM event name
345 * pointer to a string identifying the event
349 format_cafsm_event(int event
)
351 return(scsp_type_name((u_char
)event
, cafsm_event_names
));
356 * Format a client interface FSM state name
362 * pointer to a string identifying the state
366 format_cifsm_state(int state
)
368 return(scsp_type_name((u_char
)state
, cifsm_state_names
));
373 * Format a client interface FSM event name
379 * pointer to a string identifying the event
383 format_cifsm_event(int event
)
385 return(scsp_type_name((u_char
)event
, cifsm_event_names
));
390 * Print a Sender or Receiver ID structure
393 * fp file to print message to
394 * idp pointer to ID to be printed
401 print_scsp_id(FILE *fp
, Scsp_id
*idp
)
406 fprintf(fp
, "%sNext: %p\n", indent
, idp
->next
);
407 fprintf(fp
, "%sLength: %d\n", indent
,
409 fprintf(fp
, "%sID: 0x", indent
);
410 for (i
= 0; i
< idp
->id_len
; i
++)
411 fprintf(fp
, "%02x ", idp
->id
[i
]);
418 * Print a Cache Key structure
421 * fp file to print message to
422 * ckp pointer to cache key structure
429 print_scsp_cache_key(FILE *fp
, Scsp_ckey
*ckp
)
434 fprintf(fp
, "%sLength: %d\n", indent
,
436 fprintf(fp
, "%sKey: 0x", indent
);
437 for (i
= 0; i
< ckp
->key_len
; i
++)
438 fprintf(fp
, "%02x ", ckp
->key
[i
]);
445 * Print the mandatory common part of a message
448 * fp file to print message to
449 * mcp pointer to mandatory common part structure
456 print_scsp_mcp(FILE *fp
, Scsp_mcp
*mcp
)
459 fprintf(fp
, "%sProtocol ID: %s (0x%02x)\n", indent
,
460 scsp_type_name(mcp
->pid
, proto_types
),
462 fprintf(fp
, "%sServer Group ID: %d\n", indent
, mcp
->sgid
);
463 fprintf(fp
, "%sFlags: 0x%04x\n", indent
,
465 fprintf(fp
, "%sRecord Count: %d\n", indent
,
467 fprintf(fp
, "%sSender ID:\n", indent
);
468 print_scsp_id(fp
, &mcp
->sid
);
469 fprintf(fp
, "%sReceiver ID:\n", indent
);
470 print_scsp_id(fp
, &mcp
->rid
);
479 * fp file to print message to
480 * exp pointer to extension
487 print_scsp_ext(FILE *fp
, Scsp_ext
*exp
)
493 fprintf(fp
, "%sNext: %p\n", indent
, exp
->next
);
494 fprintf(fp
, "%sType: %s (0x%02x)\n", indent
,
495 scsp_type_name(exp
->type
, ext_types
),
497 fprintf(fp
, "%sLength: %d\n", indent
, exp
->len
);
499 fprintf(fp
, "%sValue: 0x", indent
);
500 cp
= (u_char
*)((caddr_t
)exp
+ sizeof(Scsp_ext
));
501 for (i
= 0; i
< exp
->len
; i
++)
502 fprintf(fp
, "%02x ", *cp
++);
510 * Print an ATMARP Cache State Advertisement record
513 * fp file to print message to
514 * acsp pointer to extension
521 print_scsp_atmarp_csa(FILE *fp
, Scsp_atmarp_csa
*acsp
)
524 fprintf(fp
, "%sState: %s (%d)\n", indent
,
525 scsp_type_name(acsp
->sa_state
,
528 fprintf(fp
, "%sSource ATM addr: %s\n", indent
,
529 format_atm_addr(&acsp
->sa_sha
));
530 fprintf(fp
, "%sSource ATM subaddr: %s\n", indent
,
531 format_atm_addr(&acsp
->sa_ssa
));
532 fprintf(fp
, "%sSource IP addr: %s\n", indent
,
533 format_ip_addr(&acsp
->sa_spa
));
534 fprintf(fp
, "%sTarget ATM addr: %s\n", indent
,
535 format_atm_addr(&acsp
->sa_tha
));
536 fprintf(fp
, "%sTarget ATM subaddr: %s\n", indent
,
537 format_atm_addr(&acsp
->sa_tsa
));
538 fprintf(fp
, "%sTarget IP addr: %s\n", indent
,
539 format_ip_addr(&acsp
->sa_tpa
));
545 * Print a Cache State Advertisement record or
546 * Cache State Advertisement Summary record
549 * fp file to print message to
550 * csap pointer to CSA or CSAS
557 print_scsp_csa(FILE *fp
, Scsp_csa
*csap
)
560 fprintf(fp
, "%sNext: %p\n", indent
, csap
->next
);
561 fprintf(fp
, "%sHops: %d\n", indent
, csap
->hops
);
562 fprintf(fp
, "%sNull Flag: %s\n", indent
,
563 csap
->null
? "True" : "False");
564 fprintf(fp
, "%sSequence no.: %ld (0x%lx)\n",
565 indent
, csap
->seq
, csap
->seq
);
566 fprintf(fp
, "%sCache Key:\n", indent
);
567 print_scsp_cache_key(fp
, &csap
->key
);
568 fprintf(fp
, "%sOriginator ID:\n", indent
);
569 print_scsp_id(fp
, &csap
->oid
);
570 if (csap
->atmarp_data
) {
571 fprintf(fp
, "%sATMARP data:\n", indent
);
572 print_scsp_atmarp_csa(fp
, csap
->atmarp_data
);
579 * Print a Cache Alignment message
582 * fp file to print message to
583 * cap pointer to extension
590 print_scsp_ca(FILE *fp
, Scsp_ca
*cap
)
596 fprintf(fp
, "%sCA Seq. No.: %ld\n", indent
,
598 fprintf(fp
, "%sM bit: %s\n", indent
,
599 cap
->ca_m
? "True" : "False");
600 fprintf(fp
, "%sI bit: %s\n", indent
,
601 cap
->ca_i
? "True" : "False");
602 fprintf(fp
, "%sO bit: %s\n", indent
,
603 cap
->ca_o
? "True" : "False");
604 fprintf(fp
, "%sMandatory Common Part:\n", indent
);
605 print_scsp_mcp(fp
, &cap
->ca_mcp
);
606 for (csap
= cap
->ca_csa_rec
, n
= 1; csap
;
607 csap
= csap
->next
, n
++) {
608 fprintf(fp
, "%sCSA Record %d (%p):\n", indent
, n
, csap
);
609 print_scsp_csa(fp
, csap
);
616 * Print a Cache State Update Request, Cache State Update Reply, or
617 * Cache State Update Solicit message
620 * fp file to print message to
621 * csup pointer to CSU message
628 print_scsp_csu(FILE *fp
, Scsp_csu_msg
*csup
)
634 fprintf(fp
, "%sMandatory Common Part:\n", indent
);
635 print_scsp_mcp(fp
, &csup
->csu_mcp
);
636 for (csap
= csup
->csu_csa_rec
, i
= 1; csap
;
637 csap
= csap
->next
, i
++) {
638 fprintf(fp
, "%sCSA Record %d:\n", indent
, i
);
639 print_scsp_csa(fp
, csap
);
646 * Print a Hello message
649 * fp file to print message to
650 * hp pointer to hello message
657 print_scsp_hello(FILE *fp
, Scsp_hello
*hp
)
662 fprintf(fp
, "%sHello Interval: %d\n", indent
,
664 fprintf(fp
, "%sDead Factor: %d\n", indent
,
666 fprintf(fp
, "%sFamily ID: %d\n", indent
,
668 fprintf(fp
, "%sMandatory Common Part:\n", indent
);
669 print_scsp_mcp(fp
, &hp
->hello_mcp
);
670 ridp
= hp
->hello_mcp
.rid
.next
;
672 fprintf(fp
, "%sAdditional Receiver IDs:\n", indent
);
673 for (; ridp
; ridp
= ridp
->next
)
674 print_scsp_id(fp
, ridp
);
682 * NHRP-specific Cache State Advertisement record
684 struct scsp_nhrp_csa
{
685 u_char req_id
; /* Request ID */
686 u_char state
; /* State */
687 u_char pref_len
; /* Prefix length */
688 u_short flags
; /* See below */
689 u_short mtu
; /* Maximim transmission unit */
690 u_short hold_time
; /* Entry holding time */
691 u_char caddr_tlen
; /* Client addr type/length */
692 u_char csaddr_tlen
; /* Client subaddr type/length */
693 u_char cproto_len
; /* Client proto addr length */
694 u_char pref
; /* Preference */
695 Atm_addr caddr
; /* Client address */
696 Atm_addr csaddr
; /* Client subaddress */
697 struct in_addr cproto_addr
; /* Client protocol address */
699 typedef struct scsp_nhrp Scsp_nhrp
;
701 #define SCSP_NHRP_UNIQ 0x8000
702 #define SCSP_NHRP_ARP 0x4000
708 * Print an SCSP message
711 * fp file to print message to
712 * msg pointer to message to be printed
719 print_scsp_msg(FILE *fp
, Scsp_msg
*msg
)
730 * Print the message type
733 fprintf(fp
, "%sMessage type: %s (0x%02x)\n", indent
,
734 scsp_type_name(msg
->sc_msg_type
, msg_types
),
738 * Print the body of the message
740 switch(msg
->sc_msg_type
) {
742 print_scsp_ca(fp
, msg
->sc_ca
);
744 case SCSP_CSU_REQ_MSG
:
745 case SCSP_CSU_REPLY_MSG
:
747 print_scsp_csu(fp
, msg
->sc_csu_msg
);
750 print_scsp_hello(fp
, msg
->sc_hello
);
755 * Print any extensions
757 for (exp
= msg
->sc_ext
, n
= 1; exp
; exp
= exp
->next
, n
++) {
758 fprintf(fp
, "%sExtension %d:\n", indent
, n
);
759 print_scsp_ext(fp
, exp
);
768 * Print an SCSP ATMARP message
771 * fp file to print message to
772 * acp pointer to ATMARP message
779 print_scsp_if_atmarp(FILE *fp
, Scsp_atmarp_msg
*amp
)
782 fprintf(fp
, "%sState: %s (%d)\n", indent
,
783 scsp_type_name(amp
->sa_state
,
786 fprintf(fp
, "%sCached protocol addr: %s\n", indent
,
787 format_ip_addr(&
->sa_cpa
));
788 fprintf(fp
, "%sCached ATM addr: %s\n", indent
,
789 format_atm_addr(&
->sa_cha
));
790 fprintf(fp
, "%sCached ATM subaddr: %s\n", indent
,
791 format_atm_addr(&
->sa_csa
));
792 fprintf(fp
, "%sCache key:\n", indent
);
793 print_scsp_cache_key(fp
, &
->sa_key
);
794 fprintf(fp
, "%sOriginator ID:\n", indent
);
795 print_scsp_id(fp
, &
->sa_oid
);
796 fprintf(fp
, "%sSequence number: %ld (0x%08lx)\n", indent
,
797 amp
->sa_seq
, (u_long
)amp
->sa_seq
);
803 * Print an SCSP client interface message
806 * fp file to print message to
807 * imsg pointer to message to be printed
814 print_scsp_if_msg(FILE *fp
, Scsp_if_msg
*imsg
)
823 fprintf(fp
, "SCSP Client Interface Message at %p\n", imsg
);
826 * Print the message header
829 fprintf(fp
, "%sMessage type: %s (0x%02x)\n", indent
,
830 scsp_type_name(imsg
->si_type
, if_msg_types
),
832 fprintf(fp
, "%sResponse code: %d\n", indent
,
834 fprintf(fp
, "%sProtocol type: %s (%d)\n", indent
,
835 scsp_type_name(imsg
->si_proto
, proto_types
),
837 fprintf(fp
, "%sLength: %d\n", indent
,
839 fprintf(fp
, "%sToken: 0x%lx\n", indent
,
843 * Print the body of the message
845 switch(imsg
->si_type
) {
847 fprintf(fp
, "%sInterface: %s\n", indent
,
848 imsg
->si_cfg
.atmarp_netif
);
851 case SCSP_UPDATE_IND
:
852 case SCSP_UPDATE_REQ
:
853 len
= imsg
->si_len
- sizeof(Scsp_if_msg_hdr
);
854 ap
= &imsg
->si_atmarp
;
856 switch(imsg
->si_proto
) {
857 case SCSP_PROTO_ATMARP
:
858 fprintf(fp
, "%sATMARP CSA:\n", indent
);
859 print_scsp_if_atmarp(fp
, ap
);
860 len
-= sizeof(Scsp_atmarp_msg
);
863 case SCSP_PROTO_NHRP
:
864 case SCSP_PROTO_MARS
:
865 case SCSP_PROTO_DHCP
:
866 case SCSP_PROTO_LNNI
:
868 fprintf(fp
, "Protocol type not implemented\n");
881 * Print an SCSP pending connection block
884 * fp file to print message to
885 * pp pointer to pending control block
892 print_scsp_pending(FILE *fp
, Scsp_pending
*pp
)
902 fprintf(fp
, "Pending control block at %p\n", pp
);
905 * Print the fields of the control block
908 fprintf(fp
, "%sNext: %p\n", indent
, pp
->sp_next
);
909 fprintf(fp
, "%sSocket: %d\n", indent
,
917 * Print an SCSP server control block
920 * fp file to print message to
921 * ssp pointer to server control block
928 print_scsp_server(FILE *fp
, Scsp_server
*ssp
)
938 fprintf(fp
, "Server control block at %p\n", ssp
);
941 * Print the fields of the client control block
944 fprintf(fp
, "%sNext: %p\n", indent
,
946 fprintf(fp
, "%sName: %s\n", indent
,
948 fprintf(fp
, "%sNetwork Interface: %s\n", indent
,
950 fprintf(fp
, "%sState: %d\n", indent
,
952 fprintf(fp
, "%sProtocol ID: 0x%lx\n", indent
,
954 fprintf(fp
, "%sID length: %d\n", indent
,
956 fprintf(fp
, "%sCache key length: %d\n", indent
,
958 fprintf(fp
, "%sServer Group ID: 0x%lx\n", indent
,
960 fprintf(fp
, "%sFamily ID: 0x%lx\n", indent
,
962 fprintf(fp
, "%sSocket: %d\n", indent
,
964 fprintf(fp
, "%sDCS Listen Socket: %d\n", indent
,
966 fprintf(fp
, "%sLocal Server ID:\n", indent
);
967 print_scsp_id(fp
, &ssp
->ss_lsid
);
968 fprintf(fp
, "%sATM address: %s\n", indent
,
969 format_atm_addr(&ssp
->ss_addr
));
970 fprintf(fp
, "%sATM subaddress: %s\n", indent
,
971 format_atm_addr(&ssp
->ss_subaddr
));
972 fprintf(fp
, "%sInterface MTU: %d\n", indent
,
974 fprintf(fp
, "%sMark: %d\n", indent
,
981 * Print an SCSP client cache summary entry control block
984 * fp file to print message to
985 * csep pointer to summary entry
992 print_scsp_cse(FILE *fp
, Scsp_cse
*csep
)
995 * Print the fields of the cache summary entry
998 fprintf(fp
, "%sNext CSE: %p\n", indent
, csep
->sc_next
);
999 fprintf(fp
, "%sCSA sequence no.: %ld (0x%lx)\n", indent
,
1000 csep
->sc_seq
, csep
->sc_seq
);
1001 fprintf(fp
, "%sCache key:\n", indent
);
1002 print_scsp_cache_key(fp
, &csep
->sc_key
);
1003 fprintf(fp
, "%sOrigin ID:\n", indent
);
1004 print_scsp_id(fp
, &csep
->sc_oid
);
1010 * Print an SCSP CSU Request retransmission control block
1013 * fp file to print message to
1014 * csurp pointer to retransmission entry
1021 print_scsp_csu_rexmt(FILE *fp
, Scsp_csu_rexmt
*rxp
)
1027 fprintf(fp
, "%sNext CSU Req rexmt: %p\n", indent
, rxp
->sr_next
);
1028 fprintf(fp
, "%sDCS address: %p\n", indent
, rxp
->sr_dcs
);
1029 for (csap
= rxp
->sr_csa
, i
= 1; csap
;
1030 csap
= csap
->next
, i
++) {
1031 fprintf(fp
, "%sCSA %d:\n", indent
, i
);
1032 print_scsp_csa(fp
, csap
);
1039 * Print an SCSP DCS control block
1042 * fp file to print message to
1043 * dcsp pointer to DCS control block
1050 print_scsp_dcs(FILE *fp
, Scsp_dcs
*dcsp
)
1054 Scsp_csu_rexmt
*rxp
;
1064 fprintf(fp
, "DCS control block at %p\n", dcsp
);
1067 * Print the fields of the DCS control block
1070 fprintf(fp
, "%sNext DCS block: %p\n", indent
, dcsp
->sd_next
);
1071 fprintf(fp
, "%sServer control block: %p\n", indent
, dcsp
->sd_server
);
1072 fprintf(fp
, "%sDCS ID:\n", indent
);
1073 print_scsp_id(fp
, &dcsp
->sd_dcsid
);
1074 fprintf(fp
, "%sDCS address: %s\n", indent
,
1075 format_atm_addr(&dcsp
->sd_addr
));
1076 fprintf(fp
, "%sDCS subaddress %s\n", indent
,
1077 format_atm_addr(&dcsp
->sd_subaddr
));
1078 fprintf(fp
, "%sSocket: %d\n", indent
,
1080 fprintf(fp
, "%sOpen VCC Retry Timer:\n", indent
);
1081 fprintf(fp
, "%sHello FSM State: %s\n", indent
,
1082 format_hfsm_state(dcsp
->sd_hello_state
));
1083 fprintf(fp
, "%sHello Interval: %d\n", indent
,
1084 dcsp
->sd_hello_int
);
1085 fprintf(fp
, "%sHello Dead Factor: %d\n", indent
,
1087 fprintf(fp
, "%sHello Rcvd: %d\n", indent
,
1088 dcsp
->sd_hello_rcvd
);
1089 fprintf(fp
, "%sCA FSM State: %s\n", indent
,
1090 format_cafsm_state(dcsp
->sd_ca_state
));
1091 fprintf(fp
, "%sCA Seq. No.: 0x%lx\n", indent
,
1093 fprintf(fp
, "%sCA Rexmit Int: %d\n", indent
,
1094 dcsp
->sd_ca_rexmt_int
);
1095 fprintf(fp
, "%sCA Retransmit Msg: %p\n", indent
,
1096 dcsp
->sd_ca_rexmt_msg
);
1097 fprintf(fp
, "%sCSASs to send: ", indent
);
1098 if (dcsp
->sd_ca_csas
== NULL
) {
1099 fprintf(fp
, "Empty\n");
1101 fprintf(fp
, "%p\n", dcsp
->sd_ca_csas
);
1103 fprintf(fp
, "%sCSUS Rexmit Int: %d\n", indent
,
1104 dcsp
->sd_csus_rexmt_int
);
1105 fprintf(fp
, "%sCache Request List: ", indent
);
1106 if (dcsp
->sd_crl
== NULL
) {
1107 fprintf(fp
, "Empty\n");
1109 fprintf(fp
, "%p\n", dcsp
->sd_crl
);
1111 fprintf(fp
, "%sCSUS Rexmit Msg: %p\n", indent
,
1112 dcsp
->sd_csus_rexmt_msg
);
1113 fprintf(fp
, "%sCSA Hop count: %d\n", indent
,
1115 fprintf(fp
, "%sCSAs Pending ACK: %p\n", indent
,
1116 dcsp
->sd_csu_ack_pend
);
1117 fprintf(fp
, "%sCSAs ACKed: %p\n", indent
,
1119 fprintf(fp
, "%sCSU Req Rexmit Int: %d\n", indent
,
1120 dcsp
->sd_csu_rexmt_int
);
1121 fprintf(fp
, "%sCSU Req Rexmit Max: %d\n", indent
,
1122 dcsp
->sd_csu_rexmt_max
);
1123 fprintf(fp
, "%sCSU Req Rexmit Queue ", indent
);
1124 if (!dcsp
->sd_csu_rexmt
) {
1125 fprintf(fp
, "Empty\n");
1127 fprintf(fp
, "%p\n", dcsp
->sd_csu_rexmt
);
1129 fprintf(fp
, "%sClient I/F state: %d\n", indent
,
1130 dcsp
->sd_client_state
);
1133 * Print the list of CSASs waiting to be sent
1135 if (dcsp
->sd_ca_csas
) {
1136 fprintf(fp
, "\n%sCSASs to send:", indent
);
1138 for (csep
= dcsp
->sd_ca_csas
; csep
;
1139 csep
= csep
->sc_next
) {
1140 fprintf(fp
, "%sCache summary entry at %p\n",
1142 print_scsp_cse(fp
, csep
);
1148 * Print the Cache Request List
1151 fprintf(fp
, "\n%sCache Request List:\n", indent
);
1153 for (csap
= dcsp
->sd_crl
; csap
; csap
= csap
->next
) {
1154 fprintf(fp
, "%sCSA at %p\n", indent
, csap
);
1155 print_scsp_csa(fp
, csap
);
1161 * Print the CSU retransmit queue
1163 if (dcsp
->sd_csu_rexmt
) {
1164 fprintf(fp
, "\n%sCSU Req Rexmit Queue:\n", indent
);
1166 for (rxp
= dcsp
->sd_csu_rexmt
; rxp
;
1167 rxp
= rxp
->sr_next
) {
1168 fprintf(fp
, "%sCSU Rexmit Block at %p\n",
1170 print_scsp_csu_rexmt(fp
, rxp
);
1180 * Print SCSP's control blocks
1190 print_scsp_dump(void)
1199 static int dump_no
= 0;
1204 UM_ZERO(fname
, sizeof(fname
));
1205 sprintf(fname
, "/tmp/scspd.%d.%03d.out", getpid(), dump_no
++);
1208 * Open the output file
1210 df
= fopen(fname
, "w");
1215 * Dump the server control blocks
1217 for (ssp
= scsp_server_head
; ssp
; ssp
= ssp
->ss_next
) {
1218 print_scsp_server(df
, ssp
);
1222 * Print the client's cache summary
1224 for (i
= 0; i
< SCSP_HASHSZ
; i
++) {
1225 for (scp
= ssp
->ss_cache
[i
]; scp
;
1226 scp
= scp
->sc_next
) {
1227 print_scsp_cse(df
, scp
);
1233 * Print the client's DCS control blocks
1235 for (dcsp
= ssp
->ss_dcs
; dcsp
; dcsp
= dcsp
->sd_next
) {
1236 print_scsp_dcs(df
, dcsp
);
1237 fprintf(df
, "\n\n");
1239 fprintf(df
, "\n\n");
1243 * Print the pending connection blocks
1245 for (pp
= scsp_pending_head
; pp
; pp
= pp
->sp_next
) {
1246 print_scsp_pending(df
, pp
);
1251 * Close the output file