FrameIP.exe
par _SebF

6 - Code source de la version console
        6.1 - FrameIp.cpp
7 - Code source de la version graphique
        7.1 - FrameIp.h
        7.2 - FrameIp.cpp
        7.3 - FrameIpDlg.h
        7.4 - FrameIpDlg.cpp
        7.5 - class_ip_address.h
        7.6 - class_ip_address.cpp
        7.7 - resource.h

6 - Code source de la version console

6.1 - FrameIp.cpp

// ********************************************
// Nom : FrameIP.cpp
// Auteur : Sebastien.Fontaine@frameIP.com.pas.de.spam
// Date de création : 21 Décembre 2002
// version : 5.1.3.10
// Licence : Cette executable est libre de toute utilisation.
//           La seule condition existante est de faire référence
//           au site http://www.frameip.com afin de respecter le travail d'autrui.
// ********************************************

// ********************************************************
// Les includes
// ********************************************************
// Il faut ajouter dans les proprités du projet => C++ => Command Line :
// /I "C:\RepPerso\Personnel\Developpement\Projets\LibrairiePcap\Include"
// /I "C:\RepPerso\Personnel\Developpement\Projets\LibrairieSocket"
#include "LibrairieSocket.h"
#include "pcap.h"

// ********************************************************
// Les Librairies
// ********************************************************
// Il faut ajouter dans les proprités du projet => Linker => Command Line :
// /NODEFAULTLIB:libcd.lib
// /LIBPATH:"C:\RepPerso\Personnel\Developpement\Projets\LibrairiePcap\Lib"
#pragma comment(lib,"Packet.lib")
#pragma comment(lib,"wpcap.lib")

// ********************************************************
// Les procédures
// ********************************************************
void initiation_des_variables(void);
void gestion_des_arguments(int argc, char* argv[]);
void initiation_des_variables_aleatoires(void);
void initiation_des_variables_automatiques(void);
void concatenation_des_entetes(void);
void envoi_de_la_trame_winsock(void);
void envoi_de_la_trame_pcap(void);
void tirage_des_variables_aleatoires(void);
void affichage_du_resultat();

// ********************************************************
// Définition des variables
// ********************************************************
struct mac entete_mac;                                    // Entête Ethernet
struct ipv4 entete_ipv4;                                   // Entête IPV4
struct icmp entete_icmp;                                  // Entête ICMP
struct igmp entete_igmp;                                  // Entête IGMP
struct tcp entete_tcp;                                       // Entête TCP
struct udp entete_udp;                                     // Entête UDP

char ip_source[15];
char ip_destination[15];
char ip_destination_igmp[15];

unsigned char trame_a_envoyer[65535];                                             // Chaine de caratère comprennant les entêtes et la data
unsigned short taille_de_la_trame_a_envoyer=0;                     // Permet d'éviter un sizeof qui s'arrête au premier 0 trouvé
char data[65535];                                                                                                      // Chaine de caratère représentant les data en couche 7
int taille_de_data;                                                                                                       // Taille des données saisies
unsigned int loops;                                                                                                      // Compteur permettant de lancer x fois les trames
bool bouclage_infinie;                                                                                     // Variable permettant de définir le mode de boucle infinie (quand loops=0)
unsigned int pause_entre_chaque_frame;                                             // En ms, permet de spécifier une pause à chaque tour de la boucle
int nombre_de_caractere_emis;                                                                      // Variable récupérant le nombre de caractères émis
unsigned int choix_mode_d_envoi;                                                      // Variable définissant le mode d'envoi (0=Soket - 1=Libpcap)
unsigned char numero_de_l_interface;                                     // Numéro de l'interface qui sera utilisée
struct gestion_des_interfaces liste_des_interfaces; // structure possédant les informations des intefaces
struct adresse_mac adresse_mac_tampon;                                          // Adresse MAC
bool mac_destination_auto;                                                                            // Variable permettant de savoir si l'adresse MAC de destination doit être résolu en ARP
bool mac_source_auto;                                                                                              // Variable permettant de savoir si l'adresse MAC source doit être prise à partir de l'interface

// ********************************************************
// Variables permettant de savoir si il faut tirer un nombre aléatoire
// ********************************************************
bool ipv4_id_random;
bool ipv4_type_random;
bool ipv4_source_random;
bool ipv4_destination_random;
bool icmp_type_random;
bool icmp_id_random;
bool icmp_sequence_random;
bool igmp_destination_random;
bool tcp_port_source_random;
bool tcp_port_destination_random;
bool tcp_sequence_random;
bool udp_port_source_random;
bool udp_port_destination_random;

// ********************************************************
// Variables permettant de savoir si il faut calculer le checksum
// ********************************************************
bool ipv4_length_automatique;
bool ipv4_checksum_automatique;
bool icmp_checksum_automatique;
bool igmp_checksum_automatique;
bool tcp_checksum_automatique;
bool udp_length_automatique;
bool udp_checksum_automatique;

int main (int argc, char* argv[])
            {
            // ********************************************************
            // Initiation
            // ********************************************************
            initiation_des_variables();
            gestion_des_arguments(argc,argv);
            initiation_des_variables_aleatoires();
            initiation_des_variables_automatiques();

            // ********************************************************
            // Boucle d'envoi
            // ********************************************************
            while ( (loops!=0)||(bouclage_infinie==TRUE) )
                        {
                        // ********************************************************
                        // Gestion du compteur de la boucle
                        // ********************************************************
                        loops--;

                        // ********************************************************
                        // Concatenation des entêtes
                        // ********************************************************
                        concatenation_des_entetes();

                        // ********************************************************
                        // Envoi de la trame
                        // ********************************************************
                        if (choix_mode_d_envoi==0)
                                   envoi_de_la_trame_winsock();
                        else
                                   envoi_de_la_trame_pcap();

                        // ********************************************************
                        // Affichage du resultat
                        // ********************************************************
                        affichage_du_resultat();

                        // ********************************************************
                        // Pause entre chaque trame sauf si c'est la dernière
                        // ********************************************************
                        if (loops>0)
                                   Sleep(pause_entre_chaque_frame);
                        }
            printf("\n");

            return(1);
            }

void initiation_des_variables()
            {
            structure_ip_local reception_des_ip_locales;
            unsigned int i;

            // ********************************************************
            // Initiation diverse
            // ********************************************************
            srand(GetTickCount());                                   // Initialise le Random

            // ********************************************************
            // Affichage de la banniere
            // ********************************************************
            printf("\nFrameIP -  Create some IP frame - Version 5.1.3.10");
            printf("\nCreate on December 21, 2002, Last compilation on August 18, 2006");
            printf("\nCreated by Sebastien FONTAINE - http://www.frameip.com");
            printf("\n");

            // ********************************************************
            // Options générales
            // ********************************************************
            loops=1;
            bouclage_infinie=FALSE;
            pause_entre_chaque_frame=1000;
            choix_mode_d_envoi=1;
            numero_de_l_interface=0;
            liste_des_interfaces=recuperation_des_interfaces();

            // ********************************************************
            // Options de l'entête MAC
            // ********************************************************
            adresse_mac_tampon=recuperation_de_l_adresse_mac(liste_des_interfaces.nom[numero_de_l_interface]);
            for (i=0;i<6;i++)
                        {
                        entete_mac.source[i]=adresse_mac_tampon.adresse[i];
                        entete_mac.destination[i]=255;
                        }
            mac_source_auto=true;
            mac_destination_auto=false;
            entete_mac.type=htons(2048); // 08 00 indiquant un datagramme IP

            // ********************************************************
            // Options de l'entête IP
            // ********************************************************
            entete_ipv4.version=4;
            entete_ipv4.ihl=5;
            entete_ipv4.tos=0;
            entete_ipv4.length=htons(0);
            entete_ipv4.id=htons(0);
            entete_ipv4.flag_zero=0;
            entete_ipv4.flag_mf=0;
            entete_ipv4.flag_df=0;
            entete_ipv4.offset=0;
            entete_ipv4.offset2=0; // Offset2 n'est là que pour la séparation d'offset
            entete_ipv4.ttl=128;
            entete_ipv4.type=1;
            entete_ipv4.checksum=htons(0);
            reception_des_ip_locales=recuperation_ip_local(false);
            strcpy(ip_source,reception_des_ip_locales.adresse_ip_local[0]);
            strcpy(ip_destination,"217.12.3.11");
            entete_ipv4.ip_source=resolution_de_nom(false,ip_source);
            entete_ipv4.ip_destination=resolution_de_nom(false,ip_destination);
           
            // ********************************************************
            // Options de l'entête ICMP
            // ********************************************************
            entete_icmp.type=8;
            entete_icmp.code=0;
            entete_icmp.checksum=htons(0);
            entete_icmp.id=htons(0);
            entete_icmp.sequence=htons(0);

            // ********************************************************
            // Options de l'entête IGMP
            // ********************************************************
            entete_igmp.version=1;
            entete_igmp.type=1;
            entete_igmp.reserve=0;
            entete_igmp.checksum=htons(0);
            strcpy(ip_destination_igmp,"224.0.0.1");
            entete_igmp.ip_destination=resolution_de_nom(false,ip_destination_igmp);

            // ********************************************************
            // Options de l'entête TCP
            // ********************************************************
            entete_tcp.port_source=htons(0);
            entete_tcp.port_destination=htons(80);
            entete_tcp.sequence=htonl(0);
            entete_tcp.accuse=htonl(0);
            entete_tcp.offset=5;
            entete_tcp.reserved=0;
            entete_tcp.reserved2=0;
            entete_tcp.flag_urg=0;
            entete_tcp.flag_ack=0;
            entete_tcp.flag_psh=0;
            entete_tcp.flag_rst=0;
            entete_tcp.flag_syn=1;
            entete_tcp.flag_fin=0;
            entete_tcp.window=htons(0);
            entete_tcp.checksum=htons(0);
            entete_tcp.pointeur=htons(0);

            // ********************************************************
            // Options de l'entête UDP
            // ********************************************************
            entete_udp.port_source=htons(0);
            entete_udp.port_destination=htons(53);
            entete_udp.length=htons(0);
            entete_udp.checksum=htons(0);

            // ********************************************************
            // Options de la couche DATA
            // ********************************************************
            strcpy(data,"www.frameip.com");
            taille_de_data=strlen(data);
            }

