t_alloc - Allocates a library structure
XTI Library (libxti.a)
int fields) ;
Interfaces documented on this reference page conform to industry standards as follows:
Refer to the standards(5) reference page for more information about industry standards and associated tags.
The following table summarizes the relevance of input and output parameters before and after t_alloc() is called:
|Parameters||Before Call||After Call|
y This is a meaningful parameter. n This is not a meaningful parameter.
|Symbolic Name||Structure Type||Using Function|
t_accept(), t_connect(), t_listen(),
The structures listed in the Structure Type column of the preceding table are referenced as a parameter in one or more of the various XTI transport service functions. Each structure type, except struct t_info, contains at least one member of structure type struct netbuf, which is defined in the xti.h include file. For each structure type in the preceding table, you may specify that the buffer for the struct netbuf member should be allocated as well. The length of the buffer allocated for the referenced structure member depends on protocol-specific size limits returned as info member information of the t_open() and t_getinfo() functions. Refer to the description of the fields parameter for the relevant sizes returned in info. Specifies buffers for t_info type structures that are allocated for members of structures named by the struct_type parameter for a given function. The following table lists the symbolic name that must be specified for the fields parameter, identifies the t_info structure member that is the source of relevant size information, and lists the XTI function structure reference for which t_info Member memory space is reserved. The value of this parameter must be the bitwise logical OR of any of the symbolic names listed in the Symbol Name column.
Member addr of structures t_bind, t_call, t_unitdata, t_underr.
Member opt of structures t_optmgmt, t_call,
Member udata of structures t_call, t_discon,
For struct_type T_CALL, size is the greater
value of members connect and discon of structure t_info.
For struct_type T_DIS, size is the value of member
discon of structure t_info.
For struct_type T_UNITDATA, size is the value of member
tsdu of structure t_info.
All relevant members of the specified structures.
For each field type specified by the fields parameter, the t_alloc() function reserves function memory for the associated buffer. Additionally, its len member is set to 0 (zero) and its buf pointer and maxlen members are initialized.
When the size value associated with any specified t_info structure member is -1 or -2 (see the t_open() or t_getinfo() functions), the t_alloc() function can not determine the size of the buffer, causing failure. On failure, t_errno is set to [TSYSERR] and errno is set to [EINVAL]. For any structure member not specified by this parameter, its buf member is set to the null pointer and its maxlen member is set to 0 (zero).
The t_alloc() function can be called in any transport provider state except T_UNINIT. (If called in T_UNIT, the function returns the TBADF error and an invalid fd).
The t_alloc() XTI memory utility function is used to dynamically allocate memory for structures required by various XTI transport interface functions. The structure to allocate is specified by a structure symbolic name used as a mnemonic. In most cases, the mnemonic is similar to the name of the corresponding function in which the structure is used.
The t_alloc() function allocates memory for the named structure as well as for other buffers referenced by the named structure. Use of this function to allocate structures ensures compatibility with the corresponding XTI transport interface functions in which the allocated structures are used.
Upon successful completion, this function returns a pointer to the newly allocated structure. Upon failure, a null pointer is returned.
If the t_alloc() function fails, t_errno may be set to one of the following values:
The fd file descriptor does not refer to a valid transport endpoint. A system error occurred during execution of this function. An unsupported structure type is specified. This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI(t_errno).
Functions: t_free(3), t_getinfo(3), t_open(3) delim off