rpc_gss_svc_max_data_length Subroutine

Purpose

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

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpcsec_gss.h>
int rpc_gss_svc_max_data_length(req,max_tp_length)
struct svc_req *req;
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_svc_max_data_length subroutine.

Parameters

Item Description
req Points to a received service-request structure.
max_tp_length Represents the maximum length of data unit allowed by transport. This is an input parameter.

Return Values

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

Examples

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

#define PROGNUM 0x3fffffffL
#define VERSNUM 0x1L
 
static void sample_dispatch(struct svc_req *, SVCXPRT *);
main()
{
    /* Create RPC service handle and register with RPCBIND service */
    /* Set the principal name */
    svc_run();
    return 1;          
    } 
    /* following is the sample dispatch routine*/
    static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
    {
    int untransformed_data, max_tp_len;
    struct t_info info;

    /* Get info related to transport */
    if(t_getinfo(xprt->xp_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 data length allowed by transport */ 
    untransformed_data = rpc_gss_svc_max_data_length(request, max_tp_len);

    /* Send reply back to caller */

}