void gestion_des_arguments(int argc,char* argv[])
            {
            char *caractere_non_convertit;
            unsigned int i,j;
            bool size_modifiee=false;                     // Permet de gérer la saisie simultannée des argument  -size et -data (dans cette ordre)
            unsigned short tempo3,tempo4;           // Pour la séparation de l'argument -ip_offset
            unsigned char tempo1,tempo2; // Pour la séparation de l'argument -tcp_reserved

            // ********************************************************
            // Affichage de l'aide
            // ********************************************************
            if ( (argc>1) && (strcmp(argv[1],"-?")==0) || (argc==1) )
                        {
                        printf("\nGENERAL OPTIONS");
                        printf("\n-?                     This help");
                        printf("\n-wait                  Wait after frame   Defaut: %d ms",pause_entre_chaque_frame);
                        printf("\n-loops                 Number of loops    Defaut: %d (0 => no stop)",loops);
                        printf("\n-send_mode             0=Soket 1=Libpcap  Defaut: %d",choix_mode_d_envoi);

                        printf("\n\nFREE INTERFACES");
                        for(i=0;i<(signed)liste_des_interfaces.nombre;i++)
                                   printf("\n%d - %s",i,liste_des_interfaces.description[i]);
                        printf("\n-interface             Interface choice   Defaut: %d",numero_de_l_interface);

                        printf("\n\nETHERNET HEADER OPTIONS (-send_mode 1)");
                        printf("\n-mac_source            @ Ethernet         Defaut: %.2X-%.2X-%.2X-%.2X-%.2X-%.2X",entete_mac.source[0],entete_mac.source[2],entete_mac.source[2],entete_mac.source[3],entete_mac.source[4],entete_mac.source[5]);
                        printf("\n-mac_source_auto       Between 0 or 1     Defaut: %d (1 => MAC from interface)",mac_source_auto);
                        printf("\n-mac_destination       @ Ethernet         Defaut: %.2X-%.2X-%.2X-%.2X-%.2X-%.2X",entete_mac.destination[0],entete_mac.destination[2],entete_mac.destination[2],entete_mac.destination[3],entete_mac.destination[4],entete_mac.destination[5]);
                        printf("\n-mac_destination_auto  Between 0 or 1     Defaut: %d (1 => MAC from @IP)",mac_destination_auto);
                        printf("\n-mac_type              Between 0 & 65535  Defaut: %d",htons(entete_mac.type));

                        printf("\n\nIP HEADER OPTIONS (-mac_type 2048)");
                        printf("\n-ip_version            Between 0 & 15     Defaut: %d",entete_ipv4.version);
                        printf("\n-ip_ihl                Between 0 & 15     Defaut: %d",entete_ipv4.ihl);
                        printf("\n-ip_tos                Between 0 & 255    Defaut: %d",entete_ipv4.tos);
                        printf("\n-ip_length             Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_ipv4.length));
                        printf("\n-ip_id                 Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_ipv4.id));
                        printf("\n-ip_flag_zero          Between 0 or 1     Defaut: %d",entete_ipv4.flag_zero);               
                        printf("\n-ip_flag_mf            Between 0 or 1     Defaut: %d",entete_ipv4.flag_mf);                  
                        printf("\n-ip_flag_df            Between 0 or 1     Defaut: %d",entete_ipv4.flag_df);                    
                        printf("\n-ip_offset             Between 0 & 8191   Defaut: %d",entete_ipv4.offset);
                        printf("\n-ip_ttl                Between 0 & 255    Defaut: %d",entete_ipv4.ttl);
                        printf("\n-ip_type               Between 0 & 255    Defaut: %d (0 => random)",entete_ipv4.type);
                        printf("\n-ip_checksum           Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_ipv4.checksum));
                        printf("\n-ip_source             @Ip or host name   Defaut: %s (0 => random)",ip_source);
                        printf("\n-ip_destination        @Ip or host name   Defaut: %s (0 => random)",ip_destination);

                        printf("\n\nICMP HEADER OPTIONS (-ip_type 1)");
                        printf("\n-icmp_type             Between 0 & 255    Defaut: %d (0 => random)",entete_icmp.type);
                        printf("\n-icmp_code             Between 0 & 255    Defaut: %d",entete_icmp.code);
                        printf("\n-icmp_checksum         Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_icmp.checksum));
                        printf("\n-icmp_id               Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_icmp.id));
                        printf("\n-icmp_sequence         Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_icmp.sequence));

                        printf("\n\nIGMP HEADER OPTIONS (-ip_type 2)");
                        printf("\n-igmp_version          Between 0 & 15     Defaut: %d",entete_igmp.version);
                        printf("\n-igmp_type             Between 0 & 15     Defaut: %d",entete_igmp.type);
                        printf("\n-igmp_reserve          Between 0 & 255    Defaut: %d",entete_igmp.reserve);
                        printf("\n-igmp_checksum         Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_igmp.checksum));
                        printf("\n-igmp_destination      @Ip or host name   Defaut: %s (0 => random)",ip_destination_igmp);

                        printf("\n\nTCP HEADER OPTIONS (-ip_type 6)");
                        printf("\n-tcp_port_source       Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_tcp.port_source));
                        printf("\n-tcp_port_destination  Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_tcp.port_destination));
                        printf("\n-tcp_sequence          Between 0 & 2E16   Defaut: %d (0 => random)",htonl(entete_tcp.sequence));
                        printf("\n-tcp_acknowledge       Between 0 & 2E16   Defaut: %d",htonl(entete_tcp.accuse));
                        printf("\n-tcp_offset            Between 0 & 15     Defaut: %d",entete_tcp.offset);
                        printf("\n-tcp_reserved          Between 0 & 63     Defaut: %d",entete_tcp.reserved);
                        printf("\n-tcp_flag_urg          Between 0 or 1     Defaut: %d",entete_tcp.flag_urg);
                        printf("\n-tcp_flag_ack          Between 0 or 1     Defaut: %d",entete_tcp.flag_ack);
                        printf("\n-tcp_flag_psh          Between 0 or 1     Defaut: %d",entete_tcp.flag_psh);
                        printf("\n-tcp_flag_rst          Between 0 or 1     Defaut: %d",entete_tcp.flag_rst);
                        printf("\n-tcp_flag_syn          Between 0 or 1     Defaut: %d",entete_tcp.flag_syn);
                        printf("\n-tcp_flag_fin          Between 0 or 1     Defaut: %d",entete_tcp.flag_fin);
                        printf("\n-tcp_window            Between 0 & 65535  Defaut: %d",htons(entete_tcp.window));
                        printf("\n-tcp_checksum          Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_tcp.checksum));
                        printf("\n-tcp_pointeur          Between 0 & 65535  Defaut: %d",htons(entete_tcp.pointeur));

                        printf("\n\nUDP HEADER OPTIONS (-ip_type 17)");
                        printf("\n-udp_port_source       Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_udp.port_source));
                        printf("\n-udp_port_destination  Between 0 & 65535  Defaut: %d (0 => random)",htons(entete_udp.port_destination));
                        printf("\n-udp_length            Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_udp.length));
                        printf("\n-udp_checksum          Between 0 & 65535  Defaut: %d (0 => automatic)",htons(entete_udp.checksum));

                        printf("\n\nOPTIONS OF THE DATA LAYER");
                        printf("\n-data_size             data size          Defaut: %d",taille_de_data);
                        printf("\n-data_ascii            specify a string   Defaut: %s",data);
                        printf("\n-data_hexa             specify some hexa  Defaut: %s",conversion_string_hexa(data,strlen(data)));
                        printf("\n");
                        exit(0); // 0 permet d'indiquer une sortie normal sans erreurs
                        }

            for (i=1;i<argc;i=i+1)
                        {
                        // ********************************************************
                        // Options Générales
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-loops")==0)
                                   {
                                   loops=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                                   if (loops==0)
                                               bouclage_infinie=true;
                                   else
                                               bouclage_infinie=false;
                                   }
                        if (strcmp(strlwr(argv[i]),"-wait")==0)
                                   pause_entre_chaque_frame=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-send_mode")==0)
                                   {
                                   choix_mode_d_envoi=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                                   if (choix_mode_d_envoi!=1)
                                               choix_mode_d_envoi=0;
                                   }

                        // ********************************************************
                        // Choix de l'interface
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-interface")==0)
                                   numero_de_l_interface=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);

                        // ********************************************************
                        // Options de l'entête MAC
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-mac_source")==0)
                                   {
                                   adresse_mac_tampon=transformation_string_en_mac(argv[i+1]);
                                   for (j=0;j<6;j++)
                                               entete_mac.source[j]=adresse_mac_tampon.adresse[j];
                                   }
                        if (strcmp(strlwr(argv[i]),"-mac_source_auto")==0)
                                   if ((unsigned char)strtod(argv[i+1],&caractere_non_convertit)==1)
                                               mac_source_auto=true;
                                   else
                                               mac_source_auto=false;

                        if (strcmp(strlwr(argv[i]),"-mac_destination")==0)
                                   {
                                   adresse_mac_tampon=transformation_string_en_mac(argv[i+1]);
                                   for (j=0;j<6;j++)
                                               entete_mac.destination[j]=adresse_mac_tampon.adresse[j];
                                   }
                        if (strcmp(strlwr(argv[i]),"-mac_destination_auto")==0)
                                   if ((unsigned char)strtod(argv[i+1],&caractere_non_convertit)==1)
                                               mac_destination_auto=true;
                                   else
                                               mac_destination_auto=false;
                        if (strcmp(strlwr(argv[i]),"-mac_type")==0)
                                   entete_mac.type=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
           
                        // ********************************************************
                        // Options de l'entête IP
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-ip_version")==0)
                                   entete_ipv4.version=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_ihl")==0)
                                   entete_ipv4.ihl=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_tos")==0)
                                   entete_ipv4.tos=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_length")==0)
                                   entete_ipv4.length=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-ip_id")==0)
                                   entete_ipv4.id=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-ip_flag_zero")==0)
                                   entete_ipv4.flag_zero=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_flag_mf")==0)
                                   entete_ipv4.flag_mf=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_flag_df")==0)
                                   entete_ipv4.flag_df=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_offset")==0)
                                   {
                                   tempo3=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);

                                   // ********************************************************
                                   // Récupération des cinq bits finaux du premier octet
                                   // ********************************************************
                                   tempo4=tempo3<<3;
                                   entete_ipv4.offset=tempo4>>11;

                                   // ********************************************************
                                   // Récupération des huit bits finaux du second octet
                                   // ********************************************************
                                   entete_ipv4.offset2=(unsigned char)tempo3;
                                   }                     
                        if (strcmp(strlwr(argv[i]),"-ip_ttl")==0)
                                   entete_ipv4.ttl=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_type")==0)
                                   entete_ipv4.type=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-ip_checksum")==0)
                                   entete_ipv4.checksum=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-ip_source")==0)
                                   entete_ipv4.ip_source=(unsigned long)resolution_de_nom(false,argv[i+1]);
                        if (strcmp(strlwr(argv[i]),"-ip_destination")==0)
                                   entete_ipv4.ip_destination=(unsigned long)resolution_de_nom(false,argv[i+1]);

                        // ********************************************************
                        // Options de l'entête ICMP
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-icmp_type")==0)
                                   entete_icmp.type=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-icmp_code")==0)
                                   entete_icmp.code=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-icmp_checksum")==0)
                                   entete_icmp.checksum=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-icmp_id")==0)
                                   entete_icmp.id=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-icmp_sequence")==0)
                                   entete_icmp.sequence=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));

                        // ********************************************************
                        // Options de l'entête IGMP
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-igmp_version")==0)
                                   entete_igmp.version=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-igmp_type")==0)
                                   entete_igmp.type=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-igmp_reserve")==0)
                                   entete_igmp.reserve=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-igmp_checksum")==0)
                                   entete_igmp.checksum=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-igmp_destination")==0)
                                   entete_igmp.ip_destination=(unsigned long)strtod(argv[i+1],&caractere_non_convertit);

                        // ********************************************************
                        // Options de l'entête TCP
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-tcp_port_source")==0)
                                   entete_tcp.port_source=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_port_destination")==0)
                                   entete_tcp.port_destination=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_sequence")==0)
                                   entete_tcp.sequence=htonl((unsigned long)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_acknowledge")==0)
                                   entete_tcp.accuse=htonl((unsigned long)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_offset")==0)
                                   entete_tcp.offset=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_reserved")==0)
                                   {
                                   tempo1=(unsigned char)strtod(argv[i+1],&caractere_non_convertit);
                       
                                    // ********************************************************
                                   // Récupération des quatre bits centraux
                                   // ********************************************************
                                   tempo2=tempo1<<2; // Rajoute 2 0 à droite en décalant
                                   entete_tcp.reserved=tempo2>>4; // Rajoute 4 0 à gauche en décalant

                                   // ********************************************************
                                   // Récupération des deux bits finaux
                                   // ********************************************************
                                   tempo2=tempo1<<6;
                                   entete_tcp.reserved2=tempo2>>6; // Les deux bits suivant
                                   }
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_urg")==0)
                                   entete_tcp.flag_urg=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_ack")==0)
                                   entete_tcp.flag_ack=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_psh")==0)
                                   entete_tcp.flag_psh=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_rst")==0)
                                   entete_tcp.flag_rst=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_syn")==0)
                                   entete_tcp.flag_syn=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_flag_fin")==0)
                                   entete_tcp.flag_fin=(unsigned short)strtod(argv[i+1],&caractere_non_convertit);
                        if (strcmp(strlwr(argv[i]),"-tcp_window")==0)
                                   entete_tcp.window=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_checksum")==0)
                                   entete_tcp.checksum=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-tcp_pointeur")==0)
                                   entete_tcp.pointeur=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));

                        // ********************************************************
                        // Options de l'entête UDP
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-udp_port_source")==0)
                                   entete_udp.port_source=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-udp_port_destination")==0)
                                   entete_udp.port_destination=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-udp_length")==0)
                                   entete_udp.length=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));
                        if (strcmp(strlwr(argv[i]),"-udp_checksum")==0)
                                   entete_udp.checksum=htons((unsigned short)strtod(argv[i+1],&caractere_non_convertit));

                        // ********************************************************
                        // Options de la couche DATA
                        // ********************************************************
                        if (strcmp(strlwr(argv[i]),"-data_size")==0)
                                   {
                                   size_modifiee=true; // Indique que size à été modifié
                                   taille_de_data=(unsigned int)strtod(argv[i+1],&caractere_non_convertit);
                                    memcpy(data,dimensionnement_de_data_a_envoyer(false,data,taille_de_data,taille_de_data),taille_de_data);
                                   }
                        if (strcmp(strlwr(argv[i]),"-data_ascii")==0)
                                   {
                                   strcpy(data,argv[i+1]);
                                   taille_de_data=strlen(argv[i+1]);
                                   if (size_modifiee==true)
                                               {
                                               strcpy(data,dimensionnement_de_data_a_envoyer(false,data,taille_de_data,taille_de_data));
                                               taille_de_data=strlen(data);
                                               }
                                   }
                        if (strcmp(strlwr(argv[i]),"-data_hexa")==0)
                                   {
                                   memcpy(data,conversion_hexa_string(argv[i+1],strlen(argv[i+1])),strlen(argv[i+1]));
                                   taille_de_data=strlen(argv[i+1])/2;
                                   if (size_modifiee==true)
                                               memcpy(data,dimensionnement_de_data_a_envoyer(false,data,taille_de_data,taille_de_data),taille_de_data);
                                   }
                        }
            }

void initiation_des_variables_aleatoires(void)
            {
            // ********************************************************
            // Permet de savoir si l'utilisateur a demandé un calcul aléatoire. Utilie dans le cas des loops.
            // ********************************************************
            if (entete_ipv4.id==0)
                        ipv4_id_random=true;
            else
                        ipv4_id_random=false;

            if (entete_ipv4.type==0)
                        ipv4_type_random=true;
            else
                        ipv4_type_random=false;

            if (entete_ipv4.ip_source==0)
                        ipv4_source_random=true;
            else
                        ipv4_source_random=false;

            if (entete_ipv4.ip_destination==0)
                        ipv4_destination_random=true;
            else
                        ipv4_destination_random=false;

            if (entete_icmp.type==0)
                        icmp_type_random=true;
            else
                        icmp_type_random=false;

            if (entete_icmp.id==0)
                        icmp_id_random=true;
            else
                        icmp_id_random=false;

            if (entete_icmp.sequence==0)
                        icmp_sequence_random=true;
            else
                        icmp_sequence_random=false;

            if (entete_igmp.ip_destination==0)
                        igmp_destination_random=true;
            else
                        igmp_destination_random=false;

            if (entete_tcp.port_source==0)
                        tcp_port_source_random=true;
            else
                        tcp_port_source_random=false;

            if (entete_tcp.port_destination==0)
                        tcp_port_destination_random=true;
            else
                        tcp_port_destination_random=false;

            if (entete_tcp.sequence==0)
                        tcp_sequence_random=true;
            else
                        tcp_sequence_random=false;

            if (entete_udp.port_source==0)
                        udp_port_source_random=true;
            else
                        udp_port_source_random=false;

            if (entete_udp.port_destination==0)
                        udp_port_destination_random=true;
            else
                        udp_port_destination_random=false;
            }

void initiation_des_variables_automatiques(void)
            {
            unsigned int i;                                                                                                             // Pour les boucles for

            if (entete_ipv4.length==0)
                        ipv4_length_automatique=true;
            else
                        ipv4_length_automatique=false;

            if (entete_ipv4.checksum==0)
                        ipv4_checksum_automatique=true;
            else
                        ipv4_checksum_automatique=false;

            if (entete_icmp.checksum==0)
                        icmp_checksum_automatique=true;
            else
                        icmp_checksum_automatique=false;

            if (entete_igmp.checksum==0)
                        igmp_checksum_automatique=true;
            else
                        igmp_checksum_automatique=false;

            if (entete_tcp.checksum==0)
                        tcp_checksum_automatique=true;
            else
                        tcp_checksum_automatique=false;

            if (entete_udp.length==0)
                        udp_length_automatique=true;
            else
                        udp_length_automatique=false;

            if (entete_udp.checksum==0)
                        udp_checksum_automatique=true;
            else
                        udp_checksum_automatique=false;
           
            // ********************************************************
            // Préparation des adresses MAC
            // ********************************************************
            if (mac_source_auto==true)
                        {
                        adresse_mac_tampon=recuperation_de_l_adresse_mac(liste_des_interfaces.nom[numero_de_l_interface]);
                        for (i=0;i<6;i++)
                                   entete_mac.source[i]=adresse_mac_tampon.adresse[i];
                        }
            if (mac_destination_auto==true)
                        {
                        adresse_mac_tampon=resolution_arp(liste_des_interfaces.nom[numero_de_l_interface],0,ip_destination,3);
                        for (i=0;i<6;i++)
                                   entete_mac.destination[i]=adresse_mac_tampon.adresse[i];
                        }         
            }

void concatenation_des_entetes(void)
            {
            // ********************************************************
            // Affectation d'une valeur aléatoire pour les variables qui le nécssite
            // ********************************************************
            tirage_des_variables_aleatoires();

            // ********************************************************
            // Concatenation des entetes avec la data
            // ********************************************************
            switch (entete_ipv4.type)
                        {         
                        case 1: // ICMP
                                   // ********************************************************
                                   // Calcul du checksum ICMP
                                   // ********************************************************
                                   if (icmp_checksum_automatique==true)
                                               entete_icmp.checksum=calcul_du_checksum_icmp(false,entete_icmp,data,taille_de_data);

                                   // ********************************************************
                                   // Calcul de la longueur totale
                                   // ********************************************************
                                   taille_de_la_trame_a_envoyer=(unsigned short)(sizeof(struct ipv4)+sizeof(struct icmp)+taille_de_data);
                                   if (ipv4_length_automatique==true)
                                               entete_ipv4.length=htons((unsigned short)taille_de_la_trame_a_envoyer);

                                   // ********************************************************
                                   // Calcul du checksum IP
                                   // ********************************************************
                                   if (ipv4_checksum_automatique==true)
                                               entete_ipv4.checksum=calcul_du_checksum_ip(false,entete_ipv4);

                                   // ********************************************************
                                   // Concatenation des différentes couches
                                   // ********************************************************
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_icmp,sizeof(struct icmp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct icmp),data,taille_de_data);                     
                                   break;

                        case 2: // IGMP
                                   // ********************************************************
                                   // Calcul du checksum IGMP
                                   // ********************************************************
                                   if (igmp_checksum_automatique==true)
                                               entete_igmp.checksum=calcul_du_checksum_igmp(false,entete_igmp,data,taille_de_data);

                                   // ********************************************************
                                   // Calcul de la longueur totale
                                   // ********************************************************
                                   taille_de_la_trame_a_envoyer=(unsigned short)(sizeof(struct ipv4)+sizeof(struct igmp)+taille_de_data);
                                   if (ipv4_length_automatique==true)
                                               entete_ipv4.length=htons((unsigned short)taille_de_la_trame_a_envoyer);

                                   // ********************************************************
                                   // Calcul du checksum IP
                                   // ********************************************************
                                   if (ipv4_checksum_automatique==true)
                                               entete_ipv4.checksum=calcul_du_checksum_ip(false,entete_ipv4);

                                   // ********************************************************
                                   // Concatenation des différentes couches
                                   // ********************************************************
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_igmp,sizeof(struct igmp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct igmp),data,taille_de_data);                     
                                   break;

                        case 6: // TCP
                                   // ********************************************************
                                   // Calcul du checksum TCP
                                   // ********************************************************
                                   if (tcp_checksum_automatique==true)
                                               entete_tcp.checksum=calcul_du_checksum_tcp(false,entete_ipv4.ip_source,entete_ipv4.ip_destination,entete_tcp,data,taille_de_data);

                                   // ********************************************************
                                    // Calcul de la longueur totale
                                   // ********************************************************
                                   taille_de_la_trame_a_envoyer=(unsigned short)(sizeof(struct ipv4)+sizeof(struct tcp)+taille_de_data);
                                   if (ipv4_length_automatique==true)
                                               entete_ipv4.length=htons((unsigned short)taille_de_la_trame_a_envoyer);

                                   // ********************************************************
                                   // Calcul du checksum IP
                                   // ********************************************************
                                   if (ipv4_checksum_automatique==true)
                                               entete_ipv4.checksum=calcul_du_checksum_ip(false,entete_ipv4);

                                   // ********************************************************
                                   // Concatenation des différentes couches
                                   // ********************************************************
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_tcp,sizeof(struct tcp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct tcp),data,taille_de_data);            
                                   break;

                        case 17: // UDP
                                   // ********************************************************
                                   // Calcul de la longueur totale
                                   // ********************************************************
                                   if (udp_length_automatique==true)
                                               entete_udp.length=htons(sizeof(struct udp)+(u_short)taille_de_data);

                                   // ********************************************************
                                   // Calcul du checksum UDP
                                   // ********************************************************
                                   if (udp_checksum_automatique==true)
                                               entete_udp.checksum=calcul_du_checksum_udp(false,entete_ipv4.ip_source,entete_ipv4.ip_destination,entete_udp,data,taille_de_data);

                                   // ********************************************************
                                   // Calcul de la longueur totale
                                   // ********************************************************
                                   taille_de_la_trame_a_envoyer=(unsigned short)(sizeof(struct ipv4)+sizeof(struct udp)+taille_de_data);
                                   if (ipv4_length_automatique==true)
                                               entete_ipv4.length=htons((unsigned short)taille_de_la_trame_a_envoyer);

                                   // ********************************************************
                                   // Calcul du checksum IP
                                   // ********************************************************
                                   if (ipv4_checksum_automatique==true)
                                               entete_ipv4.checksum=calcul_du_checksum_ip(false,entete_ipv4);

                                   // ********************************************************
                                   // Concatenation des différentes couches
                                   // ********************************************************
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_udp,sizeof(struct udp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct udp),data,taille_de_data);                       
                                   break;

                        default:
                                   // ********************************************************
                                   // Calcul de la longueur totale
                                   // ********************************************************
                                   taille_de_la_trame_a_envoyer=(unsigned short)(sizeof(struct ipv4)+taille_de_data);
                                   if (ipv4_length_automatique==true)
                                               entete_ipv4.length=htons((unsigned short)taille_de_la_trame_a_envoyer);

                                   // ********************************************************
                                   // Calcul du checksum IP
                                   // ********************************************************
                                   if (ipv4_checksum_automatique==true)
                                               entete_ipv4.checksum=calcul_du_checksum_ip(false,entete_ipv4);

                                   // ********************************************************
                                   // Concatenation des différentes couches
                                   // ********************************************************
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),data,taille_de_data);    
                                   break;
                        }

            if (choix_mode_d_envoi!=0)
                        {
                        // ********************************************************
                        // Concatenation des différentes couches avec l'entête MAC
                        // ********************************************************
                        memcpy(trame_a_envoyer+14,trame_a_envoyer,taille_de_la_trame_a_envoyer);
                        taille_de_la_trame_a_envoyer=taille_de_la_trame_a_envoyer+14;
                        memcpy(trame_a_envoyer,(unsigned short *)&entete_mac,sizeof(struct mac));  
                        }
            }

void envoi_de_la_trame_winsock(void)
            {
            WSADATA initialisation_win32;
            SOCKET id_de_la_socket;
            SOCKADDR_IN information_sur_la_destination;
            int on=1;                                                                                 // Permet de paramétrer la fonction SetSockOpt

            // ********************************************************
            // Initialisation de la Socket
            // ********************************************************
            if (WSAStartup(MAKEWORD(2,2),&initialisation_win32)!=0)
                        gestion_des_erreurs(1,"WSAStartup",1,1);     

            // ********************************************************
            // Ouverture d'une Socket
            // ********************************************************
            id_de_la_socket=socket(AF_INET,SOCK_RAW,IPPROTO_RAW);
            if (id_de_la_socket==INVALID_SOCKET)
                        gestion_des_erreurs(1,"socket",1,1);   

            // ********************************************************
            // Activation de l'option permettant d'inclure l'entete IP lors de l'emission
            // ********************************************************
            if (setsockopt(id_de_la_socket,IPPROTO_IP,IP_HDRINCL,(char *)&on,sizeof(on))!=0)
                        gestion_des_erreurs(1,"setsockopt",1,1);        

            // ********************************************************
            // Informations non utilisée mais nécessaire pour la fonction sendto
            // ********************************************************
            information_sur_la_destination.sin_family=AF_INET;
            information_sur_la_destination.sin_addr.s_addr=entete_ipv4.ip_destination;
            information_sur_la_destination.sin_port=entete_tcp.port_destination;

            // ********************************************************
            // Envoi de la trame en winsock
            // ********************************************************
            nombre_de_caractere_emis=sendto(id_de_la_socket,(char *)trame_a_envoyer,taille_de_la_trame_a_envoyer,0,(struct sockaddr*)&information_sur_la_destination,sizeof(information_sur_la_destination));
            if (nombre_de_caractere_emis==-1)
                        gestion_des_erreurs(1,"sendto",1,1);
            }

void envoi_de_la_trame_pcap(void)
            {
            pcap_t *pointeur_interface;
            char buffer_d_erreur[PCAP_ERRBUF_SIZE];

            // ********************************************************
            // Accède à l'interface
            // ********************************************************
            if ((pointeur_interface=pcap_open_live(liste_des_interfaces.nom[numero_de_l_interface],65536,0,1000,buffer_d_erreur))==NULL)
                        gestion_des_erreurs(1,"pcap_open_live",1,1);

            // ********************************************************
            // Envoi de la trame
            // ********************************************************
            if(pcap_sendpacket(pointeur_interface,trame_a_envoyer,taille_de_la_trame_a_envoyer)!=0)
                        gestion_des_erreurs(1,"pcap_sendpacket",1,1);                     

            // ********************************************************
            // Fermeture de l'accès à l'interface
            // ********************************************************
            pcap_close(pointeur_interface);          
            }

void tirage_des_variables_aleatoires(void)
            {
            if (ipv4_id_random==true)
                        entete_ipv4.id=(unsigned short)(rand()%65535+1); // Tire entre 1 et 65535
            if (ipv4_type_random==true)
                        entete_ipv4.type=(unsigned char)(rand()%255+1); // Tire entre 1 et 255
            if (ipv4_source_random==true)
                        entete_ipv4.ip_source=generation_d_une_adresse_ip_aleatoire(0);
            if (ipv4_destination_random==true)
                        entete_ipv4.ip_destination=generation_d_une_adresse_ip_aleatoire(0);
            if (icmp_type_random==true)
                        entete_icmp.type=(unsigned char)(rand()%255+1); // Tire entre 1 et 255
            if (icmp_id_random==true)
                        entete_icmp.id=(unsigned short)(rand()%65535+1); // Tire entre 1 et 65535
            if (icmp_sequence_random==true)
                        entete_icmp.sequence=(unsigned short)(rand()%65535+1); // Tire entre 1 et 65535
            if (igmp_destination_random==true)
                        entete_igmp.ip_destination=generation_d_une_adresse_ip_aleatoire(0);
            if (tcp_port_source_random==true)
                        entete_tcp.port_source=(unsigned short)(rand()%64511+1+1024);    // Tire entre 1025 et 65535
            if (tcp_port_destination_random==true)
                        entete_tcp.port_destination=(unsigned short)(rand()%65535+1); // Tire entre 1 et 65535
            if (tcp_sequence_random==true)
                        entete_tcp.sequence=(unsigned long)(rand()%4294967295+1); // Tire entre 1 et 4294967295
            if (udp_port_source_random==true)
                        entete_udp.port_source=(unsigned short)(rand()%64511+1+1024);   // Tire entre 1025 et 65535
            if (udp_port_destination_random==true)
                        entete_udp.port_destination=(unsigned short)(rand()%65535+1); // Tire entre 1 et 65535
            }

