Network Firewall
Contents
SL.NO particulars PAGE.NO
1 Abstract 2
2 System Specifications 3
3 Introduction to openGL 4
5 Implementation 7
6 Interaction 9
7 Source Code 10
8 Output 29
9 Conclusion 31
10 Bibliography 32
1 Dept. of Computer Science & Engineering.
Network Firewall
Abstract
Main aim of this Mini Project is to illustrate the concepts and usage of
Fire Wall in OpenGL.
A firewall can either be software-based or hardware-based and is
used to help keep a network secure.
Its primary objective is to control the incoming and outgoing
network traffic by analyzing the data packets and determining
whether it should be allowed through or not, based on a
predetermined rule set.
A network's firewall builds a bridge between the internal network or
computer it protects, upon securing that the other network is secure
and trusted, usually an external (inter)network
We have used input devices like mouse and key board to interact with
program.
We have also used SolidCube for forming a complete network setup
which help to understand concept of Congestion Control very well.
To differentiate between objects we have used different colors for
different objects.
We have added menu which makes the program more interactive.
In this project we have used a small SolidCube to represent a data,
which travels as data transfer from source to destination.
We have used font family for indicating the name of objects as we can
see in this project.
2 Dept. of Computer Science & Engineering.
Network Firewall
System specifications
SOFTWARE REQUIREMENTS :
MICROSOFT VISUAL C++
OPENGL
OPERATING SYSTEM :
WINDOWS XP,VISTA
HARDWARE REQUIREMENT :
GRAPHICS SYSTEM,
Pentium P4 with 256 of Ram(Min)
3 Dept. of Computer Science & Engineering.
Network Firewall
Introduction to openGL
As a software interface for graphics hardware, OpenGL's main purpose is to
render two- and three-dimensional objects into a frame buffer.
These objects are described as sequences of vertices or pixels.
OpenGL performs several processing steps on this data to convert it to pixels to
form the final desired image in the frame buffer.
OpenGL Fundamentals
This section explains some of the concepts inherent in OpenGL.
Primitives and Commands
OpenGL draws primitives—points, line segments, or polygons—subject to several
selectable modes.
You can control modes independently of each other; that is, setting one mode
doesn't affect whether other modes are set .Primitives are specified, modes are
set, and other OpenGL operations are described by issuing commands in the form
of function calls.
Primitives are defined by a group of one or more vertices. A vertex defines a
point, an endpoint of a line, or a corner of a polygon where two edges meet. Data
is associated with a vertex, and each vertex and its associated data are processed
independently, in order, and in the same way. The type of clipping depends on
which primitive the group of vertices represents.
4 Dept. of Computer Science & Engineering.
Network Firewall
Commands are always processed in the order in which they are received,
although there may be an indeterminate delay before a command takes effect.
This means that each primitive is drawn completely before any subsequent
command takes effect. It also means that state-querying commands return data
that's consistent with complete execution of all previously issued OpenGL
commands.
Basic OpenGL Operation
The figure shown below gives an abstract, high-level block diagram of how
OpenGL processes data. In the diagram, commands enter from the left and
proceed through what can be thought of as a processing pipeline. Some
commands specify geometric objects to be drawn, and others control how the
objects are handled during the various processing stages.
Figure . OpenGL Block Diagram
As shown by the first block in the diagram, rather than having all commands
proceed immediately through the pipeline, you can choose to accumulate some
of them in a display list for processing at a later time.
5 Dept. of Computer Science & Engineering.
Network Firewall
Rasterization produces a series of frame buffer addresses and associated values
using a two-dimensional description of a point, line segment, or polygon.
Each fragment so produced is fed into the last stage,
per-fragment operations, which performs the final operations on the data before
it's stored as pixels in the frame buffer. These operations include conditional
updates to the frame buffer based on incoming and previously stored z-value s
(for z-buffering) and blending of incoming pixel colors with stored colors, as well
as masking and other logical operations on pixel values.
All elements of OpenGL state, including the contents of the texture memory and
even of the frame buffer, can be obtained by an OpenGL application.
6 Dept. of Computer Science & Engineering.
Network Firewall
Implementation
This program is implemented using various openGL functions which are
shown below.
Various functions used in this program.
glutInit() : interaction between the windowing system and OPENGL is
initiated
glutInitDisplayMode() : used when double buffering is required and depth
information is required
glutCreateWindow() : this opens the OPENGL window and displays the title
at top of the window
glutInitWindowSize() : specifies the size of the window
glutInitWindowPosition() : specifies the position of the window in screen
co-ordinates
7 Dept. of Computer Science & Engineering.
Network Firewall
glutKeyboardFunc() : handles normal ascii symbols
glutSpecialFunc() : handles special keyboard keys
glutReshapeFunc() : sets up the callback function for reshaping the window
glutIdleFunc() : this handles the processing of the background
glutDisplayFunc() : this handles redrawing of the window
glutMainLoop() : this starts the main loop, it never returns
glViewport() : used to set up the viewport
glVertex3fv() : used to set up the points or vertices in three dimensions
glColor3fv() : used to render color to faces
glFlush() : used to flush the pipeline
glutPostRedisplay() : used to trigger an automatic redrawal of the object
glMatrixMode() : used to set up the required mode of the matrix
glLoadIdentity() : used to load or initialize to the identity matrix
8 Dept. of Computer Science & Engineering.
Network Firewall
glTranslatef() : used to translate or move the rotation centre from one
point to another in three dimensions
glRotatef() : used to rotate an object through a specified rotation angle
Interaction with program
.Both mouse and keyboard are used to interact with the program.
S key to Start the project.
Right mouse button can be used to get a menu.
9 Dept. of Computer Science & Engineering.
Network Firewall
Source Code
#include <windows.h>
#include<string.h>
#include<stdarg.h>
#include<stdio.h>
//#include<math.h>
#include <glut.h>
// co ordinates of eight packets
static double x=0,y=0,z=0,i1=0;
// p[8] is used to generate 8 different packets, 4 for each user. usind the keys 1-8
10 Dept. of Computer Science & Engineering.
Network Firewall
// u[8] is used to Allow or deny packets using menu,
//the order is for "user 1" u[0-3]={http,telnet,ssh,smtp} & for "user 2" u[0-
3]={http,telnet,ssh,smtp}
static bool p[8]={false}, u[8]={false};
//t1=false,sh1=false,sm1=false;
//static bool tt2=false,h2=false,sh2=false,sm2=false;
void *font;
void *currentfont;
void setFont(void *font)
currentfont=font;
void drawstring(float x,float y,float z,char *string)
char *c;
11 Dept. of Computer Science & Engineering.
Network Firewall
glRasterPos3f(x,y,z);
for(c=string;*c!='\0';c++)
{ glColor3f(0.0,1.0,1.0);
glutBitmapCharacter(currentfont,*c);
void
stroke_output(GLfloat x, GLfloat y, char *format,...)
va_list args;
char buffer[200], *p;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
glPushMatrix();
glTranslatef(-2.5, y, 0);
glScaled(0.003, 0.005, 0.005);
12 Dept. of Computer Science & Engineering.
Network Firewall
for (p = buffer; *p; p++)
glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);
glPopMatrix();
void server()
glPushMatrix();
glScaled(0.8,2.0,0.8);
glTranslatef(-0.5,0,-15);
glColor3f(0,1.5,1.5);
glutSolidCube(1);
glPushMatrix();
glScaled(0.5,.1,1.0);
glTranslatef(.0,3.5,0.01);
glColor3f(0.3,0.3,0.3);
glutSolidCube(1.5);
glPopMatrix();
13 Dept. of Computer Science & Engineering.
Network Firewall
glPushMatrix();
glScaled(0.35,.05,1.0);
glTranslatef(0.0,1,0.1);
glColor3f(0,0,0.3);
glutSolidCube(1.1);
glPopMatrix();
glPushMatrix();
glScaled(2.2,.1,1.0);
glTranslatef(0,-1,0.3);
glColor3f(0,0,1.3);
glutSolidCube(0.5);
glPopMatrix();
glPushMatrix();
glScaled(2.2,.1,1.0);
glTranslatef(0,-2,0.3);
glColor3f(0,0,1.3);
glutSolidCube(0.5);
glPopMatrix();
14 Dept. of Computer Science & Engineering.
Network Firewall
glPushMatrix();
glScaled(2.2,.1,1.0);
glTranslatef(0,-3,0.3);
glColor3f(0,0,1.3);
glutSolidCube(0.5);
glPopMatrix();
glPopMatrix();
void plane()
glScaled(0.2,0.1,0.3);
if(p[0] || p[4])
glColor3f(1,1,0);
if(p[1] || p[5])
glColor3f(0,1,0);
15 Dept. of Computer Science & Engineering.
Network Firewall
if(p[2] || p[6])
glColor3f(1,0,0);
if(p[3] || p[7])
glColor3f(0,1,1);
glutSolidSphere(1.0,40,40);
glPushMatrix();
glColor3f(0,0,0);
glTranslatef(0,0,0);
glScaled(3,0.3,0.01);
glutSolidSphere(1.0,40,40);
glPopMatrix();
glPushMatrix();
glColor3f(0,0,0);
glTranslatef(0,2,0.8);
glScaled(0.2,3,0.01);
glutSolidSphere(1.0,40,40);
16 Dept. of Computer Science & Engineering.
Network Firewall
glPopMatrix();
void wall(){
glPushMatrix();
glTranslatef(-1.5,-0.05,-6);
glColor3f(1,1,1);
glScaled(4.7,3.05,0.2);
glutSolidCube(1);
glPopMatrix();
for(float y=-5;y<=5;y+=0.65){
for(float x=-5.3; x<=1;x+=0.57){
glPushMatrix();
glColor3f(0.4,0.4,0.4);
glScaled(.7,0.3,0.5);
glTranslatef(x,y,-12);
glutSolidCube(0.5);
17 Dept. of Computer Science & Engineering.
Network Firewall
glPopMatrix();
void user()
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0,1.2,1);
//glScaled(0.3,0.35,0.01);
glutSolidSphere(0.4,40,40);
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0,0,1);
glScaled(0.6,1.7,0.6);
glutSolidSphere(0.6,40,40);
glPopMatrix();
18 Dept. of Computer Science & Engineering.
Network Firewall
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0.35,-0.1,1);
glScaled(0.2,2,0.2);
glRotatef(90,1,0,0);
glutSolidTorus(0.2,0.4,40,40);
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(-0.3,-0.1,1.2);
glScaled(0.2,2,0.2);
glRotatef(90,1,0,0);
glutSolidTorus(0.2,0.4,40,40);
glPopMatrix();
//PC Computers
void pc()
19 Dept. of Computer Science & Engineering.
Network Firewall
glPushMatrix();
glTranslatef(0,0,3);
glScaled(.7,.7,0);
glColor3f(0,1,0);
glutSolidCube(1);
glPushMatrix();
glColor3f(1,0,0);
glTranslatef(0,-0.65,0);
glScaled(1.1,0.3,0);
glutSolidCube(1);
glPushMatrix();
glColor3f(1,1,0);
glTranslatef(0,0,0);
glScaled(0.6,0.15,0);
glutSolidCube(1);
glPopMatrix();
20 Dept. of Computer Science & Engineering.
Network Firewall
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0,0,3);
glScaled(.7,.7,0);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();
void port(float x1,float y1){
glPushMatrix();
glTranslatef(x1,y1,-5.85);
21 Dept. of Computer Science & Engineering.
Network Firewall
glScaled(0.4,0.45,0.01);
glutSolidSphere(1.0,40,40);
glPushMatrix();
glColor3f(0,0,0);
glTranslatef(0,0,1);
glScaled(1,1,0.01);
glutSolidSphere(0.8,40,40);
glPopMatrix();
glPopMatrix();
void packet(){
glPushMatrix();
glColor3f(1,0,1);
// Move packet to spring
22 Dept. of Computer Science & Engineering.
Network Firewall
if(z<=10){
z+=0.1;
glTranslatef(-2,-2,5-z);
plane();
// http packet
if(p[0] && z>=10 || p[4] && z>=10 ){
//towards port 80
if(z>=10 && y<=3)
x-=0.01;
y+=0.02;
z+=0.01;
glTranslatef(-2+x,-2+y,5-z);
plane();
//glutSolidCube(0.3);
23 Dept. of Computer Science & Engineering.
Network Firewall
}else if
//Allow or Block
(p[0] && u[0] || p[4] && u[4] )
{if(z<=17){
z+=0.1;
if(z>=17)
z=150;
}glTranslatef(-2+x,-2+y,5-z);
plane();
//glutSolidCube(0.3);
}else
i1+=0.1;
for(float x4=0;x4<=3;x4++)
{
24 Dept. of Computer Science & Engineering.
Network Firewall
glPushMatrix();
glScalef(0.3,0.3,0.3);
if(x4==0)
glTranslatef(-7.5+i1,12+i1,-5.85);
if(x4==1)
glTranslatef(-7.5-i1,12+i1,-5.85);
if(x4==2)
glTranslatef(-7.5+i1,12-i1,-5.85);
if(x4==3)
glTranslatef(-7.5-i1,12-i1,-5.85);
//plane();
glutSolidCube(0.3);
glPopMatrix();
}
25 Dept. of Computer Science & Engineering.
Network Firewall
// Telnet Packets
if(p[1] && z>=10 || p[5] && z>=10 ){
//towards port 23
if(z>=10 && y<=3)
x-=0.002;
y+=0.01;
z+=0.005;
glTranslatef(-2+x,-2+y,5-z);
plane();
//glutSolidCube(0.3);
}else if
//Allow or Block
(p[1] && u[1] || p[5] && u[5] )
{if(z<=17){
26 Dept. of Computer Science & Engineering.
Network Firewall
z+=0.1;
if(z>=17)
z=150;
}glTranslatef(-2+x,-2+y,5-z);
plane();
}else
i1+=0.1;
for(float x4=0;x4<=3;x4++)
glPushMatrix();
glScalef(0.3,0.3,0.3);
if(x4==0)
glTranslatef(-5.6+i1,12+i1,-5.85);
if(x4==1)
glTranslatef(-5.6+i1,12-i1,-5.85);
27 Dept. of Computer Science & Engineering.
Network Firewall
if(x4==2)
glTranslatef(-5.6-i1,12+i1,-5.85);
if(x4==3)
glTranslatef(-5.6-i1,12-i1,-5.85);
glutSolidCube(0.3);
glPopMatrix();
// SSH Packets
if(p[2] && z>=10 || p[6] && z>=10 ){
//towards port 23
if(z>=10 && y<=3)
x+=0.002;
28 Dept. of Computer Science & Engineering.
Network Firewall
y+=0.01;
z+=0.005;
glTranslatef(-1.8+x,-2+y,5-z);
plane();
}else if
//Allow or Block
(p[2] && u[2] || p[6] && u[6] )
{if(z<=17){
z+=0.1;
if(z>=17)
z=150;
}glTranslatef(-1.8+x,-2+y,5-z);
plane();
}else
{
29 Dept. of Computer Science & Engineering.
Network Firewall
i1+=0.1;
for(float x4=0;x4<=3;x4++)
glPushMatrix();
glScalef(0.3,0.3,0.3);
if(x4==0)
glTranslatef(-3.6+i1,12+i1,-5.85);
if(x4==1)
glTranslatef(-3.6+i1,12-i1,-5.85);
if(x4==2)
glTranslatef(-3.6-i1,12+i1,-5.85);
if(x4==3)
glTranslatef(-3.6-i1,12-i1,-5.85);
glutSolidCube(0.3);
glPopMatrix();
30 Dept. of Computer Science & Engineering.
Network Firewall
// SMTP Packets
if(p[3] && z>=10 || p[7] && z>=10 ){
//towards port 23
if(z>=10 && y<=2)
x+=0.0081;
y+=0.01;
z+=0.005;
glTranslatef(-2+x,-2+y,5-z);
plane();
}else if
//Allow or Block
(p[3] && u[3] || p[7] && u[7] )
31 Dept. of Computer Science & Engineering.
Network Firewall
{ if(z<=17){
z+=0.1;
if(z>=17)
z=150;
glTranslatef(-2+x,-2+y,5-z);
plane();
else
i1+=0.1;
for(float x4=0;x4<=3;x4++)
glPushMatrix();
glScalef(0.3,0.3,0.3);
if(x4==0)
32 Dept. of Computer Science & Engineering.
Network Firewall
glTranslatef(-1.5+i1,11+i1,-5.85);
if(x4==1)
glTranslatef(-1.5+i1,11-i1,-5.85);
if(x4==2)
glTranslatef(-1.5-i1,11+i1,-5.85);
if(x4==3)
glTranslatef(-1.5-i1,11-i1,-5.85);
glutSolidCube(0.3);
glPopMatrix();
glPopMatrix();
}
33 Dept. of Computer Science & Engineering.
Network Firewall
OUTPUT OF THE PROGRAM
34 Dept. of Computer Science & Engineering.
Network Firewall
35 Dept. of Computer Science & Engineering.
Network Firewall
Conclusions
The project “ Firewall” is based on concepts of Network Security.
This program illustrates the concept of network firewall using various functions.
Finally we conclude that this program clearly illustrate the functioning of a
Firewall in OpenGL and has been completed successfully and is ready to be
demonstrated.
36 Dept. of Computer Science & Engineering.
Network Firewall
Bibliography
WE HAVE OBTAINED INFORMATION FROM MANY RESOURCES TO DESIGN AND
IMPLEMENT OUR PROJECT SUCCESSIVELY. WE HAVE ACQUIRED MOST OF THE
KNOWLEDGE FROM RELATED WEBSITES. THE FOLLOWING ARE SOME OF THE
RESOURCES :
TEXT BOOKS :
INTERACTIVE COMPUTER GRAPHICS A TOP-DOWN APPROACH
-By Edward Angel.
COMPUTER GRAPHICS,PRINCIPLES & PRACTICES
- Foley van dam
- Feiner hughes
WEB REFERENCES:
http://jerome.jouvie.free.fr/OpenGl/Lessons/Lesson3.php
http://google.com
37 Dept. of Computer Science & Engineering.
Network Firewall
http://opengl.org
38 Dept. of Computer Science & Engineering.