Free Network Firewall Computer Graphics Project Using OpenGL Report
Free Network Firewall Computer Graphics Project Using OpenGL Report
Contents
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.
We have used font family for indicating the name of objects as we can
see in this project.
System specifications
SOFTWARE REQUIREMENTS :
MICROSOFT VISUAL C++
OPENGL
OPERATING SYSTEM :
WINDOWS XP,VISTA
HARDWARE REQUIREMENT :
GRAPHICS SYSTEM,
Pentium P4 with 256 of Ram(Min)
Introduction to openGL
OpenGL Fundamentals
This section explains some of the concepts inherent in OpenGL.
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.
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
Implementation
shown below.
glutCreateWindow() : this opens the OPENGL window and displays the title
at top of the window
.Both mouse and keyboard are used to interact with the program.
Source Code
#include <windows.h>
#include<string.h>
#include<stdarg.h>
#include<stdio.h>
//#include<math.h>
#include <glut.h>
// p[8] is used to generate 8 different packets, 4 for each user. usind the keys 1-8
//the order is for "user 1" u[0-3]={http,telnet,ssh,smtp} & for "user 2" u[0-
3]={http,telnet,ssh,smtp}
//t1=false,sh1=false,sm1=false;
void *font;
void *currentfont;
currentfont=font;
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
va_list args;
va_start(args, format);
va_end(args);
glPushMatrix();
glTranslatef(-2.5, y, 0);
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();
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);
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){
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();
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);
if(z<=10){
z+=0.1;
glTranslatef(-2,-2,5-z);
plane();
// http packet
//towards port 80
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
{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
//towards port 23
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
{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
//towards port 23
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
{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
//towards port 23
x+=0.0081;
y+=0.01;
z+=0.005;
glTranslatef(-2+x,-2+y,5-z);
plane();
}else if
//Allow or Block
{ 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
Conclusions
This program illustrates the concept of network firewall using various functions.
Bibliography
TEXT BOOKS :
INTERACTIVE COMPUTER GRAPHICS A TOP-DOWN APPROACH
-By Edward Angel.
- Feiner hughes
WEB REFERENCES:
http://jerome.jouvie.free.fr/OpenGl/Lessons/Lesson3.php
http://google.com
http://opengl.org