OpenSS7
SS7 for the
Common Man
© Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved.
Last modified: Sat, 01 Nov 2008 10:41:55 GMT
Home TopIndex FirstPrev Next LastMore Download Info FAQ Mail  Home -> Documentation -> Man Pages -> Manual Page
Quick Links

Download

SCTP

SIGTRAN

SS7

Hardware

STREAMS

Asterisk

Related

Package

Manual

FAQ

Man Pages

Applications

SS7 Stack

ISDN Stack

SIGTRAN Stack

VoIP Stack

MG Stack

SS7/ISDN Devices

IP Transport

Embedded Systems

OS

Documentation

FAQ

SIGTRAN

Design

Conformance

Performance

References

Man Pages

Manuals

Papers

Home

Overview

Status

Documentation

Resources

About

News

Description: Manual Page

Keywords: ss7 ss7/ip ss7 over ip ss7 mtp ss7 sccp ss7 tcap sigtran mtp sccp tcap openss7 acb56 linux telephony pstn linux telephony linux nebs linux compactpci


MSGDSIZE

Section: Linux Fast-STREAMS DDI/DKI (9)
Updated: 2008-10-31
Index Return to Main Contents

NAME

msgdsize - calculate the size of the data in a STREAMS message

SYNOPSIS

#include <sys/stream.h>

int msgdsize(mblk_t *mp);

ARGUMENTS

mp

the message within which to count data bytes.

INTERFACE

STREAMS.

DESCRIPTION

msgdsize() returns the number of data bytes in the M_DATA(9) blocks contained in the message pointed to by mp. The number of byte considered to be contained in an M_DATA(9) block are the number of bytes between the b_rptr and b_wptr pointers. If b_rptr is greater than or equal to b_wptr, then the M_DATA(9) message block is considered to contain zero bytes. Otherwise the number of bytes contained is the pointer difference: (b_wptr - b_rptr).

USAGE

msgdsize() is not a very useful function. It is used by the Stream head only to implement the I_NREAD(7) intput-output control command. msgdsize() is not very useful because all data blocks after the initial data block in a message are considered to be of type M_DATA(9) regardless of their actual data type (see M_DATA(9)). Therefore, the second of the following two statements is faster (see msgsize(9)):

size = msgdsize(mp);
size = (DB_TYPE(mp) == M_DATA) ? msgsize(mp) : msgsize(mp->b_cont);

RETURN

Upon success, msgdsize() returns the number of bytes contained in M_DATA(9) blocks in in the message. Upon failure, msgdsize() returns zero (0).

ERRORS

msgdsize() fails if the message pointer mp is NULL.

CONTEXT

msgdsize() can be called from any context, including user context, module procedures, callouts, callbacks, soft interrupts (tasklets and bottom halves), and interrupt service routines.

MP-STREAMS

msgdsize() is MP-safe; however, the caller must ensure exclusive access to the passed in message. See mp-streams(9).

NOTICES

msgdsize() will fail and potentially panic the kernel if the passed in message pointer, mp, that is invalid. If the passed in message pointer, mp, is NULL; however, the function will return zero (0).

Portable STREAMS drivers and modules will not pass msgdsize() a NULL or invalid message pointer as an argument.

IMPLEMENTATION

msgdsize() is implemented as an extern inline for speed, as follows:


__EXTERN_INLINE size_t msgdsize(mblk_t *mp)
{
    size_t size = 0;
    for (; mp; mp = mp->b_cont)
        if (mp->b_datap->db_type == M_DATA)
            if (mp->b_wptr > mp->b_rptr)
                size += mp->b_wptr - mp->b_rptr;
    return (size);
}

SEE ALSO

msgsize(9), xmsgsize(9).

BUGS

msgdsize() has no known bugs.

COMPATIBILITY

msgdsize() is compatible with SVR 4.2 MP DDI/DKI[1], and implementations based on SVR 4[2] with the following portability considerations:

---
msgdsize() is a widely implemented STREAMS function that is compatible across many of the implementations discussed here.
Portable STREAMS drivers and modules may use this function.
---
LiS[3] places limits on the maximum size of a message block. msgdsize() does not.
Portable STREAMS drivers and modules will use Linux Fast-STREAMS instead of LiS.
---
Binary compatibility is not guaranteed.

See STREAMS(9) for additional compatibility information.

CONFORMANCE

SVR 4.2 MP DDI/DKI[1].

HISTORY

msgdsize() appears as part of SVR 4.0 STREAMS[4].

msgdsize() first appeared in SVR 3[5].

REFERENCES

[1]
USL DDI/DKI, Device Driver Interface/Driver-Kernel Interface (DDI/DKI) Reference Manual for Intel Processors, 1992, (Englewood Cliffs, New Jersey), AT&T UNIX System Laboratories, Inc., Prentice Hall.
[2]
SVR 4 DDI/DKI, UNIX® System V Release 4 Device Driver Interface/Driver-Kernel Interface (DDI/DKI) Reference Manual, 1990, (Englewood Cliffs, New Jersey), AT&T UNIX System Laboratories, Inc., Prentice Hall.
[3]
LIS 2.18, Linux STREAMS (LiS) 2.18.6 Source Code, Brian Bidulock, ed., OpenSS7 Corporation. <http://www.openss7.org/>
[4]
SVR 4, UNIX® System V Release 4 STREAMS Programmer's Guide, 1990, (Englewood Cliffs, New Jersey), AT&T UNIX System Laboratories, Inc., Prentice Hall.
[5]
SVR 3, UNIX® System V Release 3 STREAMS Programmer's Guide, (Englewood Cliffs, New Jersey), AT&T UNIX System Laboratories, Inc., Prentice Hall.

TRADEMARKS

OpenSS7tm
is a trademark of OpenSS7 Corporation.
Linux®
is a registered trademark of Linus Torvalds.
UNIX®
is a registered trademark of The Open Group.
Solaris®
is a registered trademark of Sun Microsystems.

Other trademarks are the property of their respective owners.

IDENTIFICATION


Linux Fast-STREAMS: Package streams version 0.9.2.4 released 2008-10-31.

Copyright©1997-2008OpenSS7 Corp. All Rights Reserved.
(See roff source for permission notice.)



Index

NAME
SYNOPSIS
ARGUMENTS
INTERFACE
DESCRIPTION
USAGE
RETURN
ERRORS
CONTEXT
MP-STREAMS
NOTICES
IMPLEMENTATION
SEE ALSO
BUGS
COMPATIBILITY
CONFORMANCE
HISTORY
REFERENCES
TRADEMARKS
IDENTIFICATION

This document was created by man2html, using the manual pages.
Time: 22:31:34 GMT, May 18, 2013
OpenSS7
SS7 for the
Common Man
Home TopIndex FirstPrev Next LastMore Download Info FAQ Mail  Home -> Documentation -> Man Pages -> Manual Page
Last modified: Sat, 01 Nov 2008 10:41:55 GMT
© Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved.