Skip to content

Commit 18f8ce3

Browse files
author
root
committed
[Client]환경설정 화면 전체 구현 완료(재시작 제외)
1 parent 0af943a commit 18f8ce3

File tree

5 files changed

+491
-437
lines changed

5 files changed

+491
-437
lines changed

src/glade/bxr_plover

120 Bytes
Binary file not shown.

src/glade/main.c

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
#define ERASER_SIZE 512 //1k
1111
#define ERASER_ENC_SIZE 896 //1k
1212

13-
static gchar *path; // 검사 파일경로 //
14-
static gchar *name; // 등록 유저이름 //
15-
static gchar *job; // 등록 직급이름 //
16-
static gchar *vs_dept; // 등록 부서이름 //
13+
static gchar *dpath; // default 경로 //
14+
static gchar *path; // 검사 파일경로 //
15+
static gchar *name; // 등록 유저이름 //
16+
static gchar *job; // 등록 직급이름 //
17+
static gchar *vs_dept; // 등록 부서이름 //
1718

1819
static int chk_fcnt = -1; // 파일개수 cnt //
1920
static char chk_fname[100]; // 정규식돌고있는 파일이름 //
@@ -53,17 +54,10 @@ GtkWidget *filechooserdialog;
5354
GtkBuilder *builder;
5455

5556

56-
char *b64_encode (const unsigned char *src, size_t len, char *enc);
57-
5857
// enrollment_window //
5958
void e_enroll_btn_clicked (GtkButton *e_enroll_btn, gpointer *data);
6059
void e_department_btn_clicked (GtkButton *e_department_btn, gpointer *data);
6160
void e_jobtitle_cbxtext_changed (GtkWidget *e_jobtitle_cbxtext, gpointer *data);
62-
void dept_ok_btn_clicked_w (GtkButton *dept_ok_btn, gpointer *data);
63-
void dept_ok_btn_clicked_e (GtkButton *dept_ok_btn, gpointer *data);
64-
65-
void dept_close_btn_clicked (GtkButton *dept_close_btn, gpointer *data);
66-
6761
void e_name_entry_activate (GtkEntry *e_name_entry, gpointer *data);
6862

6963
static GtkTreeModel *e_create_and_fill_model (void);
@@ -74,6 +68,10 @@ gboolean e_view_selection_func (GtkTreeSelection *selection,
7468
GtkTreePath *path,
7569
gboolean path_currently_selected,
7670
gpointer userdata);
71+
72+
void dept_ok_btn_clicked_w (GtkButton *dept_ok_btn, gpointer *data);
73+
void dept_ok_btn_clicked_e (GtkButton *dept_ok_btn, gpointer *data);
74+
void dept_close_btn_clicked (GtkButton *dept_close_btn, gpointer *data);
7775
/* end of enrollment_window */
7876

7977
// main_window //
@@ -181,7 +179,7 @@ int func_Uuid()
181179
}
182180
// end of func_Uuid()(); //
183181

184-
//Compile the regular expression described by "regex_text" into "r"//
182+
// 정규식 컴파일 //
185183
int compile_regex (regex_t *r, const char *regex_text)
186184
{
187185
int status = regcomp(r, regex_text, REG_EXTENDED|REG_NEWLINE);
@@ -201,8 +199,6 @@ int compile_regex (regex_t *r, const char *regex_text)
201199
}
202200
/* end of compile_regex(); */
203201

