This program is to act like a server for Autograph Book. More...
#include <gtk/gtk.h>#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <sys/socket.h>#include <sys/types.h>#include <netinet/in.h>#include <time.h>#include <signal.h>#include <poll.h>#include <pthread.h>#include <mysql/mysql.h>Go to the source code of this file.
Defines | |
| #define | BUFFER_SIZE 4096 |
| #define | SERVER_PORT 1300 |
| #define | NUM_CLIENTS 1000 |
| #define | LEN 1000 |
Functions | |
| void | close_properly (int signal) |
| to close the signal | |
| void * | display (void *arg) |
| This function is used to receive the client data which is passed from the client and call the appropriate functions to store the data in the database. | |
| int | main (int argc, char *argv[]) |
| Used to create a tcp server. | |
| void | signup_program (char *name, char *contact, char *birth, char *address, char *hobbies, char *email, char *user_name, char *pass, char *conpass, int client) |
| Used to create a new user with details mentined below. | |
| void | signin_program (char *user_name, char *pass, int client) |
| Used to check the user id in the exiting database. | |
| submit_program (char *uname, char *user_name, char *name, char *contact, char *birth, char *address, char *hobbies, char *email, int client) | |
| Used to add the details of the friends to the user. | |
| users_program (int client) | |
| Used to get the user names from the database. | |
| user_fnds_program (char *user_name, int client) | |
| Used to Get the friend details of the selected user. | |
| add_program (char *oud, char *uname, int client) | |
| Used to add the others user details. | |
| fnds_program (char *uname, int client) | |
| Used to get the friends usernames. | |
| update_program (char *uname, char *user_name, char *name, char *contact, char *birth, char *address, char *hobbies, char *email, int client) | |
| Used to update the details of the friends to the user. | |
| delete_program (char *uname, char *user_name, int client) | |
| Used to delete the friends details. | |
| search_program (char *uname, char *user_name, int client) | |
| Used to get the friend details. | |
Variables | |
| char | to_client [2] |
| int | NUM_QS |
| int | TOTAL_QS |
| int | LISTEN_PORT |
| int | listen_file_descriptor |
| int | connection_file_descriptor [NUM_CLIENTS] |
| char | combine [1000] |
| MYSQL_ROW | sqlrow |
| MYSQL_ROW | temp |
| MYSQL_RES * | result1 |
| int | ucount |
| int | fcount |
| int | scount |
| int | pucount |
| int | pfcount |
| int | pscount |
| char | name [1000] |
| char | cn [1000] |
| char | dob [100] |
| char | addr [1000] |
| char | hob [1000] |
| char | email [100] |
| char | uname [1000] |
| char | pass1 [20] |
| char | pass2 [20] |
| char | nemail [100] |
| char | pass [20] |
| char | nuname [1000] |
| char | username [1000] |
| char | back [10][1000] |
| GtkWidget * | ntext |
| GtkWidget * | nlabel |
| GtkWidget * | nlabel_search |
| GtkWidget * | nlabel_user |
| GtkWidget * | nlabel_details |
| GtkWidget * | ncombo_user |
| GtkWidget * | ncombo_details |
| GtkWidget * | ncombo_search |
| GtkWidget * | NAME |
| GtkWidget * | CN |
| GtkWidget * | DOB |
| GtkWidget * | ADDR |
| GtkWidget * | HOB |
| GtkWidget * | |
| GtkWidget * | UNAME |
| GtkWidget * | PASS |
| GtkWidget * | NUNAME |
| GtkWidget * | PASS1 |
| GtkWidget * | PASS2 |
| GtkWidget * | NEMAIL |
| GtkWidget * | USERNAME |
| GtkWidget * | dialog |
| GtkWidget * | window2 |
| GtkWidget * | button2 |
| GtkWidget * | filew |
| GtkWidget * | image |
| GtkWidget * | combo_user |
| GtkWidget * | combo_details |
| GtkWidget * | combo_search |
| char | ch |
| int | mainscreen |
| int | enterdetails |
| int | argc1 |
| char * | argv1 [] |
| int | success = 0 |
| char | exe [1000] |
| char | sea [1000] |
| char | ou [1000] |
| char | oud [1000] |
This program is to act like a server for Autograph Book.
Definition in file server.c.
| add_program | ( | char * | oud, | |
| char * | uname, | |||
| int | client | |||
| ) |
Used to add the others user details.
| oud | used to store user id | |
| uname | used store the login name | |
| client | used to recognise client number |
Definition at line 745 of file server.c.
References connection_file_descriptor, email, hob, name, result1, sqlrow, and to_client.
Referenced by display().
| void close_properly | ( | int | signal | ) |
to close the signal
Definition at line 62 of file server.c.
References listen_file_descriptor.
Referenced by main().
| delete_program | ( | char * | uname, | |
| char * | user_name, | |||
| int | client | |||
| ) |
Used to delete the friends details.
| uname | used store user name | |
| user_name | used store the friend user name | |
| client | used to recognise client number |
Definition at line 1012 of file server.c.
References connection_file_descriptor, result1, and to_client.
Referenced by display().
| void* display | ( | void * | arg | ) |
This function is used to receive the client data which is passed from the client and call the appropriate functions to store the data in the database.
| arg | pass the client number |
Definition at line 82 of file server.c.
References add_program(), BUFFER_SIZE, connection_file_descriptor, delete_program(), email, fnds_program(), LEN, name, search_program(), signin_program(), signup_program(), submit_program(), update_program(), user_fnds_program(), username, and users_program().
Referenced by main().
| fnds_program | ( | char * | uname, | |
| int | client | |||
| ) |
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Used to create a tcp server.
This is an iterative server and hence responds to clients.
| argc | number of command line arguments passed to the program including program name itself. | |
| argv | array of command line arguments. |
Definition at line 199 of file server.c.
References close_properly(), connection_file_descriptor, display(), LEN, listen_file_descriptor, LISTEN_PORT, NUM_CLIENTS, and SERVER_PORT.
| search_program | ( | char * | uname, | |
| char * | user_name, | |||
| int | client | |||
| ) |
Used to get the friend details.
| uname | used store user name | |
| user_name | used store the friend user name | |
| client | used to recognise client number |
Definition at line 1094 of file server.c.
References combine, connection_file_descriptor, result1, sqlrow, and to_client.
Referenced by display().
| void signin_program | ( | char * | user_name, | |
| char * | pass, | |||
| int | client | |||
| ) |
Used to check the user id in the exiting database.
| user_name | used to create user_name of new user | |
| pass | used to store password of new user | |
| client | used to recognise client number of new user |
Definition at line 403 of file server.c.
References connection_file_descriptor, mainscreen, result1, sqlrow, temp, and to_client.
Referenced by display().
| void signup_program | ( | char * | name, | |
| char * | contact, | |||
| char * | birth, | |||
| char * | address, | |||
| char * | hobbies, | |||
| char * | email, | |||
| char * | user_name, | |||
| char * | pass, | |||
| char * | conpass, | |||
| int | client | |||
| ) |
Used to create a new user with details mentined below.
| name | used to store the name of the new user | |
| contact | used to store contact number of new user | |
| birth | used to store dateofbirth of new user | |
| hobbies | used to store hobbies of new user | |
| used to store email id of new user | ||
| user_name | used to create user_name of new user | |
| pass | used to store password of new user | |
| conpass | used to store conform password of new user | |
| client | used to recognise client number of new user |
Definition at line 296 of file server.c.
References connection_file_descriptor, result1, sqlrow, and to_client.
Referenced by display().
| submit_program | ( | char * | uname, | |
| char * | user_name, | |||
| char * | name, | |||
| char * | contact, | |||
| char * | birth, | |||
| char * | address, | |||
| char * | hobbies, | |||
| char * | email, | |||
| int | client | |||
| ) |
Used to add the details of the friends to the user.
| name | used to store the name of the new user | |
| contact | used to store contact number of new user | |
| birth | used to store dateofbirth of new user | |
| hobbies | used to store hobbies of new user | |
| used to store email id of new user | ||
| user_name | used to create user_name of new user | |
| pass | used to store password of new user | |
| conpass | used to store conform password of new user | |
| client | used to recognise client number of new user |
Definition at line 501 of file server.c.
References connection_file_descriptor, exe, and to_client.
Referenced by display().
| update_program | ( | char * | uname, | |
| char * | user_name, | |||
| char * | name, | |||
| char * | contact, | |||
| char * | birth, | |||
| char * | address, | |||
| char * | hobbies, | |||
| char * | email, | |||
| int | client | |||
| ) |
Used to update the details of the friends to the user.
| uname | used to store the user name | |
| name | used to store the name of the updated user | |
| contact | used to store contact number of updated user | |
| birth | used to store dateofbirth of updated user | |
| hobbies | used to store hobbies of updated user | |
| used to store email id of updated user | ||
| user_name | used to create user_name of updated user | |
| pass | used to store password of updated user | |
| conpass | used to store conform password of updated user | |
| client | used to recognise client number of updated user |
Definition at line 938 of file server.c.
References connection_file_descriptor, result1, and to_client.
Referenced by display().
| user_fnds_program | ( | char * | user_name, | |
| int | client | |||
| ) |
Used to Get the friend details of the selected user.
| user_name | to pass the user name | |
| client | used to recognise client number |
Definition at line 643 of file server.c.
References combine, connection_file_descriptor, dialog, fcount, pfcount, and sqlrow.
| users_program | ( | int | client | ) |
| GtkWidget * combo_details |
| GtkWidget * combo_search |
| GtkWidget* combo_user |
| int connection_file_descriptor[NUM_CLIENTS] |
Definition at line 36 of file server.c.
Referenced by add_program(), delete_program(), display(), fnds_program(), main(), search_program(), signin_program(), signup_program(), submit_program(), update_program(), user_fnds_program(), and users_program().
| int enterdetails |
Definition at line 35 of file server.c.
Referenced by close_properly(), and main().
| int LISTEN_PORT |
| int mainscreen |
| GtkWidget * ncombo_details |
| GtkWidget * ncombo_search |
| GtkWidget* ncombo_user |
| GtkWidget * nlabel_details |
| GtkWidget * nlabel_search |
| GtkWidget * nlabel_user |
| MYSQL_RES* result1 |
Definition at line 39 of file server.c.
Referenced by add_program(), delete_program(), search_program(), signin_program(), signup_program(), and update_program().
| char to_client[2] |
Definition at line 29 of file server.c.
Referenced by add_program(), delete_program(), search_program(), signin_program(), signup_program(), submit_program(), and update_program().
1.6.1