~ubuntu-branches/ubuntu/wily/trafficserver/wily

« back to all changes in this revision

Viewing changes to iocore/net/I_UDPNet.h

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-17 22:28:16 UTC
  • mfrom: (5.1.8 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121217222816-7xwjsx5k76zkb63d
Tags: 3.2.0-1ubuntu1
* Revert FreeBSD strerror_r() fixes that give errors with glibc 2.16.
* Apply patch from Konstantinos Margaritis to define barriers on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
#include "I_Version.h"
36
36
#include "I_EventSystem.h"
 
37
#include "ink_inet.h"
 
38
 
37
39
/**
38
40
   UDP service
39
41
 
47
49
 
48
50
  //this function was interanal intially.. this is required for public and
49
51
  //interface probably should change.
50
 
  bool CreateUDPSocket(int *resfd, struct sockaddr_in *addr,
51
 
                       Action ** status,
52
 
                       int my_port, unsigned int my_ip = 0, int send_bufsize = 0, int recv_bufsize = 0);
 
52
  bool CreateUDPSocket(
 
53
    int *resfd,
 
54
    sockaddr const* remote_addr,
 
55
    sockaddr* local_addr,
 
56
    int* local_addr_len,
 
57
    Action ** status,
 
58
    int send_bufsize = 0, int recv_bufsize = 0
 
59
  );
53
60
 
54
61
  /**
55
62
     create UDPConnection
63
70
 
64
71
     @param c Continuation that is called back with newly created
65
72
     socket.
66
 
     @param my_port Local port to be bound (required)
67
 
     @param my_ip Local IP to be bound (optional).  Defaults to '0' (INADDR_ANY)
 
73
     @param addr Address to bind (includes port)
68
74
     @param send_bufsize (optional) Socket buffer size for sending.
69
75
     Limits how much outstanding data to OS before it is able to send
70
76
     to the NIC.
73
79
     @return Action* Always returns ACTION_RESULT_DONE if socket was
74
80
     created successfuly, or ACTION_IO_ERROR if not.
75
81
  */
76
 
  inkcoreapi Action *UDPBind(Continuation * c, int my_port, int my_ip = 0, int send_bufsize = 0, int recv_bufsize = 0);
 
82
  inkcoreapi Action *UDPBind(Continuation * c, sockaddr const* addr, int send_bufsize = 0, int recv_bufsize = 0);
77
83
 
78
84
  // The mess again: the complier won't let me stick UDPConnection here.
79
 
  void UDPClassifyConnection(Continuation * udpConn, int destIP);
 
85
  void UDPClassifyConnection(Continuation * udpConn, IpAddr const& addr);
80
86
 
81
87
  // create pairs of UDPConnections in which the first connection is
82
88
  // on a even-#'ed port and the second connection is on the next
83
89
  // odd-#'ed port.  Create "nPairs" of such connections.
84
90
  Action *UDPCreatePortPairs(Continuation *, int nPairs,
85
 
                             unsigned int myIP = 0,
86
 
                             unsigned int destIP = 0, int send_bufsize = 0, int recv_bufsize = 0);
 
91
    sockaddr const* local_addr,
 
92
    sockaddr const* remote_addr,
 
93
    int send_bufsize = 0, int recv_bufsize = 0);
87
94
 
88
95
  // Regarding sendto_re, sendmsg_re, recvfrom_re:
89
96
  // * You may be called back on 'c' with completion or error status.
105
112
  // * You can get other info about the completed operation through use
106
113
  //   of the completionUtil class.
107
114
  Action *sendto_re(Continuation * c, void *token, int fd,
108
 
                    struct sockaddr *toaddr, int toaddrlen, IOBufferBlock * buf, int len);
 
115
                    sockaddr const* toaddr, int toaddrlen, IOBufferBlock * buf, int len);
109
116
  // I/O buffers referenced by msg must be pinned by the caller until
110
117
  // continuation is called back.
111
118
  Action *sendmsg_re(Continuation * c, void *token, int fd, struct msghdr *msg);
112
119
 
113
120
  Action *recvfrom_re(Continuation * c, void *token, int fd,
114
 
                      struct sockaddr *fromaddr, socklen_t *fromaddrlen,
 
121
                      sockaddr *fromaddr, socklen_t *fromaddrlen,
115
122
                      IOBufferBlock * buf, int len, bool useReadCont = true, int timeout = 0);
116
123
  // Continuation is really a UDPConnection; due to the include mess, we stick in the
117
124
  // base-class of UDPConnection.