4 #include <netinet/in.h>
7 typedef unsigned char UBYTE
;
11 /* This is the data. It's defined in protected mode so the child classes
12 can directly access it. Note that the value is encoded in *big endian*. */
16 /* Now the initializations and the conversions. They are defined in public
17 mode because everyone must be able to access them. */
19 /* Convert the data to int in host-endianess */
20 inline operator int ()
22 return (int) ntohs (data
);
26 inline operator short ()
31 /* Create a variable of type WORD from a short */
37 /* Same but from an int */
40 //printf ("WORD(int): v=%d\n", v);
41 data
= htons (((short)v
));
42 //printf ("WORD(int): data=%d\n", data);
45 /* How to copy a variable of type WORD */
46 inline WORD (const WORD
& v
)
51 /* How to create an uninitilized WORD variable */
58 /* This is pretty much the same but different types */
65 inline operator int ()
67 return (int) ntohl (data
);
70 inline operator void * ()
72 return (void *) ntohl (data
);
80 inline APTR (void * v
)
82 data
= htonl (((long)v
));
85 inline APTR (const APTR
& v
)
99 printf ("%08lx", data
);
104 /* This is an example how to inhert the functionality for other
109 inline operator char * ()
111 return (char *) ntohl (data
);
114 inline operator const char * ()
116 return (const char *) ntohl (data
);
124 inline STRPTR (char * v
)
126 data
= htonl ((long)v
);
130 #endif /* EXEC_TYPES_H */