void affichage_du_resultat(void)
            {
            struct in_addr convertion_inet_addr;
           
            // ********************************************************
            // Affichage du resultat
            // ********************************************************
            convertion_inet_addr.S_un.S_addr=entete_ipv4.ip_source;
            printf("\nThe frame was sent from %s",inet_ntoa(convertion_inet_addr));
            convertion_inet_addr.S_un.S_addr=entete_ipv4.ip_destination;
            printf(" to %s with %d Bytes",inet_ntoa(convertion_inet_addr),taille_de_la_trame_a_envoyer);
            }

7 - Code source de la version graphique

7.1 - FrameIp.h

// FrameIp.h : main header file for the FRAMEIP application
//

#if !defined(AFX_FRAMEIP_H__5C749D61_1E5F_4A7A_8616_97BD53BCB9D2__INCLUDED_)
#define AFX_FRAMEIP_H__5C749D61_1E5F_4A7A_8616_97BD53BCB9D2__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
            #error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"               // main symbols

/////////////////////////////////////////////////////////////////////////////
// CFrameIpApp:
// See FrameIp.cpp for the implementation of this class
//

class CFrameIpApp : public CWinApp
{
public:
            CFrameIpApp();

// Overrides
            // ClassWizard generated virtual function overrides
            //{{AFX_VIRTUAL(CFrameIpApp)
            public:
            virtual BOOL InitInstance();
            //}}AFX_VIRTUAL

// Implementation

            //{{AFX_MSG(CFrameIpApp)
            //}}AFX_MSG
            DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FRAMEIP_H__5C749D61_1E5F_4A7A_8616_97BD53BCB9D2__INCLUDED_)

7.2 - FrameIp.cpp

#include "stdafx.h"
#include "FrameIp.h"
#include "FrameIpDlg.h"
#include "class_ip_address.h"
#include <C:\\RepPerso\\Personnel\\Developpement\\Projets\\LibrairieSocket\\LibrairieSocket.h>

// **************************************************
// CPingIcmpApp
// **************************************************
BEGIN_MESSAGE_MAP(CFrameIpApp, CWinApp)
//          ON_COMMAND(ID_HELP, CWinApp::OnHelp) // Permet de tapez sur F1 de lancer FrameIp.hlp
END_MESSAGE_MAP()

// **************************************************
// CPingIcmpApp construction
// **************************************************
CFrameIpApp::CFrameIpApp()
            {
            }

CFrameIpApp theApp;

BOOL CFrameIpApp::InitInstance()
            {
            CFrameIpDlg application;
            m_pMainWnd = &application;
            application.DoModal();

            return FALSE;
            }

7.3 - FrameIpDlg.h

// FrameIpDlg.h : header file
//


#include "afxwin.h"
#include "afxcmn.h"
#if !defined(AFX_FRAMEIPDLG_H__C0A41A9C_DBA5_419E_BAC7_E06EAD3CF015__INCLUDED_)
#define AFX_FRAMEIPDLG_H__C0A41A9C_DBA5_419E_BAC7_E06EAD3CF015__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


/////////////////////////////////////////////////////////////////////////////
// CFrameIpDlg dialog

class CFrameIpDlg : public CDialog
{
// Construction
public:
            CFrameIpDlg(CWnd* pParent = NULL);       // standard constructor

// Dialog Data
            //{{AFX_DATA(CFrameIpDlg)
            enum { IDD = IDD_FRAMEIP_DIALOG };
            CSpinButtonCtrl          m_spin_udp_source_port_control;
            CSpinButtonCtrl          m_spin_udp_destination_port_control;
            CSpinButtonCtrl          m_spin_tcp_window_control;
            CSpinButtonCtrl          m_spin_tcp_source_port_control;
            CSpinButtonCtrl          m_spin_tcp_reserved_control;
            CSpinButtonCtrl          m_spin_tcp_pointer_control;
            CSpinButtonCtrl          m_spin_tcp_destination_port_control;
            CSpinButtonCtrl          m_spin_icmp_type_control;
            CSpinButtonCtrl          m_spin_icmp_sequence_control;
            CSpinButtonCtrl          m_spin_icmp_id_control;
            CSpinButtonCtrl          m_spin_icmp_code_control;
            CSpinButtonCtrl          m_spin_igmp_version_control;
            CSpinButtonCtrl          m_spin_igmp_type_control;
            CSpinButtonCtrl          m_spin_igmp_reserved_control;
            CEdit   m_edit_udp_destination_port_control;
            CEdit   m_edit_tcp_window_control;
            CEdit   m_edit_tcp_source_port_control;
            CEdit   m_edit_tcp_sequence_control;
            CEdit   m_edit_tcp_reserved_control;
            CEdit   m_edit_tcp_pointer_control;
            CEdit   m_edit_tcp_offset_control;
            CEdit   m_edit_tcp_destination_port_control;
            CEdit   m_edit_tcp_checksum_control;
            CEdit   m_edit_tcp_ack_control;
            CEdit   m_edit_udp_source_port_control;
            CEdit   m_edit_udp_length_control;
            CEdit   m_edit_udp_checksum_control;
            CEdit   m_edit_igmp_version_control;
            CEdit   m_edit_igmp_type_control;
            CEdit   m_edit_igmp_reserved_control;
            CEdit   m_edit_igmp_destination_control;
            CEdit   m_edit_igmp_checksum_control;
            CEdit   m_edit_icmp_type_control;
            CEdit   m_edit_icmp_sequence_control;
            CEdit   m_edit_icmp_id_control;
            CEdit   m_edit_icmp_code_control;
            CEdit   m_edit_icmp_checksum_control;
            CButton           m_check_icmp_header_control;
            CButton           m_check_udp_header_control;
            CButton           m_check_tcp_header_control;
            CButton           m_check_igmp_header_control;
            CEdit   m_edit_layer_4_control;
            CEdit   m_edit_layer_data_control;
            CEdit   m_edit_layer_ip_control;
            CEdit   m_edit_number_control;
            CSpinButtonCtrl          m_spin_ip_ttl_control;
            CSpinButtonCtrl          m_spin_timeout_control;
            CSpinButtonCtrl          m_spin_number_control;
            CSpinButtonCtrl          m_spin_ip_version_control;
            CSpinButtonCtrl          m_spin_ip_tos_control;
            CSpinButtonCtrl          m_spin_ip_offset_control;
            CSpinButtonCtrl          m_spin_ip_ihl_control;
            CSpinButtonCtrl          m_spin_ip_id_control;
            CSpinButtonCtrl          m_spin_ip_flags_control;
            CButton           m_check_permenent_control;
            CButton           m_check_data_control;
            CEdit   m_edit_size_control;
            CEdit   m_edit_data_control;
            CString            m_edit_data;
            UINT   m_edit_size;
            UINT   m_edit_icmp_checksum;
            UINT   m_edit_icmp_code;
            UINT   m_edit_icmp_id;
            UINT   m_edit_icmp_sequence;
            UINT   m_edit_icmp_type;
            UINT   m_edit_ip_checksum;
            CString            m_edit_ip_destination;
            UINT   m_edit_ip_flags;
            UINT   m_edit_ip_id;
            UINT   m_edit_ip_ihl;
            UINT   m_edit_ip_length;
            UINT   m_edit_ip_offset;
            UINT   m_edit_ip_tos;
            UINT   m_edit_ip_ttl;
            UINT   m_edit_ip_type;
            UINT   m_edit_ip_version;
            CString            m_edit_layer_ip;
            CString            m_edit_layer_4;
            UINT   m_edit_igmp_checksum;
            UINT   m_edit_igmp_reserved;
            UINT   m_edit_igmp_type;
            UINT   m_edit_igmp_version;
            CString            m_edit_igmp_destination;
            ULONG          m_edit_tcp_ack;
            UINT   m_edit_tcp_checksum;
            UINT   m_edit_tcp_destination_port;
            UINT   m_edit_tcp_offset;
            UINT   m_edit_tcp_pointer;
            UINT   m_edit_tcp_reserved;
            ULONG          m_edit_tcp_sequence;
            UINT   m_edit_tcp_source_port;
            UINT   m_edit_tcp_window;
            UINT   m_edit_udp_checksum;
            UINT   m_edit_udp_destination_port;
            UINT   m_edit_udp_length;
            UINT   m_edit_udp_source_port;
            CString            m_static_layer_4;
            CEdit m_edit_ip_version_control;
            CEdit m_edit_ip_ihl_control;
            CEdit m_edit_ip_tos_control;
            CEdit m_edit_ip_length_control;
            CEdit m_edit_ip_id_control;
            CEdit m_edit_ip_flags_control;
            CEdit m_edit_ip_offset_control;
            CEdit m_edit_ip_ttl_control;
            CEdit m_edit_ip_type_control;
            CEdit m_edit_ip_checksum_control;
            CEdit m_edit_ip_destination_control;
            CEdit m_edit_timeout_control;
            CStatic m_static_layer_4_control;
            //}}AFX_DATA

            // ClassWizard generated virtual function overrides
            //{{AFX_VIRTUAL(CFrameIpDlg)
            protected:
            virtual void DoDataExchange(CDataExchange* pDX);            // DDX/DDV support
            //}}AFX_VIRTUAL

// Implementation
protected:
            HICON m_hIcon;

