Doc on error messages
Thomas Garsiot
garsiot@st2e.com
Mon Feb 26 09:44:00 GMT 2001
Here are the details of the code you requested :
actually this is some code extracted from UCD-SNMP :
struct sockaddr_in *pduIp;
struct snmp_pdu *template_pdu;
pduIp = (struct sockaddr_in *)&(template_pdu->agent_addr);
pduIp->sin_family = AF_INET;
----------------------------------
type definitions :
#define _UCD_SS_MAXSIZE 92 /* <= sizeof( sockaddr_un ) */
#define _UCD_SS_ALIGNSIZE (sizeof (long))
#define _UCD_SS_PAD1SIZE (_UCD_SS_ALIGNSIZE - sizeof( unsigned short ))
#define _UCD_SS_PAD2SIZE (_UCD_SS_MAXSIZE - \
(sizeof( unsigned short ) + _UCD_SS_PAD1SIZE + _UCD_SS_ALIGNSIZE ))
typedef struct {
unsigned char sa_len;
unsigned char sa_family;
char sa_data[ _UCD_SS_PAD1SIZE ];
long sa_align;
char sa_pad2[ _UCD_SS_PAD2SIZE ];
} snmp_ipaddr;
struct snmp_pdu {
[...]
snmp_ipaddr agent_addr;
[...]
};
-----------------
/*
* Socket address, internet style.
*/
struct sockaddr_in {
u_char sin_len;
u_char sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
struct in_addr {
u_long s_addr;
};
I tried to include only the useful part. Sorry if it's a little messy.
Thanks in advance for your help.
Cheers,
Thomas
More information about the Gcc-help
mailing list