cleaning up code
[radsecproxy.git] / radsecproxy.h
index 5efe80b..a421c5e 100644 (file)
@@ -45,14 +45,14 @@ struct options {
 struct request {
     struct timeval created;
     uint8_t refcount;
-    uint8_t *buf;
+    uint8_t *buf, *replybuf;
     struct radmsg *msg;
     struct client *from;
-    struct sockaddr_storage fromsa; /* used by udpservwr */
-    int fromudpsock; /* used by udpservwr */
     char *origusername;
-    char origauth[16]; /* used by servwr */
-    uint8_t origid; /* used by servwr */
+    char origauth[16];
+    uint8_t origid;
+    int udpsock; /* only for UDP */
+    uint16_t udpport; /* only for UDP */
 };
 
 /* requests that our client will send */
@@ -63,13 +63,6 @@ struct rqout {
     struct timeval expiry;
 };
 
-/* replies that a server will send */
-struct reply {
-    unsigned char *buf;
-    struct sockaddr_storage tosa; /* used by udpservwr */
-    int toudpsock; /* used by udpservwr */
-};
-
 struct queue {
     struct list *entries;
     pthread_mutex_t mutex;
@@ -206,6 +199,10 @@ struct protodefs {
                             sizeof(struct sockaddr_in) : \
                             sizeof(struct sockaddr_in6))
 
+#define SOCKADDRP_SIZE(addr) ((addr)->sa_family == AF_INET ? \
+                            sizeof(struct sockaddr_in) : \
+                            sizeof(struct sockaddr_in6))
+
 struct addrinfo *getsrcprotores(uint8_t type);
 struct clsrvconf *find_clconf(uint8_t type, struct sockaddr *addr, struct list_node **cur);
 struct clsrvconf *find_srvconf(uint8_t type, struct sockaddr *addr, struct list_node **cur);