rpc_gss_max_data_length Subroutine

Purpose

Gets the maximum length of untransformed data that is allowed by the transport (a client-side version).

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpcsec_gss.h>
int rpc_gss_max_data_length(a_handle, max_tp_length)
AUTH *a_handle;
int max_tp_length;

Description

Some transport types have restrictions on the maximum size of data that can be sent out in one data unit. After the security transformations on actual data, data length increases that depends on the selected security mechanism. Some applications need to know the actual length of untransformed data that is allowed before performing security transformations. You can get this maximum length of untransformed data using the rpc_gss_max_data_length subroutine.

Parameters

Item Description
a_handle Represents an RPC handle that is returned when security context is created.
max_tp_length Represents the maximum length of data unit allowed by transport. This is an input parameter.

Return Values

On successful completion, the rpc_gss_max_data_length subroutine returns the maximum size of untransformed data that is allowed.

Examples

#include <stdlib.h>
#include <tiuser.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_gss.h>

main()
{
    CLIENT *client;
    int fd, untransformed_data, max_tp_len;
    struct t_info info;
        
    /* Create client handle */
        /* Create security context */
    
    /* Get associated file descriptor */ 
    if(clnt_control(client,CLGET_FD,(caddr_t)&fd) == FALSE)
    {
        fprintf(stderr,"\nError in clnt_control.\n");
        exit(1);
    }
    /* Get info related to transport */
    if(t_getinfo(fd,&info) !=0)
    {
        fprintf(stderr,"\nError in t_getinfo.\n");
        exit(1);
    }
    /* Get max data length allowed by transport */ 
    max_tp_len = info.tsdu;
         
    /* get max untransformed data length */
    untransformed_data = rpc_gss_max_data_length(client->cl_auth,  max_tp_len);
}