Sponsored Content
Full Discussion: Byte order question
Top Forums Programming Byte order question Post 302347996 by emitrax on Thursday 27th of August 2009 06:13:28 AM
Old 08-27-2009
Byte order question

Hi,

The structure that will follow is supposed to hold the following RTP header field

Code:
  0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |V=2|P|X|  CC   |M|     PT      |       sequence number         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           timestamp                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Code:
typedef struct rtp_header
{
#ifdef BIGENDIAN
    uint16_t version:2;
    uint16_t padbit:1;
    uint16_t extbit:1;
    uint16_t cc:4;
    uint16_t markbit:1;
    uint16_t paytype:7;
#else
    uint16_t cc:4;
    uint16_t extbit:1;
    uint16_t padbit:1;
    uint16_t version:2;
    uint16_t paytype:7;
    uint16_t markbit:1;
#endif
    uint16_t seq_number;

Shouldn't it be like the following

Code:
typedef struct rtp_header
{
#ifdef BIGENDIAN
    uint16_t version:2;
    uint16_t padbit:1;
    uint16_t extbit:1;
    uint16_t cc:4;
    uint16_t markbit:1;
    uint16_t paytype:7;
#else
    uint16_t markbit:1;
    uint16_t paytype:7;
    uint16_t version:2;
     uint16_t padbit:1;
     uint16_t extbit:1;
     uint16_t cc:4;
#endif
    uint16_t seq_number;

Or am I missing something?

Thanks in advance,
S.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

zero byte with String

My program would be creating a file, incase of non data from database it would only able to produce 'END, logically it would be file created by oracle in unix. this file is showing zero byte but actully there are 4 char in file.This is not required, therefore what is command line should be... (0 Replies)
Discussion started by: u263066
0 Replies

2. Programming

Byte Padding

Hi, Can someone explain what is byte padding? For ex: struct emp{ char s; int b; char s1; int b1; long b3; char s3; } What will be the size of this structure? Thanks (6 Replies)
Discussion started by: naan
6 Replies

3. Programming

Question on order of headers and WEXITSTATUS

In one of the Unix Programming FAQ's they have the following headers in the program to catch SIGCHLD #include <sys/types.h> /* include this before any other sys headers */ #include <sys/wait.h> /* header for waitpid() and various macros */ #include <signal.h> /* header for signal... (5 Replies)
Discussion started by: frequency8
5 Replies

4. Shell Programming and Scripting

0 byte file with no name????

Please help me in removing the 2nd file : -rw-rw-rw- 1 fup03a fup03a 9216 Aug 16 00:45 med_delay_log -rw-rw-rw- 1 fup03a fup03a 0 Aug 16 18:04 (5 Replies)
Discussion started by: miltonkeynesguy
5 Replies

5. Programming

Printing out Byte in C

Hi all, Can anyone advise on how to display the data in a byte variable, i.e can i use printf("%s", vairable_name);? Cheers (2 Replies)
Discussion started by: dwgi32
2 Replies

6. Shell Programming and Scripting

Check if 2 files are identical byte-to-byte?

In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server. For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match. Please... (4 Replies)
Discussion started by: krishmaths
4 Replies

7. Shell Programming and Scripting

Remove a byte(Last byte from the last line)

Hi All Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE. Please suggest me something. Thank's and regards Vinay (1 Reply)
Discussion started by: vinayrao
1 Replies

8. IP Networking

Total byte

Hi I've a pkts trace and I'm performing some test on it. I'd like to figure out also the numbers of total byte in that trace. Any idea? thanks in advance D. (0 Replies)
Discussion started by: Dedalus
0 Replies

9. UNIX for Advanced & Expert Users

Problem With UTF8 Byte Order Make

Hi Im migrating a few websites from my old webserver (CentOS-5) to a new server (CentOS6) , one of these websites is multilingual and has a lot of utf8 files(html,php) with different languages (i.e arabic, persian, russian ,etc). In old server when i do: file mailer.php I get : ... (6 Replies)
Discussion started by: mohs3n
6 Replies

10. Programming

Oracle 11g optimizer best join order question

Hi team Optimizer max permutations and search limit are set to 3.5 million and 10 respectively.The parameter instruct optimizer to evaluate up to 3.5 million permutations for max 10 table joins I have query with 9 tables joined. How many combinations will optimizer perform to find best... (1 Reply)
Discussion started by: Perlbaby
1 Replies
xcb_xkb_access_x_notify_event_t(3)				    XCB Events					xcb_xkb_access_x_notify_event_t(3)

NAME
xcb_xkb_access_x_notify_event_t - SYNOPSIS
#include <xcb/xkb.h> Event datastructure typedef struct xcb_xkb_access_x_notify_event_t { uint8_t response_type; uint8_t xkbType; uint16_t sequence; xcb_timestamp_t time; uint8_t deviceID; xcb_keycode_t keycode; uint16_t detailt; uint16_t slowKeysDelay; uint16_t debounceDelay; uint8_t pad0[16]; } xcb_xkb_access_x_notify_event_t; EVENT FIELDS
response_type The type of this event, in this case XCB_XKB_ACCESS_X_NOTIFY. This field is also present in the xcb_generic_event_t and can be used to tell events apart from each other. sequence The sequence number of the last request processed by the X11 server. xkbType NOT YET DOCUMENTED. time NOT YET DOCUMENTED. deviceID NOT YET DOCUMENTED. keycode NOT YET DOCUMENTED. detailt NOT YET DOCUMENTED. slowKeysDelay NOT YET DOCUMENTED. debounceDelay NOT YET DOCUMENTED. DESCRIPTION
SEE ALSO
AUTHOR
Generated from xkb.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. XCB
2014-06-10 xcb_xkb_access_x_notify_event_t(3)
All times are GMT -4. The time now is 06:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy