NetSim Source Code Help
Loading...
Searching...
No Matches
PIM_Print.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14
15#include "main.h"
16#include "List.h"
17#include "IP.h"
18#include "PIM_SM.h"
19
20static int counter[50];
21
22static print_tree(NETSIM_ID r, NETSIM_ID b, int l1, int l2, int c1, int c2,FILE* fp)
23{
24 fprintf(fp, "%d,%d,%d,%d,%d,%d\n",
25 r, b,
26 50 + 80 * c1, 50 + 80 * l1,
27 50 + 80 * c2, 50 + 80 * l2);
28 fflush(fp);
29}
30
31void print_rpt(NETSIM_ID d, ptrPIM_GROUP group, int level, int count,FILE* fp)
32{
33 UINT c = group->count;
34 fprintf(stderr, "%d,%d,%d,%d\n", d, c, level, count);
35 if (!c)
36 return;
37 NETSIM_ID* cid = calloc(c, sizeof* cid);
38 NETSIM_ID* cin = calloc(c, sizeof* cin);
40 UINT i;
41 for (i = 0; i < c; i++)
42 {
44 group->ifid[i],
45 &cid[i],
46 &f);
47 print_tree(d, cid[i], level, level + 1, count, counter[level + 1], fp);
48 cin[i] = counter[level + 1];
49 counter[level + 1]++;
50 }
51
52 for (i = 0; i < c; i++)
53 {
54 ptrPIM_GROUP g = pim_find_group(cid[i], group->groupAddress);
55 print_rpt(cid[i], g, level + 1, cin[i], fp);
56 }
57}
58
60{
61 int level = 0;
62 int count = 0;
63
64 fprintf(stderr, "\n");
65 memset(counter, 0, 50 * sizeof* counter);
66 FILE* fp = fopen("points.txt", "w");
67 print_rpt(rp, group, level, count,fp);
68 fclose(fp);
69 _getch();
70}
unsigned int NETSIM_ID
Definition: Animation.h:45
GROUP_MOBILITY * group
Definition: GroupMobility.c:30
#define c
#define _getch()
Definition: Linux.h:44
#define UINT
Definition: Linux.h:38
#define calloc(c, s)
Definition: Memory.h:29
ptrPIM_GROUP pim_find_group(NETSIM_ID d, NETSIM_IPAddress addr)
Definition: PIM_Group.c:20
static print_tree(NETSIM_ID r, NETSIM_ID b, int l1, int l2, int c1, int c2, FILE *fp)
Definition: PIM_Print.c:22
void print_RPT_Tree(NETSIM_ID rp, ptrPIM_GROUP group)
Definition: PIM_Print.c:59
void print_rpt(NETSIM_ID d, ptrPIM_GROUP group, int level, int count, FILE *fp)
Definition: PIM_Print.c:31
static int counter[50]
Definition: PIM_Print.c:20
NETSIM_ID fn_NetSim_Stack_GetConnectedDevice(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID *nConnectedDevId, NETSIM_ID *nConnectedInterfaceId)
uint f(uint state, uchar key[])
Definition: des.c:172