Chapter Contents

Previous

Next
GETLONG, _getlong

GETLONG, _getlong



Gets a Long Integer from a Character Buffer

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <arpa/nameser.h>

GETLONG(l_int, msgp)

u_long _getlong(const u_char *msgp);


DESCRIPTION

The GETLONG macro and _getlong function extract an unsigned long integer l_int from a character buffer addressed by msgp . The bytes of the extracted integer are assumed to have been stored in the buffer as four consecutive bytes, starting with the high-order byte. The _getlong function returns the value. The GETLONG macro requires that both arguments be lvalues. mgsp is advanced by four bytes. The extracted unsigned long value is assigned to l_int .

This routine is useful in resolver programming. For information on buffer formats for Internet name servers, refer to Chapter 20, "The Domain Name System," in Internetworking with TCP/IP.


RETURN VALUE

_getlong returns the value of the unsigned long integer. GETLONG is syntactically a statement rather than an expression and, therefore, has no return value.


CAUTION

GETLONG evaluates its arguments more than once.


IMPLEMENTATION

The GETLONG macro is defined in the <arpa/nameser.h> header file.


RELATED FUNCTIONS

GETSHORT , PUTLONG , PUTSHORT


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.