Main Page | Modules | File List | Globals

GAA Debug API

Functions


Function Documentation

char* gaadebug_answer_string (
     gaa_ptr gaa,
     char * out,
     int osize,
     gaa_answer * ans)
 

Express the answer in a string.

Parameters:
gaa input gaa pointer
out output string
osize input maximum size of out string
ans input answer
Return values:
<some_string> answer string returned on success
0 failure
Note:
In a multithreaded environment, the starting and ending times in the string may be incorrect (because this function relies on gmtime, which does not appear to be thread-safe).

Definition at line 541 of file gaa_debug.c.

References gaadebug_policy_right_string().

00542 {
00543     gaa_list_entry_ptr ent;
00544     gaa_policy_right *right;
00545     int len;
00546     char *s;
00547 
00548     if (out == 0)
00549         return(0);
00550     if (ans == 0) {
00551         snprintf(out, osize, "(null answer)\n");
00552         return(out);
00553     }
00554     s = out;
00555 
00556     snprintf(s, osize, "Answer:\n");
00557     len = strlen(s);
00558     s += len;
00559     if ((osize -= len) < 2)
00560         return(out);
00561     snprintf(s, osize, "start time: ");
00562     len = strlen(s);
00563     s += len;
00564     if ((osize -= len) < 2)
00565         return(out);
00566     if (ans->valid_time && ans->valid_time->start_time)
00567     {
00568         strftime(s, osize, "%a %b %d %I:%M:%S %Z %Y",
00569                  localtime(&ans->valid_time->start_time));
00570         len = strlen(s);
00571         s += len;
00572         if ((osize -= len) < 2)
00573             return(out);
00574     }
00575     snprintf(s, osize, "\n  end time: ");
00576     len = strlen(s);
00577     s += len;
00578     if ((osize -= len) < 2)
00579         return(out);
00580     if (ans->valid_time && ans->valid_time->end_time)
00581     {
00582         strftime(s, osize, "%a %b %d %I:%M:%S %Z %Y",
00583                  localtime(&ans->valid_time->end_time));
00584         len = strlen(s);
00585         s += len;
00586         if ((osize -= len) < 2)
00587             return(out);
00588     }
00589     snprintf(s, osize, "\n");
00590     len = 1;
00591     s++;
00592     if ((osize -= len) < 2)
00593         return(out);
00594     for (ent = gaa_list_first(ans->rights); ent; ent = gaa_list_next(ent)) {
00595         right = (gaa_policy_right *)gaa_list_entry_value(ent);
00596         gaadebug_policy_right_string(gaa, s, osize, right);
00597         len = strlen(s);
00598         s += len;
00599         if ((osize -= len) < 2)
00600             return(out);
00601     }
00602     return(out);
00603 }


about globus | grid research | globus toolkit | software development

Comments? webmaster@globus.org