1. 程式人生 > >在kernel裡怎樣把IP地址從二進位制轉換成點分十進位制

在kernel裡怎樣把IP地址從二進位制轉換成點分十進位制

  1. #define NIPQUAD(addr) \
  2.         ((unsigned char *)&addr)[0], \
  3.         ((unsigned char *)&addr)[1], \
  4.         ((unsigned char *)&addr)[2], \
  5.         ((unsigned char *)&addr)[3]
  6. #define HIPQUAD(addr) \
  7.         ((unsigned char *)&addr)[3], \
  8.         ((unsigned char *)&addr)[2], \
  9.         ((unsigned char *)&addr)[1], \
  10.         ((unsigned char *)&addr)[0]