            afx_msg void OnClose();

// **************************************************
// Les fonctions
// **************************************************
void CFrameIpDlg::read_only_des_entetes_couche_4(void);
void CFrameIpDlg::mise_a_jour_de_champ_ip_type(void);
void CFrameIpDlg::mise_a_jour_du_champ_static_layer_4(void);

void CFrameIpDlg::mise_a_jour_du_champ_ip_hexa(void);
void CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa(void);
void CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa(void);
void CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa(void);
void CFrameIpDlg::mise_a_jour_du_champ_udp_hexa(void);

void CFrameIpDlg::On_Change_check_icmp_header(void);
void CFrameIpDlg::On_Change_check_igmp_header(void);
void CFrameIpDlg::On_Change_check_tcp_header(void);
void CFrameIpDlg::On_Change_check_udp_header(void);
void CFrameIpDlg::mise_a_jour_du_champ_data_hexa(void);

void CFrameIpDlg::OnEn_Change_edit_ip_version(void);
void CFrameIpDlg::OnEn_Change_edit_ip_ihl(void);
void CFrameIpDlg::OnEn_Change_edit_ip_tos(void);
void CFrameIpDlg::OnEn_Change_edit_ip_length(void);
void CFrameIpDlg::OnEn_Change_edit_ip_id(void);
void CFrameIpDlg::OnEn_Change_edit_ip_offset(void);
void CFrameIpDlg::OnEn_Change_edit_ip_ttl(void);
void CFrameIpDlg::OnEn_Change_edit_ip_type(void);
void CFrameIpDlg::OnEn_Change_edit_ip_checksum(void);
void CFrameIpDlg::OnEn_Change_edit_ip_source(void);
void CFrameIpDlg::OnEn_Change_edit_ip_destination(void);

void CFrameIpDlg::OnEn_Change_edit_icmp_type(void);
void CFrameIpDlg::OnEn_Change_edit_icmp_code(void);
void CFrameIpDlg::OnEn_Change_edit_icmp_checksum(void);
void CFrameIpDlg::OnEn_Change_edit_icmp_id(void);
void CFrameIpDlg::OnEn_Change_edit_icmp_sequence(void);
void CFrameIpDlg::OnEn_Change_edit_igmp_version(void);
void CFrameIpDlg::OnEn_Change_edit_igmp_type(void);
void CFrameIpDlg::OnEn_Change_edit_igmp_reserved(void);
void CFrameIpDlg::OnEn_Change_edit_igmp_checksum(void);
void CFrameIpDlg::OnEn_Change_edit_igmp_destination(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_source_port(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_destination_port(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_sequence(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_ack(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_offset(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_reserved(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_window(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_checksum(void);
void CFrameIpDlg::OnEn_Change_edit_tcp_pointer(void);
void CFrameIpDlg::OnEn_Change_edit_udp_source_port(void);
void CFrameIpDlg::OnEn_Change_edit_udp_destination_port(void);
void CFrameIpDlg::OnEn_Change_edit_udp_length(void);
void CFrameIpDlg::OnEn_Change_edit_udp_checksum(void);

void CFrameIpDlg::calcul_et_affichage_ip_length(void);
void CFrameIpDlg::calcul_et_affichage_udp_length(void);
void CFrameIpDlg::calcul_et_affichage_ip_checksum(void);
void CFrameIpDlg::calcul_et_affichage_icmp_checksum(void);
void CFrameIpDlg::calcul_et_affichage_igmp_checksum(void);
void CFrameIpDlg::calcul_et_affichage_tcp_checksum(void);
void CFrameIpDlg::calcul_et_affichage_udp_checksum(void);

void CFrameIpDlg::affichage_du_resultat(int);
void CFrameIpDlg::boucle_d_envoi(void);


            // Generated message map functions
            //{{AFX_MSG(CFrameIpDlg)
            virtual BOOL OnInitDialog();
            afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
            afx_msg void OnPaint();
            afx_msg HCURSOR OnQueryDragIcon();
            afx_msg void On_button_send();
            afx_msg void On_button_stop();
            afx_msg void On_button_about();
            afx_msg void On_check_data();
            afx_msg void On_check_permenent();
            //}}AFX_MSG
            DECLARE_MESSAGE_MAP()
public:
            afx_msg void OnBn_Clicked_button_get_ip_destination();
            afx_msg void OnBn_Clicked_button_get_ip_source();
            CEdit m_edit_ip_source_control;
            CString m_edit_ip_source;
            afx_msg void OnBn_Clicked_button_get_igmp_destination();
            CButton m_button_get_igmp_destination_control;
            afx_msg void OnEn_Change_edit_data();
            afx_msg void OnEn_Change_edit_size();
            CSpinButtonCtrl m_spin_size_control;
            afx_msg void OnBn_Clicked_check_icmp_checksum();
            afx_msg void OnBn_Clicked_check_igmp_checksum();
            afx_msg void OnBn_Clicked_check_tcp_checksum();
            afx_msg void OnBn_Clicked_check_udp_checksum();
            afx_msg void OnBn_Clicked_check_ip_checksum();
            afx_msg void OnBn_Clicked_check_ip_type();
            CButton m_check_icmp_checksum_control;
            CButton m_check_igmp_checksum_control;
            CButton m_check_tcp_checksum_control;
            CButton m_check_udp_checksum_control;
            CButton m_check_ip_checksum_control;

            CButton m_check_ip_type_control;
            CStatic m_static_data_control;
            afx_msg void OnBn_Clicked_check_ip_flag_none();
            afx_msg void OnBn_Clicked_check_ip_flag_df();
            afx_msg void OnBn_Clicked_check_ip_flag_mf();
            CButton m_check_ip_flag_none_control;
            CButton m_check_hexa_control;
            CButton m_check_ip_flag_df_control;
            CButton m_check_ip_flag_mf_control;
            afx_msg void OnBn_Clicked_check_ip_length();
            CButton m_check_ip_length_control;
            CButton m_check_tcp_flag_urg_control;
            CButton m_check_tcp_flag_ack_control;
            CButton m_check_tcp_flag_psh_control;
            CButton m_check_tcp_flag_rst_control;
            CButton m_check_tcp_flag_syn_control;
            CButton m_check_tcp_flag_fin_control;
            afx_msg void OnBn_Clicked_check_tcp_flag_urg();
            afx_msg void OnBn_Clicked_check_tcp_flag_ack();
            afx_msg void OnBn_Clicked_check_tcp_flag_psh();
            afx_msg void OnBn_Clicked_check_tcp_flag_rst();
            afx_msg void OnBn_Clicked_check_tcp_flag_syn();
            afx_msg void OnBn_Clicked_check_tcp_flag_fin();
            afx_msg void OnBn_Clicked_check_udp_length();
            CButton m_check_udp_length_control;
            CButton m_check_tcp_offset_control;
            afx_msg void OnBn_Clicked_check_tcp_offset();
            CButton m_button_send_control;
            CEdit m_edit_envoi_control;
            afx_msg void OnBn_Clicked_button_clear();
            afx_msg void OnBnClickedcheckhexa();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FRAMEIPDLG_H__C0A41A9C_DBA5_419E_BAC7_E06EAD3CF015__INCLUDED_)

7.4 - FrameIpDlg.cpp

// **************************************************
// Les include
// **************************************************
#include "stdafx.h"
#include "FrameIp.h"
#include "FrameIpDlg.h"
#include "class_ip_address.h"
#include "windows.h"
#include <C:\\RepPerso\\Personnel\\Developpement\\Projets\\LibrairieSocket\\LibrairieSocket.h>
#include ".\frameipdlg.h"

// **************************************************
// Les variables
// **************************************************
struct ipv4 entete_ipv4;                                                                                   // Structure de l'entête IP
struct icmp entete_icmp;                                                                                 // Structure de l'entête ICMP
struct igmp entete_igmp;                                                                                 // Structure de l'entête IGMP
struct tcp entete_tcp;                                                                                      // Structure de l'entête TCP
struct udp entete_udp;                                                                                    // Structure de l'entête UDP
BOOL initialisation=FALSE;                                                                          // Permet de savoir si la fenetre est présente ou pas
char data[65535];                                                                                                      // chaine data qui sera émise
unsigned int sortie_de_la_boucle;                                                        // Variable permettant de gérer la sortie de la boucle
unsigned int nombre_de_trame_emise;                                                // Compte le nombre de trame emise
SOCKET id_de_la_socket;                                                                                       // Identification des socket
int nombre_de_caractere_emis;                                                                      // Variable récupérant le nombre de caractères émis

// **************************************************
// Les variables temporaires
// **************************************************
char tampon_char[65535];
char tampon_char2[65535];
int tampon_int;
CString tampon_cstring;

// **************************************************
// Les variables externes permetant le dialogue entre les différents cpp
// **************************************************
extern DWORD class_ip_address_retour_de_fenetre; // Nombre Inet_addr retourné par l'utilisateur
extern BOOL class_ip_address_selection;                                          // Permet de choisir la selection par defaut à l'ouverture de la fenetre

// **************************************************
// Les Fonctions
// **************************************************
void CFrameIpDlg::On_button_about()
            {
            // ********************************************************
            // Concatenation de l'affichage
            // ********************************************************
            sprintf(tampon_char,"                                    FrameIp Version 1.5.3.8");
            sprintf(tampon_char,"%s\n",tampon_char);
            sprintf(tampon_char,"%s\n    Create on April 26, 2003 - Last compilation on August 25, 2004",tampon_char);
            sprintf(tampon_char,"%s\n    SebF@FrameIp.Com - www.FrameIp.Com",tampon_char);
            sprintf(tampon_char,"%s\n\n",tampon_char);
           
            // ********************************************************
            // Affichage de l'About en mode fenêtre
            // ********************************************************
            MessageBox(tampon_char,"About",0);           
            }

CFrameIpDlg::CFrameIpDlg(CWnd* pParent) : CDialog(CFrameIpDlg::IDD,pParent)
, m_edit_ip_source(_T(""))
{
            m_edit_data = _T("");
            m_edit_size = 0;
            m_edit_icmp_checksum = 0;
            m_edit_icmp_code = 0;
            m_edit_icmp_id = 0;
            m_edit_icmp_sequence = 0;
            m_edit_icmp_type = 0;
            m_edit_ip_checksum = 0;
            m_edit_ip_destination = _T("");
            m_edit_ip_flags = 0;
            m_edit_ip_id = 0;
            m_edit_ip_ihl = 0;
            m_edit_ip_length = 0;
            m_edit_ip_offset = 0;
            m_edit_ip_tos = 0;
            m_edit_ip_ttl = 0;
            m_edit_ip_type = 0;
            m_edit_ip_version = 0;
            m_edit_layer_ip = _T("");
            m_edit_layer_4 = _T("");
            m_edit_igmp_checksum = 0;
            m_edit_igmp_reserved = 0;
            m_edit_igmp_type = 0;
            m_edit_igmp_version = 0;
            m_edit_igmp_destination = _T("");
            m_edit_tcp_ack = 0;
            m_edit_tcp_checksum = 0;
            m_edit_tcp_destination_port = 0;
            m_edit_tcp_offset = 0;
            m_edit_tcp_pointer = 0;
            m_edit_tcp_reserved = 0;
            m_edit_tcp_sequence = 0;
            m_edit_tcp_source_port = 0;
            m_edit_tcp_window = 0;
            m_edit_udp_checksum = 0;
            m_edit_udp_destination_port = 0;
            m_edit_udp_length = 0;
            m_edit_udp_source_port = 0;
            m_static_layer_4 = _T("");
            m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
            }

void CFrameIpDlg::DoDataExchange(CDataExchange* pDX)
            {
                        CDialog::DoDataExchange(pDX);
                        DDX_Control(pDX, IDC_spin_udp_source_port, m_spin_udp_source_port_control);
                        DDX_Control(pDX, IDC_spin_udp_destination_port, m_spin_udp_destination_port_control);
                        DDX_Control(pDX, IDC_spin_tcp_window, m_spin_tcp_window_control);
                        DDX_Control(pDX, IDC_spin_tcp_source_port, m_spin_tcp_source_port_control);
                        DDX_Control(pDX, IDC_spin_tcp_reserved, m_spin_tcp_reserved_control);
                        DDX_Control(pDX, IDC_spin_tcp_pointer, m_spin_tcp_pointer_control);
                        DDX_Control(pDX, IDC_spin_tcp_destination_port, m_spin_tcp_destination_port_control);
                        DDX_Control(pDX, IDC_spin_icmp_type, m_spin_icmp_type_control);
                        DDX_Control(pDX, IDC_spin_icmp_sequence, m_spin_icmp_sequence_control);
                        DDX_Control(pDX, IDC_spin_icmp_id, m_spin_icmp_id_control);
                        DDX_Control(pDX, IDC_spin_icmp_code, m_spin_icmp_code_control);
                        DDX_Control(pDX, IDC_spin_igmp_version, m_spin_igmp_version_control);
                        DDX_Control(pDX, IDC_spin_igmp_type, m_spin_igmp_type_control);
                        DDX_Control(pDX, IDC_spin_igmp_reserved, m_spin_igmp_reserved_control);
                        DDX_Control(pDX, IDC_edit_udp_destination_port, m_edit_udp_destination_port_control);
                        DDX_Control(pDX, IDC_edit_tcp_window, m_edit_tcp_window_control);
                        DDX_Control(pDX, IDC_edit_tcp_source_port, m_edit_tcp_source_port_control);
                        DDX_Control(pDX, IDC_edit_tcp_sequence, m_edit_tcp_sequence_control);
                        DDX_Control(pDX, IDC_edit_tcp_reserved, m_edit_tcp_reserved_control);
                        DDX_Control(pDX, IDC_edit_tcp_pointer, m_edit_tcp_pointer_control);
                        DDX_Control(pDX, IDC_edit_tcp_offset, m_edit_tcp_offset_control);
                        DDX_Control(pDX, IDC_edit_tcp_destination_port, m_edit_tcp_destination_port_control);
                        DDX_Control(pDX, IDC_edit_tcp_checksum, m_edit_tcp_checksum_control);
                        DDX_Control(pDX, IDC_edit_tcp_ack, m_edit_tcp_ack_control);
                        DDX_Control(pDX, IDC_edit_udp_source_port, m_edit_udp_source_port_control);
                        DDX_Control(pDX, IDC_edit_udp_length, m_edit_udp_length_control);
                        DDX_Control(pDX, IDC_edit_udp_checksum, m_edit_udp_checksum_control);
                        DDX_Control(pDX, IDC_edit_igmp_version, m_edit_igmp_version_control);
                        DDX_Control(pDX, IDC_edit_igmp_type, m_edit_igmp_type_control);
                        DDX_Control(pDX, IDC_edit_igmp_reserved, m_edit_igmp_reserved_control);
                        DDX_Control(pDX, IDC_edit_igmp_destination, m_edit_igmp_destination_control);
                        DDX_Control(pDX, IDC_edit_igmp_checksum, m_edit_igmp_checksum_control);
                        DDX_Control(pDX, IDC_edit_icmp_type, m_edit_icmp_type_control);
                        DDX_Control(pDX, IDC_edit_icmp_sequence, m_edit_icmp_sequence_control);
                        DDX_Control(pDX, IDC_edit_icmp_id, m_edit_icmp_id_control);
                        DDX_Control(pDX, IDC_edit_icmp_code, m_edit_icmp_code_control);
                        DDX_Control(pDX, IDC_edit_icmp_checksum, m_edit_icmp_checksum_control);
                        DDX_Control(pDX, IDC_check_icmp_header, m_check_icmp_header_control);
                        DDX_Control(pDX, IDC_check_udp_header, m_check_udp_header_control);
                        DDX_Control(pDX, IDC_check_tcp_header, m_check_tcp_header_control);
                        DDX_Control(pDX, IDC_check_igmp_header, m_check_igmp_header_control);
                        DDX_Control(pDX, IDC_edit_layer_4, m_edit_layer_4_control);
                        DDX_Control(pDX, IDC_edit_layer_data, m_edit_layer_data_control);
                        DDX_Control(pDX, IDC_edit_layer_ip, m_edit_layer_ip_control);
                        DDX_Control(pDX, IDC_edit_number, m_edit_number_control);
                        DDX_Control(pDX, IDC_spin_ip_ttl, m_spin_ip_ttl_control);
                        DDX_Control(pDX, IDC_spin_timeout, m_spin_timeout_control);
                        DDX_Control(pDX, IDC_spin_number, m_spin_number_control);
                        DDX_Control(pDX, IDC_spin_ip_version, m_spin_ip_version_control);
                        DDX_Control(pDX, IDC_spin_ip_tos, m_spin_ip_tos_control);
                        DDX_Control(pDX, IDC_spin_ip_offset, m_spin_ip_offset_control);
                        DDX_Control(pDX, IDC_spin_ip_ihl, m_spin_ip_ihl_control);
                        DDX_Control(pDX, IDC_spin_ip_id, m_spin_ip_id_control);
                        DDX_Control(pDX, IDC_check_permenent, m_check_permenent_control);
                        DDX_Control(pDX, IDC_check_data, m_check_data_control);
                        DDX_Control(pDX, IDC_edit_size, m_edit_size_control);
                        DDX_Control(pDX, IDC_edit_data, m_edit_data_control);
                        DDX_Text(pDX, IDC_edit_data, m_edit_data);
                        DDX_Text(pDX, IDC_edit_size, m_edit_size);
                        DDV_MinMaxUInt(pDX, m_edit_size, 0, 65535);
                        DDX_Text(pDX, IDC_edit_icmp_checksum, m_edit_icmp_checksum);
                        DDV_MinMaxUInt(pDX, m_edit_icmp_checksum, 0, 65535);
                        DDX_Text(pDX, IDC_edit_icmp_code, m_edit_icmp_code);
                        DDV_MinMaxUInt(pDX, m_edit_icmp_code, 0, 255);
                        DDX_Text(pDX, IDC_edit_icmp_id, m_edit_icmp_id);
                        DDV_MinMaxUInt(pDX, m_edit_icmp_id, 0, 65535);
                        DDX_Text(pDX, IDC_edit_icmp_sequence, m_edit_icmp_sequence);
                        DDV_MinMaxUInt(pDX, m_edit_icmp_sequence, 0, 65535);
                        DDX_Text(pDX, IDC_edit_icmp_type, m_edit_icmp_type);
                        DDV_MinMaxUInt(pDX, m_edit_icmp_type, 0, 255);
                        DDX_Text(pDX, IDC_edit_ip_checksum, m_edit_ip_checksum);
                        DDV_MinMaxUInt(pDX, m_edit_ip_checksum, 0, 65535);
                        DDX_Text(pDX, IDC_edit_ip_destination, m_edit_ip_destination);
                        DDV_MinMaxUInt(pDX, m_edit_ip_flags, 0, 65535);
                        DDX_Text(pDX, IDC_edit_ip_id, m_edit_ip_id);
                        DDV_MinMaxUInt(pDX, m_edit_ip_id, 0, 65535);
                        DDX_Text(pDX, IDC_edit_ip_ihl, m_edit_ip_ihl);
                        DDV_MinMaxUInt(pDX, m_edit_ip_ihl, 0, 15);
                        DDX_Text(pDX, IDC_edit_ip_length, m_edit_ip_length);
                        DDV_MinMaxUInt(pDX, m_edit_ip_length, 0, 65535);
                        DDX_Text(pDX, IDC_edit_ip_offset, m_edit_ip_offset);
                        DDV_MinMaxUInt(pDX, m_edit_ip_offset, 0, 8191);
                        DDX_Text(pDX, IDC_edit_ip_tos, m_edit_ip_tos);
                        DDV_MinMaxUInt(pDX, m_edit_ip_tos, 0, 255);
                        DDX_Text(pDX, IDC_edit_ip_ttl, m_edit_ip_ttl);
                        DDV_MinMaxUInt(pDX, m_edit_ip_ttl, 0, 255);
                        DDX_Text(pDX, IDC_edit_ip_type, m_edit_ip_type);
                        DDV_MinMaxUInt(pDX, m_edit_ip_type, 0, 255);
                        DDX_Text(pDX, IDC_edit_ip_version, m_edit_ip_version);
                        DDV_MinMaxUInt(pDX, m_edit_ip_version, 0, 15);
                        DDX_Text(pDX, IDC_edit_layer_ip, m_edit_layer_ip);
                        DDX_Text(pDX, IDC_edit_layer_4, m_edit_layer_4);
                        DDX_Text(pDX, IDC_edit_igmp_checksum, m_edit_igmp_checksum);
                        DDV_MinMaxUInt(pDX, m_edit_igmp_checksum, 0, 65535);
                        DDX_Text(pDX, IDC_edit_igmp_reserved, m_edit_igmp_reserved);
                        DDV_MinMaxUInt(pDX, m_edit_igmp_reserved, 0, 255);
                        DDX_Text(pDX, IDC_edit_igmp_type, m_edit_igmp_type);
                        DDV_MinMaxUInt(pDX, m_edit_igmp_type, 0, 15);
                        DDX_Text(pDX, IDC_edit_igmp_version, m_edit_igmp_version);
                        DDV_MinMaxUInt(pDX, m_edit_igmp_version, 0, 15);
                        DDX_Text(pDX, IDC_edit_igmp_destination, m_edit_igmp_destination);
                        DDX_Text(pDX, IDC_edit_tcp_ack, m_edit_tcp_ack);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_ack, 0, 4294967295);
                        DDX_Text(pDX, IDC_edit_tcp_checksum, m_edit_tcp_checksum);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_checksum, 0, 65535);
                        DDX_Text(pDX, IDC_edit_tcp_destination_port, m_edit_tcp_destination_port);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_destination_port, 0, 65535);
                        DDX_Text(pDX, IDC_edit_tcp_offset, m_edit_tcp_offset);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_offset, 0, 15);
                        DDX_Text(pDX, IDC_edit_tcp_pointer, m_edit_tcp_pointer);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_pointer, 0, 65535);
                        DDX_Text(pDX, IDC_edit_tcp_reserved, m_edit_tcp_reserved);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_reserved, 0, 63);
                        DDX_Text(pDX, IDC_edit_tcp_sequence, m_edit_tcp_sequence);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_sequence, 0, 4294967295);
                        DDX_Text(pDX, IDC_edit_tcp_source_port, m_edit_tcp_source_port);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_source_port, 0, 4294967295);
                        DDX_Text(pDX, IDC_edit_tcp_window, m_edit_tcp_window);
                        DDV_MinMaxUInt(pDX, m_edit_tcp_window, 0, 65535);
                        DDX_Text(pDX, IDC_edit_udp_checksum, m_edit_udp_checksum);
                        DDV_MinMaxUInt(pDX, m_edit_udp_checksum, 0, 65535);
                        DDX_Text(pDX, IDC_edit_udp_destination_port, m_edit_udp_destination_port);
                        DDV_MinMaxUInt(pDX, m_edit_udp_destination_port, 0, 65535);
                        DDX_Text(pDX, IDC_edit_udp_length, m_edit_udp_length);
                        DDV_MinMaxUInt(pDX, m_edit_udp_length, 0, 65535);
                        DDX_Text(pDX, IDC_edit_udp_source_port, m_edit_udp_source_port);
                        DDV_MinMaxUInt(pDX, m_edit_udp_source_port, 0, 65535);
                        DDX_Text(pDX, IDC_static_layer_4, m_static_layer_4);
                        DDX_Control(pDX, IDC_edit_ip_version, m_edit_ip_version_control);
                        DDX_Control(pDX, IDC_edit_ip_ihl, m_edit_ip_ihl_control);
                        DDX_Control(pDX, IDC_edit_ip_tos, m_edit_ip_tos_control);
                        DDX_Control(pDX, IDC_edit_ip_length, m_edit_ip_length_control);
                        DDX_Control(pDX, IDC_edit_ip_id, m_edit_ip_id_control);
                        DDX_Control(pDX, IDC_edit_ip_offset, m_edit_ip_offset_control);
                        DDX_Control(pDX, IDC_edit_ip_ttl, m_edit_ip_ttl_control);
                        DDX_Control(pDX, IDC_edit_ip_type, m_edit_ip_type_control);
                        DDX_Control(pDX, IDC_edit_ip_checksum, m_edit_ip_checksum_control);
                        DDX_Control(pDX, IDC_edit_ip_destination, m_edit_ip_destination_control);
                        DDX_Control(pDX, IDC_edit_timeout, m_edit_timeout_control);
                        DDX_Control(pDX, IDC_static_layer_4, m_static_layer_4_control);
                        DDX_Control(pDX, IDC_edit_ip_source, m_edit_ip_source_control);
                        DDX_Text(pDX, IDC_edit_ip_source, m_edit_ip_source);
                        DDX_Control(pDX, IDC_button_get_igmp_destination, m_button_get_igmp_destination_control);
                        DDX_Control(pDX, IDC_spin_size, m_spin_size_control);
                        DDV_MaxChars(pDX, m_edit_data, 65535);
                        DDX_Control(pDX, IDC_check_icmp_checksum, m_check_icmp_checksum_control);
                        DDX_Control(pDX, IDC_check_igmp_checksum, m_check_igmp_checksum_control);
                        DDX_Control(pDX, IDC_check_tcp_checksum, m_check_tcp_checksum_control);
                        DDX_Control(pDX, IDC_check_udp_checksum, m_check_udp_checksum_control);
                        DDX_Control(pDX, IDC_check_ip_checksum, m_check_ip_checksum_control);
                        DDX_Control(pDX, IDC_check_ip_type, m_check_ip_type_control);
                        DDX_Control(pDX, IDC_static_layer_5, m_static_data_control);
                        DDX_Control(pDX, IDC_check_ip_flag_none, m_check_ip_flag_none_control);
                        DDX_Control(pDX, IDC_check_hexa, m_check_hexa_control);
                        DDX_Control(pDX, IDC_check_ip_flag_df, m_check_ip_flag_df_control);
                        DDX_Control(pDX, IDC_check_ip_flag_mf, m_check_ip_flag_mf_control);
                        DDX_Control(pDX, IDC_check_ip_length, m_check_ip_length_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_urg, m_check_tcp_flag_urg_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_ack, m_check_tcp_flag_ack_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_psh, m_check_tcp_flag_psh_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_rst, m_check_tcp_flag_rst_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_syn, m_check_tcp_flag_syn_control);
                        DDX_Control(pDX, IDC_check_tcp_flag_fin, m_check_tcp_flag_fin_control);
                        DDX_Control(pDX, IDC_check_udp_length, m_check_udp_length_control);
                        DDX_Control(pDX, IDC_check_tcp_offset, m_check_tcp_offset_control);
                        DDX_Control(pDX, IDC_button_send, m_button_send_control);
                        DDX_Control(pDX, IDC_edit_envoi, m_edit_envoi_control);
            }

