Advertisement
Guest User

Ethernet_custom_UDP_TTL.patch

a guest
Dec 29th, 2012
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.49 KB | None | 0 0
  1. diff -rupN Ethernet//EthernetUdp.cpp Ethernet_udpttl//EthernetUdp.cpp
  2. --- Ethernet//EthernetUdp.cpp   2012-05-22 07:54:20.000000000 +0200
  3. +++ Ethernet_udpttl//EthernetUdp.cpp    2012-12-29 14:13:24.795716711 +0100
  4. @@ -98,6 +98,12 @@ int EthernetUDP::beginPacket(IPAddress i
  5.    return startUDP(_sock, rawIPAddress(ip), port);
  6.  }
  7.  
  8. +int EthernetUDP::beginPacket(IPAddress ip, uint16_t port, uint8_t ttl)
  9. +{
  10. +  _offset = 0;
  11. +  return startUDP(_sock, rawIPAddress(ip), port, ttl);
  12. +}
  13. +
  14.  int EthernetUDP::endPacket()
  15.  {
  16.    return sendUDP(_sock);
  17. diff -rupN Ethernet//EthernetUdp.h Ethernet_udpttl//EthernetUdp.h
  18. --- Ethernet//EthernetUdp.h 2012-05-22 07:54:20.000000000 +0200
  19. +++ Ethernet_udpttl//EthernetUdp.h  2012-12-29 14:13:59.419716722 +0100
  20. @@ -60,6 +60,7 @@ public:
  21.    // Start building up a packet to send to the remote host specific in ip and port
  22.    // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
  23.    virtual int beginPacket(IPAddress ip, uint16_t port);
  24. +  virtual int beginPacket(IPAddress ip, uint16_t port, uint8_t ttl);
  25.    // Start building up a packet to send to the remote host specific in host and port
  26.    // Returns 1 if successful, 0 if there was a problem resolving the hostname or port
  27.    virtual int beginPacket(const char *host, uint16_t port);
  28. diff -rupN Ethernet//utility/socket.cpp Ethernet_udpttl//utility/socket.cpp
  29. --- Ethernet//utility/socket.cpp    2012-12-29 14:06:04.595716561 +0100
  30. +++ Ethernet_udpttl//utility/socket.cpp 2012-12-29 14:10:34.027716652 +0100
  31. @@ -376,6 +376,13 @@ int startUDP(SOCKET s, uint8_t* addr, ui
  32.    }
  33.  }
  34.  
  35. +int startUDP(SOCKET s, uint8_t* addr, uint16_t port, uint8_t ttl)
  36. +{
  37. +  if (!startUDP(s, addr, port)) return 0;
  38. +  W5100.writeSnTTL(s, ttl);
  39. +  return 1;
  40. +}
  41. +
  42.  int sendUDP(SOCKET s)
  43.  {
  44.    W5100.execCmdSn(s, Sock_SEND);
  45. diff -rupN Ethernet//utility/socket.h Ethernet_udpttl//utility/socket.h
  46. --- Ethernet//utility/socket.h  2012-05-22 07:54:20.000000000 +0200
  47. +++ Ethernet_udpttl//utility/socket.h   2012-12-29 14:10:56.199716660 +0100
  48. @@ -24,6 +24,7 @@ extern uint16_t igmpsend(SOCKET s, const
  49.    @return 1 if the datagram was successfully set up, or 0 if there was an error
  50.  */
  51.  extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port);
  52. +extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port, uint8_t ttl);
  53.  /*
  54.    @brief This function copies up to len bytes of data from buf into a UDP datagram to be
  55.    sent later by sendUDP.  Allows datagrams to be built up from a series of bufferData calls.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement