static int slim_register_debugfs(struct slim_plat *info) { info->slim_debugfs_dir = debugfs_create_dir("slim", NULL); DEBUG_FILE(info->slim_debugfs_dir, "info", DEBUG_INFO); DEBUG_FILE(info->slim_debugfs_dir, "mem", DEBUG_MEMORY); DEBUG_FILE(info->slim_debugfs_dir, "regs", DEBUG_REGS); DEBUG_FILE(info->slim_debugfs_dir, "slim.elf", DEBUG_ELF); DEBUG_FILE(info->slim_debugfs_dir, "core.elf", DEBUG_CORE); return 0; }
void ShowNormalMassage(ThreadContext *Context, int32_t Offset, char ProtocolCharacter) { char DateAndTime[32]; char InfoBuffer[1024]; if( ShowMassages == TRUE || DEBUGMODE ) { GetCurDateAndTime(DateAndTime, sizeof(DateAndTime)); InfoBuffer[0] = '\0'; GetAllAnswers(ExtendableBuffer_GetPositionByOffset(Context -> ResponseBuffer, Offset), InfoBuffer, sizeof(InfoBuffer)); } if( ShowMassages == TRUE ) { printf("%s[%c][%s][%s][%s] : %d bytes\n%s", DateAndTime, ProtocolCharacter, Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, ExtendableBuffer_GetUsedBytes(Context -> ResponseBuffer) - Offset, InfoBuffer ); } DEBUG_FILE("[%c][%s][%s][%s] :%d bytes\n%s", ProtocolCharacter, Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, ExtendableBuffer_GetUsedBytes(Context -> ResponseBuffer) - Offset, InfoBuffer ); }
int main(int argc, char **argv) { program_name = argv[0]; int i; int found = 0; int ok = 1; #ifdef CAPTURE_MODE FILE *dump; fprintf(stderr, "%s: invoked with %d arguments ...\n", argv[0], argc); for (i = 0; i < argc; i++) fprintf(stderr, "%2d: %s\n", i, argv[i]); if ((dump = fopen(DEBUG_FILE("pre-html-data"), "wb")) != NULL) { while((i = fgetc(stdin)) >= 0) fputc(i, dump); fclose(dump); } exit(1); #endif /* CAPTURE_MODE */ device = "html"; if (!font::load_desc()) fatal("cannot find devhtml/DESC exiting"); image_gen = font::image_generator; if (image_gen == NULL || (strcmp(image_gen, "") == 0)) fatal("devhtml/DESC must set the image_generator field, exiting"); postscriptRes = get_resolution(); i = scanArguments(argc, argv); setupAntiAlias(); checkImageDir(); makeFileName(); while (i < argc) { if (argv[i][0] != '-') { /* found source file */ ok = do_file(argv[i]); if (!ok) return 0; found = 1; } i++; } if (!found) do_file("-"); if (makeTempFiles()) return 1; ok = inputFile.do_image(argc, argv); if (ok == 0) { generateImages(regionFileName); ok = inputFile.do_html(argc, argv); } return ok; }
static int makeTempFiles(void) { #if defined(DEBUGGING) psFileName = DEBUG_FILE("prehtml-ps"); regionFileName = DEBUG_FILE("prehtml-region"); imagePageName = DEBUG_FILE("prehtml-page"); psPageName = DEBUG_FILE("prehtml-psn"); troffFileName = DEBUG_FILE("prehtml-troff"); htmlFileName = DEBUG_FILE("prehtml-html"); #else /* not DEBUGGING */ FILE *f; /* psPageName contains a single page of postscript */ f = xtmpfile(&psPageName, PS_TEMPLATE_LONG, PS_TEMPLATE_SHORT, TRUE); if (f == NULL) { sys_fatal("xtmpfile"); return -1; } fclose(f); /* imagePageName contains a bitmap image of the single postscript page */ f = xtmpfile(&imagePageName, PAGE_TEMPLATE_LONG, PAGE_TEMPLATE_SHORT, TRUE); if (f == NULL) { sys_fatal("xtmpfile"); return -1; } fclose(f); /* psFileName contains a postscript file of the complete document */ f = xtmpfile(&psFileName, PS_TEMPLATE_LONG, PS_TEMPLATE_SHORT, TRUE); if (f == NULL) { sys_fatal("xtmpfile"); return -1; } fclose(f); /* regionFileName contains a list of the images and their boxed coordinates */ f = xtmpfile(®ionFileName, REGION_TEMPLATE_LONG, REGION_TEMPLATE_SHORT, TRUE); if (f == NULL) { sys_fatal("xtmpfile"); return -1; } fclose(f); #endif /* not DEBUGGING */ return 0; }
void ShowBlockedMessage(const char *RequestingDomain, const char *Package, const char *Message) { char DateAndTime[32]; char InfoBuffer[1024]; if( ShowMassages == TRUE || DEBUGMODE ) { GetCurDateAndTime(DateAndTime, sizeof(DateAndTime)); InfoBuffer[0] = '\0'; GetAllAnswers(Package, InfoBuffer, sizeof(InfoBuffer)); } if( ShowMassages == TRUE ) { printf("%s[B][%s] %s :\n%s", DateAndTime, RequestingDomain, Message == NULL ? "" : Message, InfoBuffer); } DEBUG_FILE("[B][%s] %s :\n%s", RequestingDomain, Message == NULL ? "" : Message, InfoBuffer); }
void ShowErrorMassage(ThreadContext *Context, char ProtocolCharacter) { char DateAndTime[32]; int ErrorNum = GET_LAST_ERROR(); char ErrorMessage[320]; if( ErrorMessages == TRUE || DEBUGMODE ) { GetCurDateAndTime(DateAndTime, sizeof(DateAndTime)); ErrorMessage[0] ='\0'; GetErrorMsg(ErrorNum, ErrorMessage, sizeof(ErrorMessage)); } if( ErrorMessages == TRUE ) { printf("%s[%c][%s][%s][%s] An error occured : %d : %s .\n", DateAndTime, ProtocolCharacter, Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, ErrorNum, ErrorMessage ); } DEBUG_FILE("[%c][%s][%s][%s] An error occured : %d : %s .\n", ProtocolCharacter, Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, ErrorNum, ErrorMessage ); }
void ShowRefusingMassage(ThreadContext *Context, const char *Massage) { char DateAndTime[32]; if( ShowMassages == TRUE || DEBUGMODE ) { GetCurDateAndTime(DateAndTime, sizeof(DateAndTime)); printf("%s[R][%s][%s][%s] %s.\n", DateAndTime, Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, Massage ); } DEBUG_FILE("[R][%s][%s][%s] %s.\n", Context -> ClientIP, DNSGetTypeName(Context -> RequestingType), Context -> RequestingDomain, Massage ); }
int InitAddress(void) { StringList *tcpaddrs = ConfigGetStringList(&ConfigInfo, "TCPServer"); StringList *udpaddrs = ConfigGetStringList(&ConfigInfo, "UDPServer"); const char *Itr = NULL; if( AddressChunk_Init(&Addresses) != 0 ) { return -1; } Itr = StringList_GetNext(tcpaddrs, NULL); while( Itr != NULL ) { if( AddressChunk_AddATCPAddress_FromString(&Addresses, Itr) != 0 ) { INFO("Bad address : %s\n", Itr); } else { DEBUG_FILE("Add TCP address : %s\n", Itr); } Itr = StringList_GetNext(tcpaddrs, Itr); } Itr = StringList_GetNext(udpaddrs, NULL); while( Itr != NULL ) { if( AddressChunk_AddAUDPAddress_FromString(&Addresses, Itr) != 0 ) { INFO("Bad address : %s\n", Itr); } else { DEBUG_FILE("Add UDP address : %s\n", Itr); } Itr = StringList_GetNext(udpaddrs, Itr); } ParallelQuery = ConfigGetBoolean(&ConfigInfo, "ParallelQuery"); if( ParallelQuery == TRUE ) { int NumberOfAddr; int AddrLen; sa_family_t SubFamily; struct sockaddr *OneAddr; NumberOfAddr = StringList_Count(udpaddrs); if( NumberOfAddr <= 0 ) { ERRORMSG("No UDP server specified, cannot use parallel query.\n") ParallelQuery = FALSE; } else { DEBUG_FILE("Enable parallel query.\n"); AddressChunk_GetOneUDPBySubscript(&Addresses, &MainFamily, 0); if( MainFamily == AF_INET ) { AddrLen = sizeof(struct sockaddr); DEBUG_FILE("Parallel query servers family IPv4.\n"); } else { AddrLen = sizeof(struct sockaddr_in6); DEBUG_FILE("Parallel query servers family IPv6.\n"); } Array_Init(&Addresses_Array, AddrLen, NumberOfAddr, FALSE, NULL); while( NumberOfAddr != 0 ) { OneAddr = AddressChunk_GetOneUDPBySubscript(&Addresses, &SubFamily, NumberOfAddr - 1); if( OneAddr != NULL && SubFamily == MainFamily ) { Array_PushBack(&Addresses_Array, OneAddr, NULL); } --NumberOfAddr; } } } StringList_Free(tcpaddrs); StringList_Free(udpaddrs); return LoadDedicatedServer(); }