BEGIN_MESSAGE_MAP(CFrameIpDlg, CDialog)
            ON_WM_PAINT()
            ON_WM_QUERYDRAGICON()
            ON_BN_CLICKED(IDC_button_send, On_button_send)
            ON_BN_CLICKED(IDC_button_stop, On_button_stop)
            ON_BN_CLICKED(IDC_button_about, On_button_about)
            ON_BN_CLICKED(IDC_check_data, On_check_data)
            ON_BN_CLICKED(IDC_check_permenent, On_check_permenent)
            ON_WM_SYSCOMMAND()
            ON_WM_CLOSE()
            ON_EN_CHANGE(IDC_edit_ip_version, OnEn_Change_edit_ip_version)
            ON_EN_CHANGE(IDC_edit_ip_ihl, OnEn_Change_edit_ip_ihl)
            ON_EN_CHANGE(IDC_edit_ip_tos, OnEn_Change_edit_ip_tos)
            ON_EN_CHANGE(IDC_edit_ip_length, OnEn_Change_edit_ip_length)
            ON_EN_CHANGE(IDC_edit_ip_id, OnEn_Change_edit_ip_id)
            ON_EN_CHANGE(IDC_edit_ip_offset, OnEn_Change_edit_ip_offset)
            ON_EN_CHANGE(IDC_edit_ip_ttl, OnEn_Change_edit_ip_ttl)
            ON_EN_CHANGE(IDC_edit_ip_type, OnEn_Change_edit_ip_type)
            ON_EN_CHANGE(IDC_edit_ip_checksum, OnEn_Change_edit_ip_checksum)
            ON_EN_CHANGE(IDC_edit_ip_source, OnEn_Change_edit_ip_source)
            ON_EN_CHANGE(IDC_edit_ip_destination, OnEn_Change_edit_ip_destination)
            ON_BN_CLICKED(IDC_check_icmp_header, On_Change_check_icmp_header)
            ON_BN_CLICKED(IDC_check_igmp_header, On_Change_check_igmp_header)
            ON_BN_CLICKED(IDC_check_tcp_header, On_Change_check_tcp_header)
            ON_BN_CLICKED(IDC_check_udp_header, On_Change_check_udp_header)

            ON_EN_CHANGE(IDC_edit_icmp_type, OnEn_Change_edit_icmp_type)
            ON_EN_CHANGE(IDC_edit_icmp_code, OnEn_Change_edit_icmp_code)
            ON_EN_CHANGE(IDC_edit_icmp_checksum, OnEn_Change_edit_icmp_checksum)
            ON_EN_CHANGE(IDC_edit_icmp_id, OnEn_Change_edit_icmp_id)
            ON_EN_CHANGE(IDC_edit_icmp_sequence, OnEn_Change_edit_icmp_sequence)
            ON_EN_CHANGE(IDC_edit_igmp_version, OnEn_Change_edit_igmp_version)
            ON_EN_CHANGE(IDC_edit_igmp_type, OnEn_Change_edit_igmp_type)
            ON_EN_CHANGE(IDC_edit_igmp_reserved, OnEn_Change_edit_igmp_reserved)
            ON_EN_CHANGE(IDC_edit_igmp_checksum, OnEn_Change_edit_igmp_checksum)
            ON_EN_CHANGE(IDC_edit_igmp_destination, OnEn_Change_edit_igmp_destination)
            ON_EN_CHANGE(IDC_edit_tcp_source_port, OnEn_Change_edit_tcp_source_port)
            ON_EN_CHANGE(IDC_edit_tcp_destination_port, OnEn_Change_edit_tcp_destination_port)
            ON_EN_CHANGE(IDC_edit_tcp_sequence, OnEn_Change_edit_tcp_sequence)
            ON_EN_CHANGE(IDC_edit_tcp_ack, OnEn_Change_edit_tcp_ack)
            ON_EN_CHANGE(IDC_edit_tcp_offset, OnEn_Change_edit_tcp_offset)
            ON_EN_CHANGE(IDC_edit_tcp_reserved, OnEn_Change_edit_tcp_reserved)
            ON_EN_CHANGE(IDC_edit_tcp_window, OnEn_Change_edit_tcp_window)
            ON_EN_CHANGE(IDC_edit_tcp_checksum, OnEn_Change_edit_tcp_checksum)
            ON_EN_CHANGE(IDC_edit_tcp_pointer, OnEn_Change_edit_tcp_pointer)
            ON_EN_CHANGE(IDC_edit_udp_source_port, OnEn_Change_edit_udp_source_port)
            ON_EN_CHANGE(IDC_edit_udp_destination_port, OnEn_Change_edit_udp_destination_port)
            ON_EN_CHANGE(IDC_edit_udp_length, OnEn_Change_edit_udp_length)
            ON_EN_CHANGE(IDC_edit_udp_checksum, OnEn_Change_edit_udp_checksum)
            ON_BN_CLICKED(IDC_button_get_ip_destination, OnBn_Clicked_button_get_ip_destination)
            ON_BN_CLICKED(IDC_button_get_ip_source, OnBn_Clicked_button_get_ip_source)
            ON_BN_CLICKED(IDC_button_get_igmp_destination, OnBn_Clicked_button_get_igmp_destination)
            ON_EN_CHANGE(IDC_edit_data, OnEn_Change_edit_data)
            ON_EN_CHANGE(IDC_edit_size, OnEn_Change_edit_size)
            ON_BN_CLICKED(IDC_check_icmp_checksum, OnBn_Clicked_check_icmp_checksum)
            ON_BN_CLICKED(IDC_check_igmp_checksum, OnBn_Clicked_check_igmp_checksum)
            ON_BN_CLICKED(IDC_check_tcp_checksum, OnBn_Clicked_check_tcp_checksum)
            ON_BN_CLICKED(IDC_check_udp_checksum, OnBn_Clicked_check_udp_checksum)
            ON_BN_CLICKED(IDC_check_ip_checksum, OnBn_Clicked_check_ip_checksum)
            ON_BN_CLICKED(IDC_check_ip_type, OnBn_Clicked_check_ip_type)
            ON_BN_CLICKED(IDC_check_ip_length, OnBn_Clicked_check_ip_length)
            ON_BN_CLICKED(IDC_check_ip_flag_none, OnBn_Clicked_check_ip_flag_none)
            ON_BN_CLICKED(IDC_check_ip_flag_df, OnBn_Clicked_check_ip_flag_df)
            ON_BN_CLICKED(IDC_check_ip_flag_mf, OnBn_Clicked_check_ip_flag_mf)
            ON_BN_CLICKED(IDC_check_tcp_flag_urg, OnBn_Clicked_check_tcp_flag_urg)
            ON_BN_CLICKED(IDC_check_tcp_flag_ack, OnBn_Clicked_check_tcp_flag_ack)
            ON_BN_CLICKED(IDC_check_tcp_flag_psh, OnBn_Clicked_check_tcp_flag_psh)
            ON_BN_CLICKED(IDC_check_tcp_flag_rst, OnBn_Clicked_check_tcp_flag_rst)
            ON_BN_CLICKED(IDC_check_tcp_flag_syn, OnBn_Clicked_check_tcp_flag_syn)
            ON_BN_CLICKED(IDC_check_tcp_flag_fin, OnBn_Clicked_check_tcp_flag_fin)
            ON_BN_CLICKED(IDC_check_udp_length, OnBn_Clicked_check_udp_length)
            ON_BN_CLICKED(IDC_check_tcp_offset, OnBn_Clicked_check_tcp_offset)
            ON_BN_CLICKED(IDC_button_clear, OnBn_Clicked_button_clear)
            ON_BN_CLICKED(IDC_check_hexa, OnBnClickedcheckhexa)
END_MESSAGE_MAP()

BOOL CFrameIpDlg::OnInitDialog()
            {
            struct structure_ip_local reception_des_ip_locales;

            // **************************************************
            // Orginie VC++
            // **************************************************
            CDialog::OnInitDialog();
            SetIcon(m_hIcon, TRUE);                              // Set big icon
            SetIcon(m_hIcon, FALSE);                 // Set small icon

            // **************************************************
            // Insert le "String Table" dans le menu
            // **************************************************
            ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
            ASSERT(IDM_ABOUTBOX < 0xF000);

            CMenu* pSysMenu = GetSystemMenu(FALSE);
            if (pSysMenu != NULL)
                        {
                        CString strAboutMenu;
                        strAboutMenu.LoadString(IDS_ABOUTBOX);
                        if (!strAboutMenu.IsEmpty())
                                   {
                                   pSysMenu->AppendMenu(MF_SEPARATOR);
                                   pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
                                   }
                        }

            // ********************************************************
            // Initialisation de l'entête IP
            // ********************************************************
            entete_ipv4.version=4;
            entete_ipv4.ihl=5;
            entete_ipv4.tos=0;
            entete_ipv4.length=htons(0);
            entete_ipv4.id=htons(5000);
            entete_ipv4.flag_zero=0;
            entete_ipv4.flag_mf=0;
            entete_ipv4.flag_df=0;
            entete_ipv4.offset=0;
            entete_ipv4.offset2=0; // Offset2 n'est là que pour la séparation d'offset
            entete_ipv4.ttl=100;
            entete_ipv4.type=1;
            entete_ipv4.checksum=htons(0);
            reception_des_ip_locales=recuperation_ip_local(TRUE);
            entete_ipv4.ip_source=resolution_de_nom(TRUE,reception_des_ip_locales.adresse_ip_local[0]);
            entete_ipv4.ip_destination=resolution_de_nom(TRUE,"www.yahoo.fr");

            // ********************************************************
            // Initialisation de l'entête ICMP
            // ********************************************************
            entete_icmp.type=8;
            entete_icmp.code=0;
            entete_icmp.checksum=htons(0);
            entete_icmp.id=htons(0);
            entete_icmp.sequence=htons(0);

            // ********************************************************
            // Initialisation de l'entête IGMP
            // ********************************************************
            entete_igmp.version=1;
            entete_igmp.type=1;
            entete_igmp.reserve=0;
            entete_igmp.checksum=htons(0);
            sprintf(tampon_char,"224.0.0.1");
            entete_igmp.ip_destination=resolution_de_nom(TRUE,tampon_char); 

            // ********************************************************
            // Initialisation de l'entête TCP
            // ********************************************************
            entete_tcp.port_source=htons(5000);
            entete_tcp.port_destination=htons(80);
            entete_tcp.sequence=htonl(0);
            entete_tcp.accuse=htonl(0);
            entete_tcp.offset=5;
            entete_tcp.reserved=0;
            entete_tcp.reserved2=0;

            entete_tcp.flag_urg=0;
            entete_tcp.flag_ack=1;
            entete_tcp.flag_psh=0;
            entete_tcp.flag_rst=0;
            entete_tcp.flag_syn=0;
            entete_tcp.flag_fin=0;

            entete_tcp.window=htons(0);
            entete_tcp.checksum=htons(0);
            entete_tcp.pointeur=htons(0);

            // ********************************************************
            // Initialisation de l'entête UDP
            // ********************************************************
            entete_udp.port_source=htons(0);
            entete_udp.port_destination=htons(53);
            entete_udp.length=htons(8);
            entete_udp.checksum=htons(0);

            // ********************************************************
            // Initialisation de la couche DATA
            // ********************************************************
            m_edit_data="www.frameip.com ";
            m_edit_size=strlen(m_edit_data);
            strcpy(data,m_edit_data);
            sprintf(tampon_char,"1");
            m_edit_number_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"1000");
            m_edit_timeout_control.SetWindowText(tampon_char);

            // ********************************************************
            // Affichage des champs de l'entête IP
            // ********************************************************
            sprintf(tampon_char,"%d",entete_ipv4.version);
            m_edit_ip_version_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_ipv4.ihl);
            m_edit_ip_ihl_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_ipv4.tos);
            m_edit_ip_tos_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_ipv4.length));
            m_edit_ip_length_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_ipv4.id));
            m_edit_ip_id_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_ipv4.offset);
            m_edit_ip_offset_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_ipv4.ttl);
            m_edit_ip_ttl_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_ipv4.type);
            m_edit_ip_type_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_ipv4.checksum));
            m_edit_ip_checksum_control.SetWindowText(tampon_char);
            m_edit_ip_source_control.SetWindowText(reception_des_ip_locales.adresse_ip_local[0]);
            m_edit_ip_destination_control.SetWindowText("www.yahoo.fr");

            // ********************************************************
            // Affichage des champs de l'entête ICMP
            // ********************************************************
            sprintf(tampon_char,"%d",entete_icmp.type);
            m_edit_icmp_type_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_icmp.code);
            m_edit_icmp_code_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_icmp.checksum));
            m_edit_icmp_checksum_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_icmp.id));
            m_edit_icmp_id_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_icmp.sequence));
            m_edit_icmp_sequence_control.SetWindowText(tampon_char);

            // ********************************************************
            // Affichage des champs de l'entête IGMP
            // ********************************************************
            sprintf(tampon_char,"%d",entete_igmp.version);
            m_edit_igmp_version_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_igmp.type);
            m_edit_igmp_type_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_igmp.reserve);
            m_edit_igmp_reserved_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_igmp.checksum));
            m_edit_igmp_checksum_control.SetWindowText(tampon_char);
            m_edit_igmp_destination_control.SetWindowText("224.0.0.1");

            // ********************************************************
            // Affichage des champs de l'entête TCP
            // ********************************************************
            sprintf(tampon_char,"%d",htons(entete_tcp.port_source));
            m_edit_tcp_source_port_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_tcp.port_destination));
            m_edit_tcp_destination_port_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htonl(entete_tcp.sequence));
            m_edit_tcp_sequence_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htonl(entete_tcp.accuse));
            m_edit_tcp_ack_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_tcp.offset);
            m_edit_tcp_offset_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",entete_tcp.reserved);
            m_edit_tcp_reserved_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_tcp.window));
            m_edit_tcp_window_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_tcp.checksum));
            m_edit_tcp_checksum_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_tcp.pointeur));
            m_edit_tcp_pointer_control.SetWindowText(tampon_char);  
           
            // ********************************************************
            // Affichage des champs de l'entête UDP
            // ********************************************************
            sprintf(tampon_char,"%d",htons(entete_udp.port_source));
            m_edit_udp_source_port_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_udp.port_destination));
            m_edit_udp_destination_port_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_udp.length));
            m_edit_udp_length_control.SetWindowText(tampon_char);
            sprintf(tampon_char,"%d",htons(entete_udp.checksum));
            m_edit_udp_checksum_control.SetWindowText(tampon_char);

            // ********************************************************
            // Affichage des champs DATA
            // ********************************************************
            m_edit_data_control.SetWindowText(m_edit_data);
            sprintf(tampon_char,"%d",m_edit_size);
            m_edit_size_control.SetWindowText(tampon_char);
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa(); // Met à jour le champ Layer IP
            m_edit_number_control.SetReadOnly(FALSE);
            CFrameIpDlg::On_check_data(); // Initialize les ReadOnly des champs Data

            // ********************************************************
            // Active par défaut l'entête ICMP
            // ********************************************************
            m_check_icmp_header_control.SetCheck(TRUE);
            CFrameIpDlg::On_Change_check_icmp_header();
            CFrameIpDlg::mise_a_jour_du_champ_data_hexa();

            // ********************************************************
            // Activation par defaut des case à cocher
            // ********************************************************
            m_check_hexa_control.SetCheck(false);
            m_check_ip_length_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_ip_length();
            m_check_ip_flag_none_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_ip_flag_none();
            m_check_ip_flag_df_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_ip_flag_df();
            m_check_ip_flag_mf_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_ip_flag_mf();
            m_check_ip_type_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_ip_type();
            m_check_ip_checksum_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_ip_checksum();

            m_check_icmp_checksum_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_icmp_checksum();

            m_check_igmp_checksum_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_igmp_checksum();

            m_check_tcp_offset_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_tcp_offset();
            m_check_tcp_flag_urg_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_urg();
            m_check_tcp_flag_ack_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_ack();
            m_check_tcp_flag_psh_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_psh();
            m_check_tcp_flag_rst_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_rst();
            m_check_tcp_flag_syn_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_syn();
            m_check_tcp_flag_fin_control.SetCheck(false);
            CFrameIpDlg::OnBn_Clicked_check_tcp_flag_fin();
            m_check_tcp_checksum_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_tcp_checksum();

            m_check_udp_length_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_udp_length();
            m_check_udp_checksum_control.SetCheck(true);
            CFrameIpDlg::OnBn_Clicked_check_udp_checksum();

            // ********************************************************
            // Initialisation des Spins Divers
            // ********************************************************
            m_spin_number_control.SetRange32(0,65535);
            m_spin_timeout_control.SetRange32(0,65535);
            m_spin_size_control.SetRange32(0,65535);

            // ********************************************************
            // Initialisation des Spins de l'entête IP
            // ********************************************************
            m_spin_ip_version_control.SetRange32(0,15);
            m_spin_ip_ihl_control.SetRange32(0,15);
            m_spin_ip_tos_control.SetRange32(0,255);
            m_spin_ip_id_control.SetRange32(0,65535);
            m_spin_ip_offset_control.SetRange32(0,8191);
            m_spin_ip_ttl_control.SetRange32(0,255);

            // ********************************************************
            // Initialisation des Spins de l'entête ICMP
            // ********************************************************
            m_spin_icmp_type_control.SetRange32(0,255);
            m_spin_icmp_code_control.SetRange32(0,255);
            m_spin_icmp_id_control.SetRange32(0,65535);
            m_spin_icmp_sequence_control.SetRange32(0,65535);

            // ********************************************************
            // Initialisation des Spins de l'entête IGMP
            // ********************************************************
            m_spin_igmp_version_control.SetRange32(0,15);
            m_spin_igmp_type_control.SetRange32(0,15);
            m_spin_igmp_reserved_control.SetRange32(0,255);

            // ********************************************************
            // Initialisation des Spins de l'entête TCP
            // ********************************************************
            m_spin_tcp_source_port_control.SetRange32(0,65535);
            m_spin_tcp_destination_port_control.SetRange32(0,65535);
            m_spin_tcp_reserved_control.SetRange32(0,63);
            m_spin_tcp_window_control.SetRange32(0,65535);
            m_spin_tcp_pointer_control.SetRange32(0,65535);

            // ********************************************************
            // Initialisation des Spins de l'entête UDP
            // ********************************************************
            m_spin_udp_source_port_control.SetRange32(0,65535);
            m_spin_udp_destination_port_control.SetRange32(0,65535);

            // **************************************************
            // Initialisation de la fenetre d'envoi
            // **************************************************
            m_edit_envoi_control.SetReadOnly(1);

            // ********************************************************
            // Je concidère à ce niveau que la fenêtre est affichée
            // ********************************************************
            initialisation=TRUE;

            return TRUE;  // return TRUE  unless you set the focus to a control
            }

void CFrameIpDlg::OnSysCommand(UINT nID, LPARAM lParam)
            {
            // **************************************************
            // Si l'utilisateur selectionne le menu About
            // **************************************************
            if ((nID & 0xFFF0) == IDM_ABOUTBOX)
                        On_button_about();
            else
                        CDialog::OnSysCommand(nID, lParam);
            }

void CFrameIpDlg::OnPaint()
{
            if (IsIconic())
            {
                        CPaintDC dc(this); // device context for painting

                        SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

                        // Center icon in client rectangle
                        int cxIcon = GetSystemMetrics(SM_CXICON);
                        int cyIcon = GetSystemMetrics(SM_CYICON);
                        CRect rect;
                        GetClientRect(&rect);
                        int x = (rect.Width() - cxIcon + 1) / 2;
                        int y = (rect.Height() - cyIcon + 1) / 2;

                        // Draw the icon
                        dc.DrawIcon(x, y, m_hIcon);
            }
            else
            {
                        CDialog::OnPaint();
            }
}

HCURSOR CFrameIpDlg::OnQueryDragIcon()
{
            return (HCURSOR) m_hIcon;
}

void CFrameIpDlg::On_check_permenent()
            {
            m_edit_number_control.SetReadOnly(m_check_permenent_control.GetCheck());
            m_spin_number_control.EnableScrollBarCtrl(1,m_check_permenent_control.GetCheck());
            }

void CFrameIpDlg::mise_a_jour_du_champ_ip_hexa()
            {
            unsigned char *entete_convertit_char;

            // ********************************************************
            // Convertit la structure en unsigned char
            // ********************************************************
            entete_convertit_char=(unsigned char *)&entete_ipv4;

            // ********************************************************
            // Convertit chaque caratère en Hexa
            // ********************************************************
            for(tampon_int=0;tampon_int<sizeof(struct ipv4);tampon_int++)
                        sprintf(tampon_char+tampon_int*2, "%02X", entete_convertit_char[tampon_int]);

            // ********************************************************
            // Met le resultat dans le champ Edit correspondant
            // ********************************************************
            m_edit_layer_ip_control.SetWindowText(tampon_char);;
            }

void CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa(void)
            {
            unsigned char *entete_convertit_char;
           
            // ********************************************************
            // Convertit la structure Icmp en unsigned char
            // ********************************************************
            entete_convertit_char=(unsigned char *)&entete_icmp;

            // ********************************************************
            // Convertit chaque caratère en Hexa
            // ********************************************************
            for(tampon_int=0;tampon_int<sizeof(struct icmp);tampon_int++)
                        sprintf(tampon_char+tampon_int*2, "%02X", entete_convertit_char[tampon_int]);

            // ********************************************************
            // Affichage du resultat Hexa
            // ********************************************************
            m_edit_layer_4_control.SetWindowText(tampon_char);
           
            // ********************************************************
            // mise_a_jour_du_champ_static_layer_4
            // ********************************************************
            mise_a_jour_du_champ_static_layer_4();
            }

void CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa(void)
            {
            unsigned char *entete_convertit_char;
           
            // ********************************************************
            // Convertit la structure Igmp en unsigned char
            // ********************************************************
            entete_convertit_char=(unsigned char *)&entete_igmp;

            // ********************************************************
            // Convertit chaque caratère en Hexa
            // ********************************************************
            for(tampon_int=0;tampon_int<sizeof(struct igmp);tampon_int++)
                        sprintf(tampon_char+tampon_int*2, "%02X", entete_convertit_char[tampon_int]);

            // ********************************************************
            // Affichage du resultat Hexa
            // ********************************************************
            m_edit_layer_4_control.SetWindowText(tampon_char);
           
            // ********************************************************
            // mise_a_jour_du_champ_static_layer_4
            // ********************************************************
            mise_a_jour_du_champ_static_layer_4();
            }

void CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa(void)
            {
            unsigned char *entete_convertit_char;
           
            // ********************************************************
            // Convertit la structure Tcp en unsigned char
            // ********************************************************
            entete_convertit_char=(unsigned char *)&entete_tcp;

            // ********************************************************
            // Convertit chaque caratère en Hexa
            // ********************************************************
            for(tampon_int=0;tampon_int<sizeof(struct tcp);tampon_int++)
                        sprintf(tampon_char+tampon_int*2, "%02X", entete_convertit_char[tampon_int]);

            // ********************************************************
            // Affichage du resultat Hexa
            // ********************************************************
            m_edit_layer_4_control.SetWindowText(tampon_char);
           
            // ********************************************************
            // mise_a_jour_du_champ_static_layer_4
            // ********************************************************
            mise_a_jour_du_champ_static_layer_4();
            }

