udppacket.cpp
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   This program is free software; you can redistribute it and/or modify  *
  4.  *   it under the terms of the GNU General Public License as published by  *
  5.  *   the Free Software Foundation; either version 2 of the License, or     *
  6.  *   (at your option) any later version.                                   *
  7.  *                                                                         *
  8.  *   copyright            : (C) 2002 by Zhang Yong                         *
  9.  *   email                : z-yong163@163.com                              *
  10.  ***************************************************************************/
  11. #include "udppacket.h"
  12. #include "ndes.h"
  13. UdpOutPacket::UdpOutPacket()
  14. {
  15. realData = data;
  16. attempts = 0;
  17. expire = 0;
  18. cmd = 0;
  19. seq = 0;
  20. }
  21. void UdpOutPacket::encrypt()
  22. {
  23. char *p = realData;
  24. int n = cursor - p;
  25. while (n > 0) {
  26. if (n < 8) {
  27. int d = 8 - n;
  28. memset(p + n, 0, d);
  29. cursor += d;
  30. }
  31. endes(p);
  32. p += 8;
  33. n -= 8;
  34. }
  35. }