Пример #1
0
/* Display IP data for connected AP */
void display_ap(Wifi_AccessPoint * ap, int new_ap)
{
	static struct in_addr ip, gw, sn, dns1, dns2;
	int status;
	static struct hostent *google_addr = NULL;
	static struct in_addr g_ip;
	static int errno_cache;

	clear_main();

	status = Wifi_AssocStatus();

	print_xy(0, 0, "SSID :");
	print_xy(0, 1, ap->ssid);
	print_xy(0, 3, "State :");
	printf_xy(0, 4, "%s", ASSOCSTATUS_STRINGS[status]);
	if (status == ASSOCSTATUS_ASSOCIATED) {
		ip = Wifi_GetIPInfo(&gw, &sn, &dns1, &dns2);

		printf_xy(0, 6, "IP :        %s", inet_ntoa(ip));
		printf_xy(0, 7, "Subnet :    %s", inet_ntoa(sn));
		printf_xy(0, 8, "GW :        %s", inet_ntoa(gw));
		printf_xy(0, 9, "DNS1 :      %s", inet_ntoa(dns1));
		printf_xy(0, 10, "DNS2 :      %s", inet_ntoa(dns2));

		/* new association, try Google again */
		if (new_ap) {
			DEBUG_PRINT("new ap!");
			google_addr = gethostbyname("www.google.com");
			if (google_addr != NULL) {
				g_ip =
				    *(struct in_addr
				      *)(google_addr->h_addr_list[0]);
				if (try_google(&g_ip) == 0) {
					errno_cache = 0;
				} else {
					errno_cache = errno;
				}
			}
		} else {
			if (google_addr == NULL)
				printf_xy(0, 12, "DNS failed");
			else {
				printf_xy(0, 12, "Google IP : %s",
					  inet_ntoa(g_ip));
				if (errno_cache) {
					printf_xy(0, 13, "GET errno : %d",
						  errno_cache);
				} else {
					printf_xy(0, 13,
						  "GET : OK, see top screen");
				}
			}
		}
	}
}
Пример #2
0
void
print_coluna(int linha)
{
	linha--;
	linha--;
	print_atributo(linha, linha + 1, 0, 80, 1, 1);
	print_xy(1, linha, "::nome::");
	print_xy(16, linha, "::data::");
	print_xy(29, linha, "::hora::");
	print_xy(40, linha, "::tam::");
	print_xy(51, linha, "::atr::");
} void
Пример #3
0
/* display a list of AP on the screen, starting at "index", displaying
   only those specified in "flags" */