void CFrameIpDlg::mise_a_jour_du_champ_udp_hexa(void)
            {
            unsigned char *entete_convertit_char;

            // ********************************************************
            // Convertit la structure Udp en unsigned char
            // ********************************************************
            entete_convertit_char=(unsigned char *)&entete_udp;

            // ********************************************************
            // Convertit chaque caratère en Hexa
            // ********************************************************
            for(tampon_int=0;tampon_int<sizeof(struct udp);tampon_int++)
                        sprintf(tampon_char+tampon_int*2, "%02X", entete_convertit_char[tampon_int]);

            // ********************************************************
            // Affichage du resultat Hexa
            // ********************************************************
            m_edit_layer_4_control.SetWindowText(tampon_char);
           
            // ********************************************************
            // mise_a_jour_du_champ_static_layer_4
            // ********************************************************
            mise_a_jour_du_champ_static_layer_4();
            }

void CFrameIpDlg::mise_a_jour_du_champ_static_layer_4(void)
            {
            if (m_check_icmp_header_control.GetCheck()==1)
                        {
                        sprintf(tampon_char,"ICMP Header - %d octets",sizeof(struct icmp));
                        m_edit_layer_4_control.SetReadOnly(0);
                        }
            else if (m_check_igmp_header_control.GetCheck()==1)
                        {
                        sprintf(tampon_char,"IGMP Header - %d octets",sizeof(struct igmp));
                        m_edit_layer_4_control.SetReadOnly(0);
                        }
            else if (m_check_tcp_header_control.GetCheck()==1)
                        {
                        sprintf(tampon_char,"TCP Header - %d octets",sizeof(struct tcp));
                        m_edit_layer_4_control.SetReadOnly(0);
                        }
            else if (m_check_udp_header_control.GetCheck()==1)
                        {
                        sprintf(tampon_char,"UDP Header - %d octets",sizeof(struct udp));
                        m_edit_layer_4_control.SetReadOnly(0);
                        }
            else
                        {
                        // ********************************************************
                        // Remise à zéro du champ Hexa
                        // ********************************************************
                        sprintf(tampon_char,"");
                        m_edit_layer_4_control.SetWindowText(tampon_char);

                        // ********************************************************
                        // Desactivation du champs static
                        // ********************************************************
                        sprintf(tampon_char,"No Header");
                        m_edit_layer_4_control.SetReadOnly(1);
                        }
                       
            m_static_layer_4_control.SetWindowText(tampon_char);
            }

void CFrameIpDlg::mise_a_jour_du_champ_data_hexa(void)
            {
            // ********************************************************
            // Initialisation
            // ********************************************************
            strcpy(tampon_char2,""); // Initialise tampon_char2 au cas où la taille des data serait à 0

            // ********************************************************
            // Convertion de CString en Char *
            // ********************************************************
            strcpy(tampon_char,m_edit_data);

            if (strlen(tampon_char)!=0) // Ne transcrit pas en Hexa si la chaine est vide
                        {
                        m_edit_layer_data_control.SetReadOnly(FALSE);
                        if (m_check_data_control.GetCheck()==FALSE)
                                   if (m_edit_size==0)
                                               {
                                               m_edit_layer_data_control.SetReadOnly(TRUE);
                                               strcpy(data,"");
                                               }
                                   else
                                               {
                                               // ********************************************************
                                               // Dimentionnement des Data
                                               // ********************************************************
                                               strcpy(data,dimensionnement_de_data_a_envoyer(TRUE,tampon_char,m_edit_size));

                                               // ********************************************************
                                               // Convertion en Hexa
                                               // ********************************************************
                                               for(tampon_int=0;(unsigned int)tampon_int<m_edit_size;tampon_int++)
                                                           sprintf(tampon_char2+tampon_int*2, "%02X", data[tampon_int]);
                                                }
                        else
                                   {
                                   // ********************************************************
                                   // Insertion du résultat dans data
                                   // ********************************************************
                                   strcpy(data,m_edit_data);

                                   // ********************************************************
                                   // Convertion en Hexa
                                   // ********************************************************
                                   for(tampon_int=0;(unsigned int)tampon_int<strlen(m_edit_data);tampon_int++)
                                               sprintf(tampon_char2+tampon_int*2, "%02X", tampon_char[tampon_int]);
                                   }
                        }
            else
                        {
                        m_edit_layer_data_control.SetReadOnly(TRUE);
                        strcpy(data,"");
                        }
           
            // ********************************************************
            // Affichage du resultat Hexa
            // ********************************************************
            m_edit_layer_data_control.SetWindowText(tampon_char2);

            // ********************************************************
            // Modification du champs static
            // ********************************************************
            sprintf(tampon_char,"Data - %d octets",strlen(tampon_char2)/2);
            m_static_data_control.SetWindowText(tampon_char);
            }

