fixed some bugs, improved duplicate detection
[radsecproxy.git] / radsecproxy.h
index a4eabfc..8c17c96 100644 (file)
@@ -45,33 +45,24 @@ 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 */
+    uint8_t rqid;
+    uint8_t rqauth[16];
+    int udpsock; /* only for UDP */
+    uint16_t udpport; /* only for UDP */
 };
 
 /* requests that our client will send */
 struct rqout {
-    pthread_mutex_t *lock; /* used when modifying buf/msg/rq */
-    unsigned char *buf;
-    struct radmsg *msg;
+    pthread_mutex_t *lock;
     struct request *rq;
     uint8_t tries;
-    uint8_t received;
     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;
@@ -111,13 +102,12 @@ struct clsrvconf {
 
 struct client {
     struct clsrvconf *conf;
-    int sock; /* for tcp/dtls */
+    int sock;
     SSL *ssl;
-    pthread_mutex_t lock; /* used for updating rqs */
     struct request *rqs[MAX_REQUESTS];
     struct queue *replyq;
     struct queue *rbios; /* for dtls */
-    struct sockaddr *addr; /* for udp */
+    struct sockaddr *addr;
 };
 
 struct server {
@@ -204,10 +194,6 @@ struct protodefs {
 #define ATTRVAL(x) ((x) + 2)
 #define ATTRVALLEN(x) ((x)[1] - 2)
 
-#define SOCKADDR_SIZE(addr) ((addr).ss_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);