t_bind.3xti
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3XTI 代码 · 共 196 行
3XTI
196 行
.TH t_bind 3xti.SH Namet_bind \- bind an address to a transport endpoint .SH Syntax.B #include <xti.h>.br.sp 1.B int t_bind(\fIfd, req, ret\fB).br.B int \fIfd\fB;.br.B struct t_bind \fI*req\fB;.br.B struct t_bind\fI *ret\fB;.SH Arguments.IP \fIfd\fR 10Refers to the transport endpoint which will be associated with a protocoladdress. .IP \fIreq\fR 10Points to a \fBt_bind\fR structure containing the following members:.EXstruct netbuf \fIaddr\fP;unsigned \fIqlen\fR;.EE.IPThe \fIaddr\fR field of the .PN t_bind()structure specifies a protocoladdress, and the \fIqlen\fR field is used to indicate the maximum numberof outstanding connect indications..IP \fIret\fR 10Points to a .PN t_bind()structure. See the \fIreq\fR argument..SH Description.NXR "t_bind system call"This function associates a protocol address with the transport endpointspecified by \fIfd\fR and activates the transport endpoint. Inconnection mode, the transport provider can begin enqueuing incomingconnect indications or servicing a connection request on the transportendpoint. In connectionless mode, the transport user can send or receivedata units through the transport endpoint..NXR "t_bind system call".NXR "transport endpoint" "protocol address" .PP.TStab(@);lfHB lfHB lfHBlfR lfR lfR ..sp 4pParameters@Before Call@After Call.sp 4p_.sp 6pfd@x@/req->addr.maxlen@/@/req->addr.len@x>=0@/req->addr.buf@x(x)@/req->qlen@x>=0@/ret->addr.maxlen@x@/ret->addr.len@/@xret->addr.buf@x@(x)ret->qlen@/@x>=0.sp 6p_.TE.PP.sp 12pThe \fIreq\fR argument is used to request that an address, represented by the\fBnetbuf\fR structure, be bound to the given transport endpoint. The\fIlen\fR specifies the number of bytes in the address, and \fIbuf\fRpoints to the address buffer. The \fImaxlen\fR has no meaning for the\fIreq\fR argument. On return, \fIret\fR contains the address that thetransport provider actually bound to the transport endpoint; this may bedifferent from the address specified by the user in \fIreq\fR. In\fIret\fR, the user specifies \fImaxlen\fR, which is the maximum size ofthe address buffer, and \fIbuf\fR, which points to the buffer where theaddress is to be placed. On return, \fIlen\fR specifies the number ofbytes in the bound address, and \fIbuf\fR points to the bound address. If\fImaxlen\fR is not large enough to hold the returned address, an errorresults..PPIf the requested address is not available, or if no address is specifiedin \fIreq\fR (the \fIlen\fR field of \fIaddr\fR in \fIreq\fR is zero),the transport provider assigns an appropriate address to be boundonly if automatic generation of an address is supported and returnsthat address in the \fIaddr\fR field of \fIret\fR. The user can comparethe addresses in \fIreq\fR and \fIret\fR to determine whether thetransport provider bound the transport endpoint to a different addressthan that requested. In any XTI implementation, if the .PN t_bind()function does not allocate a local transport address, then the returnedaddress is always the same as the input address and the structure\fIreq->addr\fR must be filled by the user before the call. If thelocal address is not furnished for the call (\fIreq->addr.len=0\fR), the.PN t_bind()returns \-1 with \fBt_errno\fR set to [TNOADDR]..PPThe \fIreq\fR may be NULL if the user does not wish to specify anaddress to be bound. Here, the value of \fIqlen\fR is assumed to bezero, and the transport provider must assign an address to the transportendpoint. Similarly, \fIret\fR may be NULL if the user does not carewhat address was bound by the provider and is not interested in thenegotiated value of \fIqlen\fR. It is valid to set \fIreq\fR and\fIret\fR to NULL for the same call, in which case the provider choosesthe address to bind to the transport endpoint and does not return theinformation to the user..PPThe \fIqlen\fR field has meaning only when initializing aconnection-mode service. It specifies the number of outstanding connectindications the transport provider should support for the giventransport endpoint. An outstanding connect indication is one that hasbeen passed to the transport user by the transport provider but has not been accepted or rejected. A value of \fIqlen\fR greater than zero is meaningful only when issued by a passive transport user that expects other users to callit. The value of \fIqlen\fR will benegotiated by the transport provider and may be changed if the transportprovider cannot support the specified number of outstanding connectindications. On return, the \fIqlen\fR field in \fIret\fR containsthe negotiated value..PPThis function allows more than one transport endpoint to be bound to thesame protocol address. The transport provider, however, must support thiscapability also, it is not allowable to bind more than one protocoladdress to the same transport endpoint. If a user binds more than onetransport endpoint to the same protocol address, only one endpoint canbe used to listen for connect indications associated with the protocoladdress. .PPIn other words, only one .PN t_bind() for a given protocoladdress can specify a value of \fIqlen\fR greater than zero. In this way, thetransport provider can identify which transport endpoint should be notified of anincoming connect indication. If a user attempts to bind a protocol address to a secondtransport endpoint with a value of \fIqlen\fR greater than zero, the transport providerassigns another address to be bound to thatendpoint or, if automatic generation of addresses is not supported, returns \-1 and sets \fBt_errno\fR to [TADDRBUSY]. .PPWhen a useraccepts a connection on the transport endpoint that is being used as thelistening endpoint, the bound protocol address will be found to be busyfor the duration of the connection, until a .PN t_unbind() or.PN t_close() call has been issued. No other transport endpointsmay be bound for listening on that same protocol address while thatinitial listening endpoint is active (in the data transfer phase or inthe T_IDLE state). This prevents more than one transportendpoint bound to the same protocol address from accepting connectindications..SH Return ValuesUpon successful completion, .PN t_bind()returns 0 and \-1 on failure,and \fBt_errno\fR is set to indicate the error..SH DiagnosticsOn failure, \fBt_errno\fR is set to one of the following:.TP 20[TBADF]The specified file descriptor does not refer to a transport endpoint..TP 20[TOUTSTATE]The function was issued in the wrong sequence..TP 20[TBADADDR]The specified protocol address was in an incorrect format or containedillegal information..TP 20[TNOADDR]The transport provider could not allocate an address..TP 20[TACCES]The user does not have permission to use the specified address..TP 20[TBUFOVFLW]The number of bytes allowed for an incoming argument is not sufficientto store the value of that argument. The provider's state changes toT_IDLE and the information to be returned in \fIret\fR is discarded..TP 20[TSYSERR]A system error has occurred during execution of this function..TP 20[TADDRBUSY]The address requested is in use and the transport provider cannot beallocate a new address..SH See Alsot_alloc(3xti), t_close(3xti), t_open(3xti),t_optmgmt(3xti),t_unbind(3xti)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?