void CFrameIpDlg::On_Change_check_icmp_header(void)
            {
            // ********************************************************
            // Une seule entête couche 4 ne doit être active
            // ********************************************************
            if (m_check_icmp_header_control.GetCheck()==1)
                        {
                        // Désactive donc les autres entêtes
                        m_check_igmp_header_control.SetCheck(FALSE);
                        m_check_tcp_header_control.SetCheck(FALSE);
                        m_check_udp_header_control.SetCheck(FALSE);
                        }

            // ********************************************************
            // Met à jour des l'options ReadOnly des champs couche 4
            // ********************************************************
            CFrameIpDlg::read_only_des_entetes_couche_4();

            // ********************************************************
            // Calcul du checksum ICMP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_icmp_checksum();

            // ********************************************************
            // Mise à jour du champ ICMP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();

            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::On_Change_check_igmp_header(void)
            {
            // ********************************************************
            // Une seule entête couche 4 ne doit être active
            // ********************************************************
            if (m_check_igmp_header_control.GetCheck()==1)
                        {
                        m_check_icmp_header_control.SetCheck(FALSE);
                        m_check_tcp_header_control.SetCheck(FALSE);
                        m_check_udp_header_control.SetCheck(FALSE);
                        }

            // ********************************************************
            // Met à jour des l'options ReadOnly des champs couche 4
            // ********************************************************
            CFrameIpDlg::read_only_des_entetes_couche_4();

            // ********************************************************
            // Calcul du checksum IGMP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_igmp_checksum();

            // ********************************************************
            // Mise à jour du champ IGMP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
           
            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::On_Change_check_tcp_header(void)
            {
            // ********************************************************
            // Une seule entête couche 4 ne doit être active
            // ********************************************************
            if (m_check_tcp_header_control.GetCheck()==1)
                        {
                        m_check_icmp_header_control.SetCheck(FALSE);
                        m_check_igmp_header_control.SetCheck(FALSE);
                        m_check_udp_header_control.SetCheck(FALSE);
                        }

            // ********************************************************
            // Met à jour des l'options ReadOnly des champs couche 4
            // ********************************************************
            CFrameIpDlg::read_only_des_entetes_couche_4();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ TCP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
           
            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::On_Change_check_udp_header(void)
            {
            // ********************************************************
            // Une seule entête couche 4 ne doit être active
            // ********************************************************
            if (m_check_udp_header_control.GetCheck()==1)
                        {
                        m_check_icmp_header_control.SetCheck(FALSE);
                        m_check_igmp_header_control.SetCheck(FALSE);
                        m_check_tcp_header_control.SetCheck(FALSE);
                        }

            // ********************************************************
            // Met à jour des l'options ReadOnly des champs couche 4
            // ********************************************************
            CFrameIpDlg::read_only_des_entetes_couche_4();

            // ********************************************************
            // Calcul du checksum UDP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_udp_checksum();

            // ********************************************************
            // Mise à jour du champ UDP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::read_only_des_entetes_couche_4(void)
            {
            // ********************************************************
            // Read Only des champs ICMP
            // ********************************************************
            m_edit_icmp_type_control.SetReadOnly(!m_check_icmp_header_control.GetCheck());
            m_edit_icmp_code_control.SetReadOnly(!m_check_icmp_header_control.GetCheck());
            m_check_icmp_checksum_control.EnableWindow(m_check_icmp_header_control.GetCheck());
            if(m_check_icmp_checksum_control.GetCheck()==FALSE)
                        m_edit_icmp_checksum_control.SetReadOnly(!m_check_icmp_header_control.GetCheck());
            m_edit_icmp_id_control.SetReadOnly(!m_check_icmp_header_control.GetCheck());
            m_edit_icmp_sequence_control.SetReadOnly(!m_check_icmp_header_control.GetCheck());
           
            // ********************************************************
            // Read Only des Spin ICMP
            // ********************************************************
            m_spin_icmp_type_control.EnableScrollBarCtrl(1,!m_check_icmp_header_control.GetCheck());
            m_spin_icmp_code_control.EnableScrollBarCtrl(1,!m_check_icmp_header_control.GetCheck());
            m_spin_icmp_id_control.EnableScrollBarCtrl(1,!m_check_icmp_header_control.GetCheck());
            m_spin_icmp_sequence_control.EnableScrollBarCtrl(1,!m_check_icmp_header_control.GetCheck());

            // ********************************************************
            // Read Only des champs IGMP
            // ********************************************************
            m_edit_igmp_version_control.SetReadOnly(!m_check_igmp_header_control.GetCheck());
            m_edit_igmp_type_control.SetReadOnly(!m_check_igmp_header_control.GetCheck());
            m_edit_igmp_reserved_control.SetReadOnly(!m_check_igmp_header_control.GetCheck());
            m_check_igmp_checksum_control.EnableWindow(m_check_igmp_header_control.GetCheck());
            if(m_check_igmp_checksum_control.GetCheck()==FALSE)
                        m_edit_igmp_checksum_control.SetReadOnly(!m_check_igmp_header_control.GetCheck());
            m_button_get_igmp_destination_control.EnableWindow(m_check_igmp_header_control.GetCheck());

            // ********************************************************
            // Read Only des Spin IGMP
            // ********************************************************
            m_spin_igmp_version_control.EnableScrollBarCtrl(1,!m_check_igmp_header_control.GetCheck());
            m_spin_igmp_type_control.EnableScrollBarCtrl(1,!m_check_igmp_header_control.GetCheck());
            m_spin_igmp_reserved_control.EnableScrollBarCtrl(1,!m_check_igmp_header_control.GetCheck());

            // ********************************************************
            // Read Only des champs TCP
            // ********************************************************
            m_edit_tcp_source_port_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_edit_tcp_destination_port_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_edit_tcp_sequence_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_edit_tcp_ack_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_check_tcp_offset_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            if(m_check_tcp_offset_control.GetCheck()==FALSE)
                        m_edit_tcp_offset_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_edit_tcp_reserved_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_urg_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_ack_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_psh_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_rst_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_syn_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_check_tcp_flag_fin_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            m_edit_tcp_window_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_check_tcp_checksum_control.EnableWindow(m_check_tcp_header_control.GetCheck());
            if(m_check_tcp_checksum_control.GetCheck()==FALSE)
                        m_edit_tcp_checksum_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
            m_edit_tcp_pointer_control.SetReadOnly(!m_check_tcp_header_control.GetCheck());
           
            // ********************************************************
            // Read Only des Spin TCP
            // ********************************************************
            m_spin_tcp_source_port_control.EnableScrollBarCtrl(1,!m_check_tcp_header_control.GetCheck());
            m_spin_tcp_destination_port_control.EnableScrollBarCtrl(1,!m_check_tcp_header_control.GetCheck());
            m_spin_tcp_reserved_control.EnableScrollBarCtrl(1,!m_check_tcp_header_control.GetCheck());
            m_spin_tcp_window_control.EnableScrollBarCtrl(1,!m_check_tcp_header_control.GetCheck());
            m_spin_tcp_pointer_control.EnableScrollBarCtrl(1,!m_check_tcp_header_control.GetCheck());

            // ********************************************************
            // Read Only des champs UDP
            // ********************************************************
            m_edit_udp_source_port_control.SetReadOnly(!m_check_udp_header_control.GetCheck());
            m_edit_udp_destination_port_control.SetReadOnly(!m_check_udp_header_control.GetCheck());
            m_check_udp_length_control.EnableWindow(m_check_udp_header_control.GetCheck());
            m_check_udp_checksum_control.EnableWindow(m_check_udp_header_control.GetCheck());
            if(m_check_udp_length_control.GetCheck()==FALSE)
                        m_edit_udp_length_control.SetReadOnly(!m_check_udp_header_control.GetCheck());
            if(m_check_udp_checksum_control.GetCheck()==FALSE)
                        m_edit_udp_checksum_control.SetReadOnly(!m_check_udp_header_control.GetCheck());

            // ********************************************************
            // Read Only des Spin UDP
            // ********************************************************
            m_spin_udp_source_port_control.EnableScrollBarCtrl(1,!m_check_udp_header_control.GetCheck());
            m_spin_udp_destination_port_control.EnableScrollBarCtrl(1,!m_check_udp_header_control.GetCheck());

            // ********************************************************
            // Mise à jour du champ IP_type
            // ********************************************************
            CFrameIpDlg::mise_a_jour_de_champ_ip_type();
            }

void CFrameIpDlg::mise_a_jour_de_champ_ip_type(void)
            {
            if (m_check_ip_type_control.GetCheck()==1) // Si la case à coché de Ip_type est active
                        {
                        // ********************************************************
                        // Met à jour le champ IP_type
                        // ********************************************************
                        if (m_check_icmp_header_control.GetCheck()==1)
                                   entete_ipv4.type=1;
                        else if (m_check_igmp_header_control.GetCheck()==1)
                                   entete_ipv4.type=2;
                        else if (m_check_tcp_header_control.GetCheck()==1)
                                   entete_ipv4.type=6;
                        else if (m_check_udp_header_control.GetCheck()==1)
                                   entete_ipv4.type=17;
                        else
                                   entete_ipv4.type=255;

                        sprintf(tampon_char,"%d",entete_ipv4.type);
                        m_edit_ip_type_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_version(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_version_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.version=(unsigned char)atoi(tampon_char);
                                  
                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_ihl(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_ihl_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.ihl=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_tos(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_tos_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.tos=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_length(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_length_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.length=htons((unsigned short)atoi(tampon_char));
           
                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_id(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_id_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.id=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_offset(void)
            {
            unsigned short tempo3, tempo4;

            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        // ********************************************************
                        // Récupération de la valeur
                        // ********************************************************
                        m_edit_ip_offset_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        tempo3=(unsigned short)atoi(tampon_char);

                        // ********************************************************
                        // Récupération des cinq bits finaux du premier octet
                        // ********************************************************
                        tempo4=tempo3<<3;
                        entete_ipv4.offset=tempo4>>11;

                        // ********************************************************
                        // Récupération des huit bits finaux du second octet
                        // ********************************************************
                        entete_ipv4.offset2=(unsigned char)tempo3;

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_ttl(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_ttl_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.ttl=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_type(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_type_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.type=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_checksum(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_ip_checksum_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_ipv4.checksum=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Mise à jour de l'affichage hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_source(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();

                        // ********************************************************
                        // Mise à jour des Checksum TCP et UDP (La Pseudo entete dépend de l'ip source et destination)
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();
                        CFrameIpDlg::calcul_et_affichage_udp_checksum();

                        // ********************************************************
                        // Mise à jour de l'affichage Hexa TCP et UDP
                        // ********************************************************
                        if (m_check_tcp_header_control.GetCheck()==1)
                                   CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        if (m_check_udp_header_control.GetCheck()==1)
                                   CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_ip_destination(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();

                        // ********************************************************
                        // Mise à jour des Checksum TCP et UDP (La Pseudo entete dépend de l'ip source et destination)
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();
                        CFrameIpDlg::calcul_et_affichage_udp_checksum();

                        // ********************************************************
                        // Mise à jour de l'affichage Hexa TCP et UDP
                        // ********************************************************
                        if (m_check_tcp_header_control.GetCheck()==1)
                                   CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        if (m_check_udp_header_control.GetCheck()==1)
                                   CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

                        // ********************************************************
                        // Calcul du checksum IP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_checksum();

                        // ********************************************************
                        // Mise à jour du champ Hexa IP
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_icmp_type(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_icmp_type_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.type=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum ICMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_icmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ ICMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_icmp_code(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_icmp_code_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.code=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum ICMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_icmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ ICMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_icmp_checksum(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_icmp_checksum_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.checksum=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Mise à jour du champ ICMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_icmp_id(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_icmp_id_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.id=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum ICMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_icmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ ICMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_icmp_sequence(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_icmp_sequence_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.sequence=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum ICMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_icmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ ICMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_igmp_version(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_igmp_version_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.version=atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IGMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_igmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ IGMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_igmp_type(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_igmp_type_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.type=atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IGMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_igmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ IGMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_igmp_reserved(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_igmp_reserved_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.reserve=(unsigned char)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IGMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_igmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ IGMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_igmp_checksum(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_igmp_checksum_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.checksum=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Mise à jour du champ IGMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_igmp_destination(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_igmp_destination_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.ip_destination=atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum IGMP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_igmp_checksum();

                        // ********************************************************
                        // Mise à jour du champ IGMP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_source_port(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_source_port_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.port_source=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_destination_port(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_destination_port_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.port_destination=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_sequence(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_sequence_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.sequence=htonl(atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_ack(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_ack_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.accuse=htonl(atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_offset(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_offset_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.offset=atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_reserved(void)
            {
            unsigned short tempo1,tempo2;

            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        // ********************************************************
                        // Récupération de la valeur
                        // ********************************************************
                        m_edit_tcp_reserved_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        tempo1=(unsigned short)atoi(tampon_char);

                        // ********************************************************
                        // Récupération des quatre bits centraux
                        // ********************************************************
                        tempo2=tempo1<<2; // Rajoute 2 0 à droite en décalant
                        entete_tcp.reserved=tempo2>>4; // Rajoute 4 0 à gauche en décalant

                        // ********************************************************
                        // Récupération des deux bits finaux
                        // ********************************************************
                        tempo2=tempo1<<6;
                        entete_tcp.reserved2=tempo2>>6; // Les deux bits suivant

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_window(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_window_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.window=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_checksum(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_checksum_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.checksum=htons((unsigned short)atoi(tampon_char));
                       
                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_tcp_pointer(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_tcp_pointer_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.pointeur=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum TCP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_tcp_checksum();

                        // ********************************************************
                        // Mise à jour du champ TCP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_udp_source_port(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_udp_source_port_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_udp.port_source=(unsigned short)atoi(tampon_char);

                        // ********************************************************
                        // Calcul du checksum UDP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_udp_checksum();

                        // ********************************************************
                        // Mise à jour du champ UDP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_udp_destination_port(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_udp_destination_port_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_udp.port_destination=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Calcul du checksum UDP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_udp_checksum();

                        // ********************************************************
                        // Mise à jour du champ UDP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_udp_length(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_udp_length_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_udp.length=htons((unsigned short)atoi(tampon_char));






                        // ********************************************************
                        // Calcul du checksum UDP
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_udp_checksum();

                        // ********************************************************
                        // Mise à jour du champ UDP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_udp_checksum(void)
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        m_edit_udp_checksum_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_udp.checksum=htons((unsigned short)atoi(tampon_char));

                        // ********************************************************
                        // Mise à jour du champ UDP Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
                        }
            }

void CFrameIpDlg::OnBn_Clicked_button_get_ip_source()
            {
            class_ip_address fenetre_ip_adresse;
            SOCKADDR_IN translation;                         // Structure nécessaire à la transformation du nombre inet_addr en IP char*

            class_ip_address_selection=1;             // Annonce à la prochaine boite de dialogue la provennance

            // ********************************************************
            // Lancement de la boite de dialogue pour la saisie de l'IP
            // ********************************************************
            if (fenetre_ip_adresse.DoModal()==1)
                        {
                        entete_ipv4.ip_source=class_ip_address_retour_de_fenetre;
                        translation.sin_addr.s_addr=class_ip_address_retour_de_fenetre; // Convertion du Inet_addr en format char *
                        m_edit_ip_source_control.SetWindowText(inet_ntoa(translation.sin_addr));
                        }         
            }

void CFrameIpDlg::OnBn_Clicked_button_get_ip_destination()
            {
            class_ip_address fenetre_ip_adresse;
            SOCKADDR_IN translation;                         // Structure nécessaire à la transformation du nombre inet_addr en IP char*

            class_ip_address_selection=3;             // Annonce à la prochaine boite de dialogue la provennance

            // ********************************************************
            // Lancement de la boite de dialogue pour la saisie de l'IP
            // ********************************************************
            if (fenetre_ip_adresse.DoModal()==1)
                        {
                        entete_ipv4.ip_destination=class_ip_address_retour_de_fenetre;
                        translation.sin_addr.s_addr=class_ip_address_retour_de_fenetre; // Convertion du Inet_addr en format char *
                        m_edit_ip_destination_control.SetWindowText(inet_ntoa(translation.sin_addr));
                        }         
            }

void CFrameIpDlg::OnBn_Clicked_button_get_igmp_destination()
            {
            class_ip_address fenetre_ip_adresse;
            SOCKADDR_IN translation;                         // Structure nécessaire à la transformation du nombre inet_addr en IP char*

            class_ip_address_selection=3;             // Annonce à la prochaine boite de dialogue la provennance

            // ********************************************************
            // Lancement de la boite de dialogue pour la saisie de l'IP
            // ********************************************************
            if (fenetre_ip_adresse.DoModal()==1)
                        {
                        entete_igmp.ip_destination=class_ip_address_retour_de_fenetre;
                        translation.sin_addr.s_addr=class_ip_address_retour_de_fenetre; // Convertion du Inet_addr en format char *
                        m_edit_igmp_destination_control.SetWindowText(inet_ntoa(translation.sin_addr));
                        }         
            }

void CFrameIpDlg::On_check_data()
            {
            m_edit_size_control.SetReadOnly(m_check_data_control.GetCheck());
            m_spin_size_control.EnableScrollBarCtrl(1,m_check_data_control.GetCheck());
            m_edit_data_control.SetReadOnly(!m_check_data_control.GetCheck());

            // ********************************************************
            // Mise à jour du champ Data en Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_data_hexa();

            // ********************************************************
            // Mise à jour du champ UDP Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_udp_length();
            CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

            // ********************************************************
            // Mise à jour du champ IP Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            }

void CFrameIpDlg::OnEn_Change_edit_data()
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        // ********************************************************
                        // Mise à jour de la variable Data
                        // ********************************************************
                        m_edit_data_control.GetWindowText(m_edit_data);

                        // ********************************************************
                        // Transformation de la variable si la case à coché Hexa est active
                        // ********************************************************
                        if (m_check_hexa_control.GetCheck())
                                   {
                                   strcpy(tampon_char,m_edit_data);
                                   m_edit_data=conversion_hexa_string(tampon_char,strlen(tampon_char));
                                   }

                        // ********************************************************
                        // Mise à jour du champ Data en Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_data_hexa();

                        // ********************************************************
                        // Mise à jour du champ UDP Length
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_udp_length();
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

                        // ********************************************************
                        // Mise à jour du champ IP Length
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_length();
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnEn_Change_edit_size()
            {
            if (initialisation==1) // Vérifie si la fenêtre est présente sinon UpdateData fait planter lprogramme
                        {
                        // ********************************************************
                        // Mise  à jour de la variable taille de la Data
                        // ********************************************************
                        m_edit_size_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        m_edit_size=(unsigned int)atoi(tampon_char);
           
                        // ********************************************************
                        // Mise à jour du champ Data en Hexa
                        // ********************************************************
                        CFrameIpDlg::mise_a_jour_du_champ_data_hexa();

                        // ********************************************************
                        // Mise à jour du champ UDP Length
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_udp_length();
                        CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();

                        // ********************************************************
                        // Mise à jour du champ IP Length
                        // ********************************************************
                        CFrameIpDlg::calcul_et_affichage_ip_length();
                        CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
                        }
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_length()
            {
            // ********************************************************
            // Desactivation ou actvation du champ edit IP_length
            // ********************************************************
            m_edit_ip_length_control.SetReadOnly(m_check_ip_length_control.GetCheck());

            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_length();
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_flag_none()
            {
            entete_ipv4.flag_zero=m_check_ip_flag_none_control.GetCheck();

            // ********************************************************
            // Calcul du checksum IP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa IP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_flag_df()
            {
            entete_ipv4.flag_df=m_check_ip_flag_df_control.GetCheck();

            // ********************************************************
            // Calcul du checksum IP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa IP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_flag_mf()
            {
            entete_ipv4.flag_mf=m_check_ip_flag_mf_control.GetCheck();

            // ********************************************************
            // Calcul du checksum IP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa IP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_type()
            {
            // ********************************************************
            // Mise à jour du champ IP_type en fonction de la selection Couche 4
            // ********************************************************
            CFrameIpDlg::mise_a_jour_de_champ_ip_type();

            m_edit_ip_type_control.SetReadOnly(m_check_ip_type_control.GetCheck());
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_ip_checksum()
            {
            m_edit_ip_checksum_control.SetReadOnly(m_check_ip_checksum_control.GetCheck());

            // ********************************************************
            // Calcul du checksum IP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_ip_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa IP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_icmp_checksum()
            {
            m_edit_icmp_checksum_control.SetReadOnly(m_check_icmp_checksum_control.GetCheck());

            // ********************************************************
            // Calcul du checksum ICMP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_icmp_checksum();

            // ********************************************************
            // Mise à jour du champ ICMP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_icmp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_igmp_checksum()
            {
            m_edit_igmp_checksum_control.SetReadOnly(m_check_igmp_checksum_control.GetCheck());

            // ********************************************************
            // Calcul du checksum IGMP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_igmp_checksum();

            // ********************************************************
            // Mise à jour du champ IGMP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_igmp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_offset()
            {
            // ********************************************************
            // Desactivation ou actvation du champ edit tcp_offset
            // ********************************************************
            m_edit_tcp_offset_control.SetReadOnly(m_check_tcp_offset_control.GetCheck());

            // ********************************************************
            // Calcul de la valeur de Tcp_offset
            // ********************************************************
            entete_tcp.offset=sizeof(struct tcp)/4; // Offset représente le nombre de mot de 32 bits donc /4

            // ********************************************************
            // Mise à jour du champ Tcp_offset
            // ********************************************************
            sprintf(tampon_char,"%d",entete_tcp.offset);
            m_edit_tcp_offset_control.SetWindowText(tampon_char);
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_urg()
            {
            entete_tcp.flag_urg=m_check_tcp_flag_urg_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_ack()
            {
            entete_tcp.flag_ack=m_check_tcp_flag_ack_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_psh()
            {
            entete_tcp.flag_psh=m_check_tcp_flag_psh_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_rst()
            {
            entete_tcp.flag_rst=m_check_tcp_flag_rst_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_syn()
            {
            entete_tcp.flag_syn=m_check_tcp_flag_syn_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_flag_fin()
            {
            entete_tcp.flag_fin=m_check_tcp_flag_fin_control.GetCheck();

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ Hexa TCP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_tcp_checksum()
            {
            m_edit_tcp_checksum_control.SetReadOnly(m_check_tcp_checksum_control.GetCheck());

            // ********************************************************
            // Calcul du checksum TCP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_tcp_checksum();

            // ********************************************************
            // Mise à jour du champ TCP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_tcp_hexa();
            }

void CFrameIpDlg::OnBn_Clicked_check_udp_length()
            {
            // ********************************************************
            // Desactivation ou actvation du champ edit UDP_length
            // ********************************************************
            m_edit_udp_length_control.SetReadOnly(m_check_udp_length_control.GetCheck());

            // ********************************************************
            // Mise à jour du champ Length
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_udp_length();
            }

void CFrameIpDlg::OnBn_Clicked_check_udp_checksum()
            {
            m_edit_udp_checksum_control.SetReadOnly(m_check_udp_checksum_control.GetCheck());

            // ********************************************************
            // Calcul du checksum UDP
            // ********************************************************
            CFrameIpDlg::calcul_et_affichage_udp_checksum();

            // ********************************************************
            // Mise à jour du champ UDP Hexa
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
            }

void CFrameIpDlg::calcul_et_affichage_ip_length(void)
            {
            unsigned short tempo_longueur;

            if(m_check_ip_length_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du champ ip length
                        // ********************************************************
                        tempo_longueur=sizeof(struct ipv4);
                        if (m_check_icmp_header_control.GetCheck()==1)
                                   tempo_longueur=tempo_longueur+sizeof(struct icmp);
                        if (m_check_igmp_header_control.GetCheck()==1)
                                   tempo_longueur=tempo_longueur+sizeof(struct igmp);
                        if (m_check_tcp_header_control.GetCheck()==1)
                                   tempo_longueur=tempo_longueur+sizeof(struct tcp);
                        if (m_check_udp_header_control.GetCheck()==1)
                                   tempo_longueur=tempo_longueur+sizeof(struct udp);
                        tempo_longueur=tempo_longueur+(unsigned short)strlen(data);
                        entete_ipv4.length=htons(tempo_longueur);

                        // ********************************************************
                        // Mise à jour du champ Ip length
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_ipv4.length));
                        m_edit_ip_length_control.SetWindowText(tampon_char);
                        }

            // ********************************************************
            // Mise à jour hexa Ip
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_ip_hexa();
            }

void CFrameIpDlg::calcul_et_affichage_udp_length(void)
            {
            if(m_check_udp_length_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du champ udp length
                        // ********************************************************
                        entete_udp.length=htons((unsigned short)(sizeof(struct udp)+strlen(data)));

                        // ********************************************************
                        // Mise à jour du champ Ip length
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_udp.length));
                        m_edit_udp_length_control.SetWindowText(tampon_char);
                        }

            // ********************************************************
            // Mise à jour hexa UDP
            // ********************************************************
            CFrameIpDlg::mise_a_jour_du_champ_udp_hexa();
            }

void CFrameIpDlg::calcul_et_affichage_ip_checksum(void)
            {
            if(m_check_ip_checksum_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du checksum Ip
                        // ********************************************************
                        entete_ipv4.checksum=calcul_du_checksum_ip(TRUE,entete_ipv4);
           
                        // ********************************************************
                        // Mise à jour du champ checksum Ip
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_ipv4.checksum));
                        m_edit_ip_checksum_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::calcul_et_affichage_icmp_checksum(void)
            {         
            if(m_check_icmp_checksum_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du checksum Icmp
                        // ********************************************************
                        m_edit_data_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_icmp.checksum=calcul_du_checksum_icmp(TRUE,entete_icmp,tampon_char);
           
                        // ********************************************************
                        // Mise à jour du champ checksum Icmp
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_icmp.checksum));
                        m_edit_icmp_checksum_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::calcul_et_affichage_igmp_checksum(void)
            {
            if(m_check_igmp_checksum_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du checksum Igmp
                        // ********************************************************
                        m_edit_data_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_igmp.checksum=calcul_du_checksum_igmp(TRUE,entete_igmp,tampon_char);
                       
                        // ********************************************************
                        // Mise à jour du champ checksum Igmp
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_igmp.checksum));
                        m_edit_igmp_checksum_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::calcul_et_affichage_tcp_checksum(void)
            {
            if(m_check_tcp_checksum_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du checksum Tcp
                        // ********************************************************
                        m_edit_data_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_tcp.checksum=calcul_du_checksum_tcp(TRUE,entete_ipv4.ip_source,entete_ipv4.ip_destination,entete_tcp,tampon_char);

                        // ********************************************************
                        // Mise à jour du champ checksum Tcp
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_tcp.checksum));
                        m_edit_tcp_checksum_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::calcul_et_affichage_udp_checksum(void)
            {
            if(m_check_udp_checksum_control.GetCheck()==1)
                        {
                        // ********************************************************
                        // Calcul du checksum Udp
                        // ********************************************************
                        m_edit_data_control.GetWindowText(tampon_char,sizeof(tampon_char));
                        entete_udp.checksum=calcul_du_checksum_udp(TRUE,entete_ipv4.ip_source,entete_ipv4.ip_destination,entete_udp,tampon_char);

                        // ********************************************************
                        // Mise à jour du champ checksum Udp
                        // ********************************************************
                        sprintf(tampon_char,"%d",htons(entete_udp.checksum));
                        m_edit_udp_checksum_control.SetWindowText(tampon_char);
                        }
            }

void CFrameIpDlg::On_button_send()
            {
            WSADATA initialisation_win32;
            int on=1;                                                                                 // Permet de paramétrer la fonction SetSockOpt
            int erreur;                                                                                // Permet la gestion des erreurs

            // **************************************************
            // Desactivation du bouton Send
            // **************************************************
            m_button_send_control.EnableWindow(false); // Desactive le bouton Send

            // ********************************************************
            // Initialisation de la Socket
            // ********************************************************
            erreur=WSAStartup(MAKEWORD(2,2),&initialisation_win32);
            if (erreur!=0)
                        CFrameIpDlg::affichage_du_resultat(1);
            else
                        {
                        // ********************************************************
                        // Ouverture d'une Socket
                        // ********************************************************
                        id_de_la_socket=socket(AF_INET,SOCK_RAW,IPPROTO_IP); // AF_INET6 pour IPV6
                        if (id_de_la_socket==INVALID_SOCKET)
                                   CFrameIpDlg::affichage_du_resultat(2);
                        else
                                   {
                                   // ********************************************************
                                   // Activation de l'option permettant d'inclure l'entete IP lors de l'emission
                                   // ********************************************************
                                   erreur=setsockopt(id_de_la_socket,IPPROTO_IP,IP_HDRINCL,(char *)&on,sizeof(on));
                                   if (erreur!=0)
                                               CFrameIpDlg::affichage_du_resultat(3);
                                   else
                                               {
                                               // **************************************************
                                               // Initialise le nombre de trame qui son émise
                                               // **************************************************
                                               nombre_de_trame_emise=0;

                                               // **************************************************
                                               // Réccupération de la valeur du nombre de trame à envoyer
                                               // **************************************************
                                               m_edit_number_control.GetWindowText(tampon_char,sizeof(tampon_char));
                                               sortie_de_la_boucle=(unsigned int)atoi(tampon_char);

                                               // **************************************************
                                               // Cas où Nfois=0 et loops infinie est coché, permet de passer en envoi illimité
                                               // **************************************************
                                               if ((sortie_de_la_boucle==0)&&(m_check_permenent_control.GetCheck()==1))
                                                           sortie_de_la_boucle=1;
                                              
                                               // **************************************************
                                               // Boucle d'envoi des trames
                                               // **************************************************
                                               CFrameIpDlg::boucle_d_envoi();
                                               }
                                   }
                        }

            // **************************************************
            // Activation du bouton Send
            // **************************************************
            m_button_send_control.EnableWindow(true); // Active le bouton Send
            }

void CFrameIpDlg::boucle_d_envoi()
            {
            SOCKADDR_IN information_sur_la_destination;
            char trame_a_envoyer[65535];                       // Chaine de caratère comprennant les entêtes et la data
            int taille_de_la_trame_a_envoyer=0;

            while (sortie_de_la_boucle>0)
                        {
                        // **************************************************
                        // Incrémente le nombre de trame qui son émise
                        // **************************************************
                        nombre_de_trame_emise++;
                        liberation_du_jeton();

                        // **************************************************
                        // Décrémentation de la boucle
                        // **************************************************
                        if (m_check_permenent_control.GetCheck()==false) // Uniquement si la boucle infinie n'est pas séléctionnée par l'utilisateur
                                   sortie_de_la_boucle--;

                        // ********************************************************
                        // Concatenation des entetes avec la data
                        // ********************************************************
                        liberation_du_jeton();
                        if(m_check_icmp_header_control.GetCheck()==1)
                                   {
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_icmp,sizeof(struct icmp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct icmp),data,strlen(data));             
                                   taille_de_la_trame_a_envoyer=sizeof(struct ipv4)+sizeof(struct icmp)+strlen(data);
                                   }

                        else if(m_check_igmp_header_control.GetCheck()==1)
                                   {
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_igmp,sizeof(struct igmp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct igmp),data,strlen(data));             
                                   taille_de_la_trame_a_envoyer=sizeof(struct ipv4)+sizeof(struct igmp)+strlen(data);
                                   }

                        else if(m_check_tcp_header_control.GetCheck()==1)
                                   {
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_tcp,sizeof(struct tcp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct tcp),data,strlen(data));                
                                   taille_de_la_trame_a_envoyer=sizeof(struct ipv4)+sizeof(struct tcp)+strlen(data);
                                   }

                        else if(m_check_udp_header_control.GetCheck()==1)
                                   {
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),(unsigned short *)&entete_udp,sizeof(struct udp));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4)+sizeof(struct udp),data,strlen(data));               
                                   taille_de_la_trame_a_envoyer=sizeof(struct ipv4)+sizeof(struct udp)+strlen(data);
                                   }

                        else
                                   {
                                   memcpy(trame_a_envoyer,(unsigned short *)&entete_ipv4,sizeof(struct ipv4));
                                   memcpy(trame_a_envoyer+sizeof(struct ipv4),data,strlen(data));                    
                                   taille_de_la_trame_a_envoyer=sizeof(struct ipv4)+strlen(data);
                                   }

                        // ********************************************************
                        // Informations non utilisée mais nécessaire pour la fonction sendto
                        // ********************************************************
                        liberation_du_jeton();
                        information_sur_la_destination.sin_family=AF_INET;
                        information_sur_la_destination.sin_addr.s_addr=entete_ipv4.ip_destination;
                        information_sur_la_destination.sin_port=entete_tcp.port_destination;
           
                        // ********************************************************
                        // Envoi de la trame
                        // ********************************************************
                        liberation_du_jeton();
                        nombre_de_caractere_emis=sendto(id_de_la_socket,trame_a_envoyer,taille_de_la_trame_a_envoyer,0,(struct sockaddr*)&information_sur_la_destination,sizeof(information_sur_la_destination));

                        // ********************************************************
                        // Affichage du résultat
                        // ********************************************************
                        if (nombre_de_caractere_emis!=-1)
                                   CFrameIpDlg::affichage_du_resultat(0); // Affichage sans erreur
                        else
                                   CFrameIpDlg::affichage_du_resultat(WSAGetLastError());

                        // **************************************************
                        // Pause entre chaque trame
                        // **************************************************
                        liberation_du_jeton();
                        m_edit_timeout_control.GetWindowText(tampon_cstring);
                        if (sortie_de_la_boucle>0)
                                   pause(true,(unsigned int)atoi(tampon_cstring));
                        }
            }

void CFrameIpDlg::affichage_du_resultat(int numero_d_erreur)
            {
            struct in_addr convertion_inet_addr;

            // ********************************************************
            // Récupère le contennu du champ Edit envoi
            // ********************************************************
            m_edit_envoi_control.GetWindowText(tampon_cstring);
            sprintf(tampon_char,"%s",tampon_cstring);

            // ********************************************************
            // Vide la variable pour éviter un buffer over flow
            // ********************************************************
            if (strlen(tampon_char)+1000>sizeof(tampon_char))
                        sprintf(tampon_char,"");

            // ********************************************************
            // Permet de ne pas rajouter de retour charriot si la fenetre de reception est vide
            // ********************************************************
            if(tampon_cstring!="")
                        sprintf(tampon_char,"%s\r\n",tampon_char);

            // ********************************************************
            // Selection du message à afficher
            // ********************************************************
            if (numero_d_erreur==0) // Pas d'erreur
                        {
                        convertion_inet_addr.S_un.S_addr=entete_ipv4.ip_source;
                        sprintf(tampon_char,"%s%d - The frame was sent from %s",tampon_char,nombre_de_trame_emise,inet_ntoa(convertion_inet_addr));
                        convertion_inet_addr.S_un.S_addr=entete_ipv4.ip_destination;
                        sprintf(tampon_char,"%s to %s with %d Bytes",tampon_char,inet_ntoa(convertion_inet_addr),nombre_de_caractere_emis);
                        }
            else if (numero_d_erreur==1)
                        sprintf(tampon_char,"%sSorry, I cannot initialize WSAStartup",tampon_char);
            else if (numero_d_erreur==2)
                        sprintf(tampon_char,"%sSorry, I cannot initialize the Socket. You must be local administrator",tampon_char);
            else if (numero_d_erreur==3)
                        sprintf(tampon_char,"%sSorry, I cannot configure the Socket options. You must be local administrator",tampon_char);
            else if (numero_d_erreur==10013)
                        sprintf(tampon_char,"%s%d - Sorry, I cannot send the frame. You must be local administrator",tampon_char,nombre_de_trame_emise);
            else
                        sprintf(tampon_char,"%s%d - Sorry, I cannot send the frame. The error number is %d",tampon_char,nombre_de_trame_emise,numero_d_erreur);

            // ********************************************************
            // Affichage du résultat
            // ********************************************************
            m_edit_envoi_control.SetWindowText(tampon_char); // Affichage dans la fenetre reception
            m_edit_envoi_control.LineScroll(100000);                              // Permet de faire decendre l'affichage de la fenetre si nécessaire
            }

void CFrameIpDlg::On_button_stop()
            {
            sortie_de_la_boucle=0;
            }

void CFrameIpDlg::OnBn_Clicked_button_clear()
            {
            // **************************************************
            // Clear la fenêtre d'affichage
            // **************************************************
            m_edit_envoi_control.SetWindowText("");
            }

void CFrameIpDlg::OnClose()
            {
            // **************************************************
            // Procédure executé à la fermeture de la fenêtre
            // **************************************************
            sortie_de_la_boucle=0; // Ferme la boucle pour pas que le process reste dans le gestionnaire des tâches
            CDialog::OnClose();
            }



void CFrameIpDlg::OnBnClickedcheckhexa()
            {
            bool chaine_ok=true;
            unsigned int i;
            char c;

            if (m_check_hexa_control.GetCheck())
                        {
                        // ********************************************************
                        // Récupération des datas
                        // ********************************************************
                        m_edit_data_control.GetWindowText(m_edit_data);
                        strcpy(tampon_char,m_edit_data);

                        // ********************************************************
                        // Passe tout en majuscule
                        // ********************************************************
                        strcpy(tampon_char,strupr(tampon_char));

                        // **************************************************
                        // Vérification si il y a que des caractere hexa
                        // **************************************************
                        for (i=0;i<strlen(tampon_char);i++)
                                   {
                                   c=tampon_char[i];
                                   if (!( ((c>'A')&&(c<'F')) || ((c>'0')&&(c<'9')) ))
                                               chaine_ok=false;
                                   }
                        if (chaine_ok==false)
                                   m_check_hexa_control.SetCheck(false);
                        }


            CFrameIpDlg::OnEn_Change_edit_data();
            }

// **************************************************
// Debug
// **************************************************
// MessageBox("coucou",NULL,1);

7.5 - class_ip_address.h

#pragma once
#include "afxwin.h"

// ********************************************************
// Définition de la class class_ip_address
// ********************************************************
class class_ip_address : public CDialog
            {  
            // constructeur standard
            public : class_ip_address(CWnd* pParent = NULL);

            // Données de boîte de dialogue
            enum { IDD = IDD_ip_address };
   
            // Prise en charge DDX/DDV
            protected : virtual void DoDataExchange(CDataExchange* pDX);

            DECLARE_MESSAGE_MAP()
            public:
                        afx_msg void OnBn_Clicked_button_ok();
                        afx_msg void OnBn_Clicked_button_cancel();
                        void class_ip_address::mise_a_jour_des_readonly();
                        afx_msg void OnBn_Clicked_check_local_ip_address();
                        afx_msg void OnBn_Clicked_check_ip_address();
                        afx_msg void OnBn_Clicked_check_host_name();
                        virtual BOOL OnInitDialog();
                        CButton m_check_local_ip_address_control;
                        CButton m_check_ip_address_control;
                        CButton m_check_host_name_control;
                        CComboBox m_combobox_local_ip_address_control;
                        CIPAddressCtrl m_ip_address_ip_address_control;
                        CEdit m_edit_host_name_control;
                        afx_msg void OnCbn_Sel_change_combobox_local_ip_address();
                        afx_msg void On_Ipn_Field_changed_edit_ip_address(NMHDR *pNMHDR, LRESULT *pResult);
                        afx_msg void On_En_Change_edit_hostname();
                        afx_msg void OnNMThemeChangedcomboboxlocalipaddress(NMHDR *pNMHDR, LRESULT *pResult);
                        afx_msg void OnCbnCloseupcomboboxlocalipaddress();
                        afx_msg void OnCbnSelendokcomboboxlocalipaddress();
                        afx_msg void OnCbnEditupdatecomboboxlocalipaddress();
                        CButton m_ip_address_control;
            };

7.6 - class_ip_address.cpp

#include "stdafx.h"
#include "FrameIp.h"
#include "FrameIpDlg.h"
#include "class_ip_address.h"
#include "windows.h"
#include <C:\\RepPerso\\Personnel\\Developpement\\Projets\\LibrairieSocket\\LibrairieSocket.h>

// **************************************************
// Les variables
// **************************************************
char m_combobox_local_ip_address[15];
DWORD m_ip_address_ip_address;
char m_edit_host_name[1000];

// **************************************************
// Les variables externes permetant le dialogue entre les différents cpp
// **************************************************
DWORD class_ip_address_retour_de_fenetre;           // Voir déclaration original
BOOL class_ip_address_selection;                             // Voir déclaration original

// ********************************************************
// Déclaration de la DialogBox ip_adresse - DEBUT -
// ********************************************************
class_ip_address::class_ip_address(CWnd* pParent /*=NULL*/)      : CDialog(class_ip_address::IDD, pParent)
            {
            }

void class_ip_address::DoDataExchange(CDataExchange* pDX)
            {
                        CDialog::DoDataExchange(pDX);
                        DDX_Control(pDX, IDC_check_local_ip_address, m_check_local_ip_address_control);
                        DDX_Control(pDX, IDC_check_ip_address, m_check_ip_address_control);
                        DDX_Control(pDX, IDC_check_host_name, m_check_host_name_control);
                        DDX_Control(pDX, IDC_combobox_local_ip_address, m_combobox_local_ip_address_control);
                        DDX_Control(pDX, IDC_edit_ip_address, m_ip_address_ip_address_control);
                        DDX_Control(pDX, IDC_edit_host_name, m_edit_host_name_control);
                        DDX_Control(pDX, IDC_button_cancel, m_ip_address_control);
            }

BEGIN_MESSAGE_MAP(class_ip_address, CDialog)
            ON_BN_CLICKED(IDC_button_ok, OnBn_Clicked_button_ok)
            ON_BN_CLICKED(IDC_button_cancel, OnBn_Clicked_button_cancel)
            ON_BN_CLICKED(IDC_check_local_ip_address, OnBn_Clicked_check_local_ip_address)
            ON_BN_CLICKED(IDC_check_ip_address, OnBn_Clicked_check_ip_address)
            ON_BN_CLICKED(IDC_check_host_name, OnBn_Clicked_check_host_name)
END_MESSAGE_MAP()
// ********************************************************
// Déclaration de la DialogBox ip_adresse - FIN -
// ********************************************************

BOOL class_ip_address::OnInitDialog()
            {
            struct structure_ip_local reception_des_ip_locales;
            int i;
           
            // **************************************************
            // Orginie VC++
            // **************************************************
            CDialog::OnInitDialog();

            // **************************************************
            // Initialisation de bouton check par defaut
            // **************************************************
            if (class_ip_address_selection==1)
                        m_check_local_ip_address_control.SetCheck(TRUE);
            else
                        if (class_ip_address_selection==2)
                                   m_check_ip_address_control.SetCheck(TRUE);
                        else
                                   m_check_host_name_control.SetCheck(TRUE);

            // **************************************************
            // Initialisation du ComboBox Ip Source
            // **************************************************
            reception_des_ip_locales=recuperation_ip_local(TRUE);
            for (i=0;i<reception_des_ip_locales.nombre_d_ip_local;i++)
                        m_combobox_local_ip_address_control.AddString(reception_des_ip_locales.adresse_ip_local[i]);
            strcpy(m_combobox_local_ip_address,reception_des_ip_locales.adresse_ip_local[0]);
            m_combobox_local_ip_address_control.SetCurSel(0);

            // **************************************************
            // Initialisation des ReadOnly
            // **************************************************
            class_ip_address::mise_a_jour_des_readonly();

            return TRUE;
            }

void class_ip_address::OnBn_Clicked_button_ok()
            {
            // ********************************************************
            // Si c'est le champ Combobox des ip locale qui est sélectionné
            // ********************************************************
            if(m_check_local_ip_address_control.GetCheck()==TRUE)
                        {
                        m_combobox_local_ip_address_control.GetWindowText(m_combobox_local_ip_address,sizeof(m_combobox_local_ip_address));
                        class_ip_address_retour_de_fenetre=resolution_de_nom(TRUE,m_combobox_local_ip_address);
                        }
           
            // ********************************************************
            // Si c'est le champ IpAddresCtrl de saisie de l'IP qui est sélectionné
            // ********************************************************
                        if(m_check_ip_address_control.GetCheck()==TRUE)
                                   {
                                   m_ip_address_ip_address_control.GetAddress(m_ip_address_ip_address);
                                   class_ip_address_retour_de_fenetre=ntohl(m_ip_address_ip_address);
                                   if (class_ip_address_retour_de_fenetre==0)
                                               MessageBox("Sorry - You must specify an Ip address","Specify an Ip address",0);
                                   }
           
            // ********************************************************
            // Si c'est le champ Edit du nom d'hote qui est sélectionné
            // ********************************************************
            if(m_check_host_name_control.GetCheck()==TRUE)
                        {
                        m_edit_host_name_control.GetWindowText(m_edit_host_name,sizeof(m_edit_host_name));
                        class_ip_address_retour_de_fenetre=resolution_de_nom(TRUE,m_edit_host_name);
                        if (class_ip_address_retour_de_fenetre==0)
                                   MessageBox("Sorry, I can't resolve the host name","Can't resolve host name",0);
                        }
            if (class_ip_address_retour_de_fenetre!=0)
                        OnOK(); // Ferme la fenetre en renvoyant TRUE
            }

void class_ip_address::OnBn_Clicked_button_cancel()
            {
            OnCancel(); // Ferme la fenetre en renvoyant FALSE
            }

void class_ip_address::mise_a_jour_des_readonly()
            {
            // ********************************************************
            // Met à jour les options ReadOnly des différents champs
            // ********************************************************
            m_combobox_local_ip_address_control.EnableWindow(m_check_local_ip_address_control.GetCheck());
            m_ip_address_ip_address_control.EnableWindow(m_check_ip_address_control.GetCheck());
            m_edit_host_name_control.SetReadOnly(!m_check_host_name_control.GetCheck());
            }

void class_ip_address::OnBn_Clicked_check_local_ip_address()
            {
            // ********************************************************
            // Au moin un check doit être active
            // ********************************************************
            if (m_check_host_name_control.GetCheck()+m_check_local_ip_address_control.GetCheck()+m_check_ip_address_control.GetCheck()==0)
                        m_check_local_ip_address_control.SetCheck(TRUE);

            // ********************************************************
            // Un seul check ne doit être active
            // ********************************************************
            if (m_check_local_ip_address_control.GetCheck()==TRUE)
                        {
                        // Désactive donc les autres entêtes
                        m_check_ip_address_control.SetCheck(FALSE);
                        m_check_host_name_control.SetCheck(FALSE);
                        }
            mise_a_jour_des_readonly();
            }

void class_ip_address::OnBn_Clicked_check_ip_address()
            {
            // ********************************************************
            // Au moin un check doit être active
            // ********************************************************
            if (m_check_host_name_control.GetCheck()+m_check_local_ip_address_control.GetCheck()+m_check_ip_address_control.GetCheck()==0)
                        m_check_ip_address_control.SetCheck(TRUE);

            // ********************************************************
            // Un seul check ne doit être active
            // ********************************************************
            if (m_check_ip_address_control.GetCheck()==TRUE)
                        {
                        // Désactive donc les autres entêtes
                        m_check_local_ip_address_control.SetCheck(FALSE);
                        m_check_host_name_control.SetCheck(FALSE);
                        }




            mise_a_jour_des_readonly();
            }

void class_ip_address::OnBn_Clicked_check_host_name()
            {
            // ********************************************************
            // Au moin un check doit être active
            // ********************************************************
            if (m_check_host_name_control.GetCheck()+m_check_local_ip_address_control.GetCheck()+m_check_ip_address_control.GetCheck()==0)
                        m_check_host_name_control.SetCheck(TRUE);

            // ********************************************************
            // Un seul check ne doit être active
            // ********************************************************
            if (m_check_host_name_control.GetCheck()==TRUE)
                        {
                        // ********************************************************
                        // Désactive donc les autres entêtes
                        // ********************************************************
                        m_check_local_ip_address_control.SetCheck(FALSE);
                        m_check_ip_address_control.SetCheck(FALSE);
                        }
            mise_a_jour_des_readonly();
            }

7.7 - resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by FrameIp.rc
//
#define IDM_ABOUTBOX                    0x0010
#define IDS_ABOUTBOX                    101
#define IDD_FRAMEIP_DIALOG              102
#define IDC_edit_host_name              105
#define IDC_button_ok                   106
#define IDC_button_cancel               107
#define IDC_check_local_ip_address      108
#define IDC_edit_ip_address             109
#define IDC_combobox_local_ip_address   110
#define IDC_check_ip_address            111
#define IDC_check_host_name             112
#define IDC_static_titre                113
#define IDR_MAINFRAME                   128
#define IDD_ip_address                  150
#define IDC_edit_data                   1001
#define IDC_edit_size                   1002
#define IDC_button_send                 1003
#define IDC_button_stop                 1004
#define IDC_button_about                1005
#define IDC_check_icmp_header           1006
#define IDC_check_igmp_header           1007
#define IDC_check_tcp_header            1008
#define IDC_check_udp_header            1009
#define IDC_spin_number                 1011
#define IDC_spin_timeout                1012
#define IDC_check_permenent             1013
#define IDC_groupbox_layer_ip           1014
#define IDC_groupbox_layer_icmp         1015
#define IDC_groupbox_hexa_frame         1016
#define IDC_groupbox_layer_data         1017
#define IDC_spin_ip_length              1018
#define IDC_spin_ip_tos                 1019
#define IDC_combobox_ip_source          1020
#define IDC_edit_layer_ip               1021
#define IDC_spin_ip_ihl                 1022
#define IDC_check_data                  1023
#define IDC_spin_ip_version             1024
#define IDC_groupbox_layer_igmp         1025
#define IDC_spin_ip_offset              1026
#define IDC_spin_ip_flags               1027
#define IDC_spin_ip_id                  1028
#define IDC_groupbox_layer_tcp          1029
#define IDC_spin_ip_ttl                 1030
#define IDC_spin_ip_checksum            1031
#define IDC_spin_ip_type                1032
#define IDC_groupbox_layer_udp          1033
#define IDC_spin_icmp_type              1034
#define IDC_spin_icmp_code              1035
#define IDC_spin_icmp_checksum          1036
#define IDC_spin_icmp_id                1037
#define IDC_spin_icmp_sequence          1038
#define IDC_spin_igmp_version           1039
#define IDC_spin_igmp_type              1040
#define IDC_spin_igmp_reserved          1041
#define IDC_spin_igmp_checksum          1042
#define IDC_spin_tcp_source_port        1043
#define IDC_spin_tcp_destination_port   1044
#define IDC_spin_tcp_sequence           1045
#define IDC_spin_tcp_ack                1046
#define IDC_spin_tcp_offset             1047
#define IDC_spin_tcp_reserved           1048
#define IDC_spin_tcp_control            1049
#define IDC_spin_tcp_window             1050
#define IDC_spin_tcp_checksum           1051
#define IDC_spin_tcp_pointer            1052
#define IDC_edit_layer_4                1053
#define IDC_edit_layer_data             1054
#define IDC_spin_udp_source_port        1055
#define IDC_spin_udp_destination_port   1056
#define IDC_spin_udp_length             1057
#define IDC_edit_ip_tos                 1058
#define IDC_edit_ip_length              1059
#define IDC_spin_udp_checksum           1060
#define IDC_static_ip_flag              1060
#define IDC_static_layer_4              1061
#define IDC_edit_ip_version             1062
#define IDC_edit_ip_ihl                 1063
#define IDC_edit_ip_offset              1064
#define IDC_edit_ip_ttl                 1065
#define IDC_edit_ip_id                  1066
#define IDC_edit_ip_flags               1067
#define IDC_edit_ip_source              1068
#define IDC_edit_ip_destination         1069
#define IDC_edit_ip_type                1070
#define IDC_edit_ip_checksum            1071
#define IDC_edit_icmp_type              1072
#define IDC_edit_icmp_code              1073
#define IDC_edit_icmp_checksum          1074
#define IDC_edit_icmp_id                1075
#define IDC_edit_icmp_sequence          1076
#define IDC_edit_igmp_version           1077
#define IDC_edit_number                 1078
#define IDC_edit_igmp_type              1079
#define IDC_edit_timeout                1080
#define IDC_edit_igmp_reserved          1081
#define IDC_edit_igmp_checksum          1082
#define IDC_edit_igmp_destination       1083
#define IDC_edit_udp_source_port        1084
#define IDC_edit_udp_destination_port   1085
#define IDC_edit_udp_length             1086
#define IDC_edit_udp_checksum           1087
#define IDC_edit_tcp_source_port        1088
#define IDC_edit_tcp_destination_port   1089
#define IDC_edit_tcp_sequence           1090
#define IDC_edit_tcp_ack                1091
#define IDC_edit_tcp_offset             1092
#define IDC_edit_tcp_reserved           1093
#define IDC_edit_tcp_control            1094
#define IDC_BUTTON1                     1095
#define IDC_button_get_ip_destination   1095
#define IDC_button_get_ip_destination3  1096
#define IDC_button_get_igmp_destination 1096
#define IDC_button_get_ip_destination2  1097
#define IDC_button_get_ip_source        1097
#define IDC_spin_size                   1098
#define IDC_edit_tcp_window             1099
#define IDC_edit_tcp_checksum           1100
#define IDC_edit_tcp_pointer            1101
#define IDC_static_layer_5              1102
#define IDC_check_icmp_checksum         1103
#define IDC_check_igmp_checksum         1104
#define IDC_check_tcp_checksum          1105
#define IDC_check_udp_checksum          1106
#define IDC_check_data6                 1107
#define IDC_check_ip_checksum           1107
#define IDC_check_ip_type               1108
#define IDC_check_ip_flag_mf            1109
#define IDC_check_ip_flag_df            1110
#define IDC_check_ip_flag_none          1111
#define IDC_check_tcp_flag_urg          1112
#define IDC_check_ip_length             1113
#define IDC_check_tcp_flag_ack          1114
#define IDC_check_tcp_flag_psh          1115
#define IDC_check_udp_length            1116
#define IDC_check_tcp_flag_rst          1117
#define IDC_check_tcp_flag_syn          1118
#define IDC_check_tcp_flag_fin          1119
#define IDC_check_tcp_offset            1120
#define IDC_check_hexa                  1121
#define IDC_button_clear                1144
#define IDC_edit_envoi                  1145
#define IDC_EDIT1                       1146

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        133
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1147
#define _APS_NEXT_SYMED_VALUE           104
#endif
#endif



mot clé : utilitaire gestion creation generation vpn programme frameip exe ipv4 ip shareware tool windows free outil executable console generateur de trame generateur forger download graphique tcpip flooding software choix des champs freeware win32 gnu creer voip ipv6 flood exe

Copyright © 2011-2015 FrameIP TcpIP. Tous droits réservés. Les marques et marques commerciales mentionnées appartiennent à leurs propriétaires respectifs. L'utilisation de ce site Web TcpIP implique l'acceptation des conditions d'utilisation et du règlement sur le respect de la vie privée.
Sécurité entreprise Téléphonie entreprise Expert de votre Infrastructure Test ADSL Serinya Operateur Telecom