204-
205-
//Match the string in "to_match" against the compiled regular expression in "r"//
206202
// 주민등록번호, 외국인등록번호 정규식 #jfr //
207203
char match_regex_jnfg (regex_t *r, const char *to_match, char *filepath, struct dirent *file, struct stat buf)
208204
{
@@ -331,12 +327,10 @@ char match_regex_jnfg (regex_t *r, const char *to_match, char *filepath, struct
331327
// 운전면허 정규식 #dr //
332328
char match_regex_d (regex_t *r, const char *to_match, char *filepath, struct dirent *file, struct stat buf)
333329
{
334-
/* "P" is a pointer into the string which points to the end of the
335-
previous match. */
336330
const char *p = to_match;
337-
/* "N_matches" is the maximum number of matches allowed. */
331+
338332
const int n_matches = 100;
339-
/* "M" contains the matches found. */
333+
340334
regmatch_t m[n_matches];
341335

342336
//버퍼크기만큼 읽은 부분 전체를 해당 정규식과 비교//
@@ -392,16 +386,13 @@ char match_regex_d (regex_t *r, const char *to_match, char *filepath, struct dir
392386
}
393387
/* end of match_regex_d(); */
394388

395-
396389
// 여권번호 정규식 #pr //
397390
char match_regex_p (regex_t *r, const char *to_match, char *filepath, struct dirent *file, struct stat buf)
398391
{
399-
/* "P" is a pointer into the string which points to the end of the
400-
previous match. */
401392
const char *p = to_match;
402-
/* "N_matches" is the maximum number of matches allowed. */
393+
403394
const int n_matches = 100;
404-
/* "M" contains the matches found. */
395+
405396
regmatch_t m[n_matches];
406397

407398
// 버퍼크기만큼 읽은 부분 전체를 해당 정규식과 비교 //
@@ -570,9 +561,13 @@ int func_Detect (gchar *path)
570561
}
571562
/* end of func_Detect(); */
572563

564+
// RabbitMQ 소켓, 채널 열기 //
573565
int func_SetRabbit()
574566
{
575-
port = atoi(PORT);
567+
port = PORT;
568+
vhost = VHOST;
569+
username = USERNAME;
570+
password = PASSWORD;
576571

577572
/*
578573
establish a channel that is used to connect RabbitMQ server
@@ -594,7 +589,9 @@ int func_SetRabbit()
594589
die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN,
595590
"guest", "guest"),
596591
"Logging in");
597-
592+
/*die_on_amqp_error(amqp_login(conn, vhost, 200, 131072, 0, AMQP_SASL_METHOD_PLAIN,
593+
username, password),
594+
"Logging in");*/
598595

599596
amqp_channel_open(conn, 1);
600597
die_on_amqp_error(amqp_get_rpc_reply(conn), "Opening channel");
@@ -605,18 +602,17 @@ int func_SetRabbit()
605602
{
606603
amqp_queue_declare_ok_t *r = amqp_queue_declare(
607604
conn, 1, amqp_empty_bytes, 0, 0, 0, 1, amqp_empty_table);
608-
609-
605+
610606
die_on_amqp_error(amqp_get_rpc_reply(conn), "Declaring queue");
611607

612-
613608
reply_to_queue = amqp_bytes_malloc_dup(r->queue);
614609
if (reply_to_queue.bytes == NULL)
615610
{
616611
fprintf(stderr, "Out of memory while copying queue name");
617612
return 1;
618613
}
619614
}
615+
620616
return 0;
621617
}
622618

@@ -627,7 +623,7 @@ int func_Send()
627623
char message[1024];
628624
gdouble percent = 0.0;
629625
size_t in_len = 0;
630-
routingkey = "ka"; // TRCODE //
626+
//routingkey = "ka"; // TRCODE //
631627

632628
/*
633629
send the message
@@ -658,6 +654,8 @@ int func_Send()
658654
{
659655
case 0: // 버전 확인 //
660656
printf("##### 버전 확인 #####\n");
657+
//routingkey = "BPVCHK0R"; // TRCODE //
658+
routingkey = "ka";
661659
enc = "Version Check";
662660
die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes(EXCHANGE),
663661
amqp_cstring_bytes(routingkey), 0, 0,
@@ -666,6 +664,7 @@ int func_Send()
666664

667665
case 1: // 사용자 확인 //
668666
printf("##### 사용자 확인 #####\n");
667+
routingkey = "ka"; // TRCODE //
669668
enc = "User Check";
670669
die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes(EXCHANGE),
671670
amqp_cstring_bytes(routingkey), 0, 0,
@@ -674,6 +673,8 @@ int func_Send()
674673

675674
case 2: // 사용자 등록 //
676675
printf("##### 사용자 등록 #####\n");
676+
//routingkey = "BPDEPT0R"; // TRCODE //
677+
routingkey = "ka";
677678
in_len = sizeof(uDs);
678679
enc = b64_encode((unsigned char *)&uDs, in_len, enc);
679680
printf("[enc_data: %s]\n", enc);
@@ -686,6 +687,7 @@ int func_Send()
686687

687688
case 3: // 검출 결과 //
688689
printf("##### 검출 결과 #####\n");
690+
routingkey = "ka"; // TRCODE //
689691
memset(message, 0x00, strlen(message));
690692

691693
for(int i = 0; i <= chk_fcnt; i++)
@@ -1517,18 +1519,15 @@ void e_enroll_btn_clicked (GtkButton *e_enroll_btn, gpointer *data)
15171519

15181520
return;
15191521
}
1520-
1521-
15221522
/* end of enrollment_window */
15231523

15241524

1525-
15261525
// setting_window function #sf //
15271526
void s_ip_entry_activate (GtkEntry *s_ip_entry, gpointer *data)
15281527
{
15291528
char *hostname;
15301529
hostname = (gchar *)gtk_entry_get_text(s_ip_entry);
1531-
g_print("선택한 폴더 위치: %s\n", hostname);
1530+
g_print("HOST NAME: %s\n", hostname);
15321531

15331532
return;
15341533
}
@@ -1537,15 +1536,15 @@ void s_port_entry_activate (GtkEntry *s_port_entry, gpointer *data)
15371536
{
15381537
char *port;
15391538
port = (gchar *)gtk_entry_get_text(s_port_entry);
1540-
g_print("선택한 폴더 위치: %s\n", port);
1539+
g_print("PORT: %s\n", port);
15411540

15421541
return;
15431542
}
15441543

15451544
void s_detect_entry_activate (GtkEntry *s_detect_entry, gpointer *data)
15461545
{
15471546
path = (gchar *)gtk_entry_get_text(s_detect_entry);
1548-
g_print("선택한 폴더 위치: %s\n", path);
1547+
g_print("선택한 디폴트 폴더 위치: %s\n", dpath);
15491548

15501549
return;
15511550
}
@@ -1563,24 +1562,29 @@ void s_folder_btn_clicked (GtkButton *s_folder_btn, gpointer *data)
15631562
{
15641563
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooserdialog));
15651564
}
1566-
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooserdialog));
1565+
dpath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooserdialog));
15671566

1568-
gtk_entry_set_text(GTK_ENTRY (data), path);
1567+
gtk_entry_set_text(GTK_ENTRY (data), dpath);
15691568

15701569

15711570
gtk_widget_destroy(filechooserdialog);
15721571

1573-
g_print("선택한 폴더 위치: %s\n", path);
1572+
g_print("선택한 디폴트 폴더 위치: %s\n", dpath);
15741573

15751574
return;
15761575
}
1577-
void s_usrchg_btn_clicked (GtkButton *s_usrchg_btn, gpointer *data);
1576+
1577+
void s_usrchg_btn_clicked (GtkButton *s_usrchg_btn, gpointer *data)
1578+
{
1579+
gtk_widget_show(enrollment_window);
1580+
return;
1581+
}
15781582

15791583

15801584
void s_ok_btn_clicked (GtkButton *s_ok_btn, gpointer *data)
15811585
{
1582-
gtk_widget_show(main_window);
1583-
1586+
gtk_widget_hide(GTK_WIDGET(data));
1587+
15841588
return;
15851589
}
15861590

0 commit comments

Comments
 (0)