Set the char[4] array at ip to a 32-bit int value, swizzling bytes as needed for network order.
| 34 | |
| 35 | // Set the char[4] array at ip to a 32-bit int value, swizzling bytes as needed for network order. |
| 36 | void sethtonl(ByteType *cp,unsigned value) |
| 37 | { |
| 38 | uint32_t tmp = htonl(value); |
| 39 | ByteType *tp = (ByteType*)&tmp; |
| 40 | cp[0]=tp[0]; cp[1]=tp[1]; cp[2]=tp[2]; cp[3]=tp[3]; |
| 41 | } |
| 42 | |
| 43 | uint16_t getntohs(ByteType *cp) |
| 44 | { |