void display_list(int index, int flags)
{
	/* header */
	displayed = 1;

	clear_main();

	printf_xy(0, 0, "%d AP On:%s Tmot:%03d", numap, modes, timeout / 1000);
	printf_xy(0, 1, "OPN:%03d WEP:%03d WPA:%03d idx:%03d", num[OPN],
		  num[WEP], num[WPA], index);
	print_xy(0, 2, SCREEN_SEP);

	memset(cur_entries, 0, sizeof(cur_entries));

	if (flags & DISP_OPN)
		index = display_type(OPN, index, "OPN");

	if (flags & DISP_WEP)
		index = display_type(WEP, index, "WEP");

	if (flags & DISP_WPA)
		display_type(WPA, index, "WPA");

	return;
}
Пример #4
0
void
print_path(char *path, int linha)
{
	linha--;
	print_atributo(linha, linha + 1, 0, 80, 0, 1);
	print_xy(1, linha, path);
}
Пример #5
0
void
print_linha(PNO H, int linha)
{
	print_xy(1, linha, H->box.nome);
	print_xy(16, linha, "00/00/");
	print_xy_int(16, linha, H->box.data.data.d);
	print_xy_int(19, linha, H->box.data.data.m);
	print_xy_int(22, linha, H->box.data.data.a + 1980);
	print_xy(29, linha, "00:00:00");
	print_xy_int(29, linha, H->box.hora.hora.h);
	print_xy_int(32, linha, H->box.hora.hora.m);
	print_xy_int(35, linha, H->box.hora.hora.s * 2);
	gotoxy(40, linha + 1);
	printf("%u", H->box.tamanho);
	if (is_dir(H->box.atributo))
		print_xy(51, linha, "<dir>");
	print_xy_int(59, linha, H->box.atributo);
}
Пример #6
0
void
info(int c)
{
	int linha, coluna, comprimento;
	float f;
	char s[20];
	if ((c >= 1) && (c <= 5)) {
		switch (c) {
		case 1:{
				strcpy(s, "[tamanho do disco]");
				f = irq_tam_drive(3);
			};
			break;
		case 2:{
				strcpy(s, "[espaco livre]");
				f = irq_espaco_livre(3);
			}
			break;
		case 3:{
				strcpy(s, "[memoria total]");
				f = irq_mem_total(3);
			};
			break;
		case 4:
			strcpy(s, "[memoria utilizada]");
			break;
		case 5:
			strcpy(s, "[memoria livre]");
			break;
		}
		linha = random(7) + 10;
		comprimento = strlen(s) + 2;
		coluna = random(80) - 2 + comprimento;
		print_seila(linha, linha + 5, coluna, coluna + comprimento,
					config.menu_inativo.full, 1);
		print_xy(coluna + 2, linha + 1, "InFoRmAcAo:");
		print_xy(coluna + 2, linha + 2, s);
		print_xy_f(coluna + 2, linha + 3, f);
		c = getch();
		if (c == 0)
			c = getch();
	}
}
Пример #7
0
void
desenha_caixa(STRING * s, int n, int ini, int fim, int c_ini, int c_fim)
{
	int i = 0;
	char aux[50];
	print_seila(ini, fim + 1, c_ini, c_fim, config.menu_inativo.full, 1);
	ini++;
	c_ini++;
	c_ini++;
	for (i = 0; i < n; i++, ini++)
		print_xy(c_ini, ini, s[i]);
}
Пример #8
0
void
print_menu(int ini)
{
	int aux;
	ini--;
	ini--;
	ini--;
	print_seila(ini, ini + 1, 0, 80, config.menu_inativo.full, 1);
	print_xy(1, ini, "[CoNfIgUrAcOeS]  [InFoRmAcOeS]  [SaIr]");
	aux = aux = (config.inativo.half.letra | config.menu_inativo.full);
	print_seila(ini, ini + 1, 1, 2, aux, 0);
	print_seila(ini, ini + 1, 18, 19, aux, 0);
	print_seila(ini, ini + 1, 33, 34, aux, 0);
}
Пример #9
0
} void

print_rodape(int fim)
{
	int aux = 0;
	print_seila(fim, fim + 1, 0, 80, config.menu_inativo.full, 1);
	print_xy(1, fim,
			 "  <PageUp>[subir pagina] <PageDown>[descer pagina] <Up|Down>[rolar] <Enter>[chdir]");
	aux = (config.inativo.half.letra | config.menu_inativo.full);
	print_seila(fim, fim + 1, 2, 10, aux, 0);
	print_seila(fim, fim + 1, 25, 35, aux, 0);
	print_seila(fim, fim + 1, 51, 56, aux, 0);
	print_seila(fim, fim + 1, 64, 71, aux, 0);
}
Пример #10
0
/* Print "entry" on line "line" */
void display_entry(int line, struct AP_HT_Entry *entry, char *mode)
{

	if (line < DISPLAY_LINES)
		cur_entries[line] = entry;

	printf_xy(0, line * 3, "%s", entry->ap->ssid);
	printf_xy(0, line * 3 + 1,
		  "%02X%02X%02X%02X%02X%02X %s c%02d %3dp %ds",
		  entry->ap->macaddr[0], entry->ap->macaddr[1],
		  entry->ap->macaddr[2], entry->ap->macaddr[3],
		  entry->ap->macaddr[4], entry->ap->macaddr[5], mode,
		  entry->ap->channel, (entry->ap->rssi * 100) / 0xD0,
		  (curtick - entry->tick) / 1000);
	print_xy(0, line * 3 + 2, SCREEN_SEP);
}