/[radius]/radius/radiusd/rpp.c
ViewVC logotype

Diff of /radius/radiusd/rpp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by gray, Thu Jun 5 14:30:14 2003 UTC revision 1.10 by gray, Tue Jun 10 08:07:39 2003 UTC
# Line 344  struct rpp_request { Line 344  struct rpp_request {
344          /* Raw data follow */          /* Raw data follow */
345  };  };
346    
347    #define RPP_COMPLETE  0 /* Completion reply */
348    #define RPP_UPDATE    1 /* Update reply */
349    
350  struct rpp_reply {  struct rpp_reply {
351          int code;          int code;
352          size_t size;          size_t size;
# Line 438  rpp_request_handler(void *arg ARG_UNUSED Line 441  rpp_request_handler(void *arg ARG_UNUSED
441  #endif  #endif
442    
443          while (1) {          while (1) {
444                    int rc;
445                  int len = rpp_fd_read(0, &frq, sizeof frq);                  int len = rpp_fd_read(0, &frq, sizeof frq);
446                  if (len != sizeof frq) {                  if (len != sizeof frq) {
447                          radlog(L_ERR,                          radlog(L_ERR,
# Line 460  rpp_request_handler(void *arg ARG_UNUSED Line 464  rpp_request_handler(void *arg ARG_UNUSED
464                  req = request_create(frq.type, frq.fd, &frq.addr,                  req = request_create(frq.type, frq.fd, &frq.addr,
465                                       data, frq.size);                                       data, frq.size);
466                  req->status = RS_COMPLETED;                  req->status = RS_COMPLETED;
467                  repl.code = request_handle(req, request_respond);                  rc = request_handle(req, request_respond);
468                                                    
469                  /* Inform the master */                  /* Inform the master */
470                  debug(1, ("notifying the master"));                  debug(1, ("notifying the master"));
471                  repl.size = req->update_size;                  repl.code = RPP_COMPLETE;
472                    repl.size = 0;
473                  rpp_fd_write(1, &repl, sizeof repl);                  rpp_fd_write(1, &repl, sizeof repl);
474                  if (req->update) {                  if (rc)
                         rpp_fd_write(1, req->update, req->update_size);  
                         efree(req->update);  
                         req->update = NULL;  
                         req->update_size = 0;  
                 }  
   
                 if (repl.code)  
475                          request_free(req);                          request_free(req);
476          }          }
477          return 0;          return 0;
# Line 493  rpp_input_handler(int fd, void *data) Line 491  rpp_input_handler(int fd, void *data)
491                          data = emalloc(repl.size);                          data = emalloc(repl.size);
492                          rpp_fd_read(fd, data, repl.size);                          rpp_fd_read(fd, data, repl.size);
493                  }                  }
494                    
495                  if (p) {                  if (p) {
496                          debug(1, ("updating pid %d", p->pid));                          debug(1, ("updating pid %d", p->pid));
497                          p->ready = 1;                          p->ready = 1;
# Line 504  rpp_input_handler(int fd, void *data) Line 502  rpp_input_handler(int fd, void *data)
502          return 0;          return 0;
503  }  }
504    
505    int
506    rpp_update(void *data, size_t size)
507    {
508            struct rpp_reply repl;
509    
510            repl.code = RPP_UPDATE;
511            repl.size = size;
512            rpp_fd_write(1, &repl, sizeof repl);
513            rpp_fd_write(1, data, size);
514            return 0;
515    }
516    
517  int  int
518  rpp_input_close(int fd, void *data)  rpp_input_close(int fd, void *data)
519  {  {

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26