This program is client program which when executed produce a login window then a product information window. More...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib.h>
Go to the source code of this file.
Functions | |
void | Write (int fd, char *buf, int count) |
It is used to write data to a particular socket file descriptor. | |
void | Read (int fd, char *buf, int count) |
It is used to read data from a particular socket file descriptor. | |
gint | destroyapp (GtkWidget *widget, gpointer gdata) |
It is called when user tries to close window using window manager. | |
void | clear () |
It sets all the text entries in product info window blank. | |
void | callback (GtkWidget *widget, gpointer data) |
It is called when user tries to enter or try to modify data using product information window. | |
void | action (GtkWidget *widget, gpointer data) |
This is where handles the action performed by the login window and the widgets in it. | |
int | login (int argc, char *argv[]) |
This is code which displays login. | |
void | interface () |
This is where program for interface to connect server. | |
int | main (int argc, char *argv[]) |
This is where program execution starts. | |
Variables | |
int | sockfd |
char | ch [1000] |
GtkWidget * | window |
GtkWidget * | entry1 |
GtkWidget * | entry2 |
GtkWidget * | entry3 |
GtkWidget * | entry4 |
GtkWidget * | entry5 |
GtkWidget * | combo |
GtkWidget * | combo2 |
GList * | glist = NULL |
GList * | glist2 = NULL |
char | list [4096] |
char | populate [1000][10] |
char | retrieval [1000] |
int | count |
GtkWidget * | e1 |
GtkWidget * | e2 |
GtkWidget * | l3 |
GtkWidget * | window1 |
This program is client program which when executed produce a login window then a product information window.
The administrator can insert,update,retrieve and delete information about product on the basis of ProductID. The program will use GtkWidget of GtkLabel and GtkWindow to show message to user. We will use sockets in this program to get data from the server.
Definition in file client.c.
void action | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
This is where handles the action performed by the login window and the widgets in it.
All other arguments are ignored.
argc | widget Widget which generated the event. | |
data | data any additional data passed while generating signal. |
Definition at line 300 of file client.c.
References e1, e2, and window1.
Referenced by login().
void callback | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
It is called when user tries to enter or try to modify data using product information window.
There should be some value in the combo box while retrieving the data if left empty then it will produce garbage value. Data retrieval can be done on the basis of CATEGORY and Porduct ID.
widget1 | Widget which generated the event. | |
data | any additional data passed while generating signal. |
Definition at line 111 of file client.c.
References ch, clear(), combo, combo2, count, destroyapp(), entry1, entry2, entry3, entry4, entry5, glist, l3, list, populate, Read(), retrieval, sockfd, window, and Write().
Referenced by interface().
void clear | ( | ) |
gint destroyapp | ( | GtkWidget * | widget, | |
gpointer | gdata | |||
) |
It is called when user tries to close window using window manager.
We will always disable closing of window using window manager.
widget1 | Widget which generated the event. | |
data | any additional data passed while generating signal. |
Definition at line 85 of file client.c.
Referenced by callback(), interface(), and login().
void interface | ( | ) |
This is where program for interface to connect server.
All other arguments are ignored. The most important thing is that the while entering into the text field no spaces should br given if required then _ , can be included. It uses tables,entries,combo box,labels and buttons. It is used to Insert,Update,Delete,Retrieve information. It displays the information in the entries on the basis of ID
Definition at line 404 of file client.c.
References callback(), combo, combo2, destroyapp(), entry1, entry2, entry3, entry4, entry5, glist2, and window.
Referenced by main().
int login | ( | int | argc, | |
char * | argv[] | |||
) |
This is code which displays login.
The login information is verified on client itself as there is only one user. All other arguments are ignored.
argc | Number of arguments passed. | |
argv | NULL terminated array of command line arguments. |
Definition at line 335 of file client.c.
References action(), destroyapp(), e1, e2, and window1.
Referenced by main().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
This is where program execution starts.
All arguments are passed to main for processing, which removes any arguments relevant to it. All other arguments are ignored.
argc | Number of arguments passed. | |
argv | NULL terminated array of command line arguments. |
Definition at line 515 of file client.c.
References ch, interface(), login(), and sockfd.
void Read | ( | int | fd, | |
char * | buf, | |||
int | count | |||
) |
It is used to read data from a particular socket file descriptor.
fd | the socket descriptor from where data is to be read. | |
buf | the characters which are to be read from socket fd. | |
count | the number of characters which is to be read |
Definition at line 66 of file client.c.
References ch.
Referenced by callback().
void Write | ( | int | fd, | |
char * | buf, | |||
int | count | |||
) |
It is used to write data to a particular socket file descriptor.
fd | the socket descriptor from where data is to be written. | |
buf | the characters which are to be written on socket fd. | |
count | the number of characters which is to be written |
Definition at line 48 of file client.c.
Referenced by callback().
GtkWidget* combo |
Definition at line 33 of file client.c.
Referenced by callback(), clear(), and interface().
GtkWidget* combo2 |
Definition at line 34 of file client.c.
Referenced by callback(), clear(), and interface().
int count |
Definition at line 41 of file client.c.
Referenced by callback(), main(), and print_all_records().
GtkWidget* entry1 |
Definition at line 28 of file client.c.
Referenced by callback(), clear(), and interface().
GtkWidget* entry2 |
Definition at line 29 of file client.c.
Referenced by callback(), clear(), and interface().
GtkWidget* entry3 |
Definition at line 30 of file client.c.
Referenced by callback(), clear(), and interface().
GtkWidget* entry4 |
Definition at line 31 of file client.c.
Referenced by callback(), clear(), and interface().
GtkWidget* entry5 |
Definition at line 32 of file client.c.
Referenced by callback(), clear(), and interface().
GList* glist = NULL |
Definition at line 35 of file client.c.
Referenced by callback().
GList* glist2 = NULL |
Definition at line 36 of file client.c.
Referenced by interface().
GtkWidget* l3 |
Definition at line 291 of file client.c.
Referenced by callback().
char list[4096] |
Definition at line 38 of file client.c.
Referenced by callback().
char populate[1000][10] |
Definition at line 39 of file client.c.
Referenced by callback().
char retrieval[1000] |
Definition at line 40 of file client.c.
Referenced by callback().
int sockfd |
Definition at line 24 of file client.c.
Referenced by callback(), and main().
GtkWidget* window |
Definition at line 27 of file client.c.
Referenced by callback(), and interface().