98{
99
100
101 string ringbuf = string(m_conf->getconf("system", "unitname")) + ":" +
102 string(m_conf->getconf("distributor", "ringbuffer"));
103
104
105 string shmname = string(m_conf->getconf("system", "unitname")) + ":" +
106 string(m_conf->getconf("distributor", "nodename"));
107
108
109 m_nnodes = 0;
110 int maxnodes = m_conf->getconfi("processor", "nnodes");
111 int idbase = m_conf->getconfi("processor", "idbase");
112
113 char* badlist = m_conf->getconf("processor", "badlist");
114
115 char* sender = m_conf->getconf("distributor", "sender", "script");
116 int portbase = m_conf->getconfi("distributor", "sender", "portbase");
117
118 char idname[12], shmid[12];
119 for (int i = 0; i < maxnodes; i++) {
120 snprintf(idname, sizeof(idname), "%2.2d", idbase + i);
121 snprintf(shmid, sizeof(shmid), "%2.2d", i);
122 if (badlist == NULL ||
123 strstr(badlist, idname) == 0) {
124 int port = (idbase + i) + portbase;
125 char portchar[256];
126 sprintf(portchar, "%d", port);
127 m_pid_sender[m_nnodes] = m_proc->Execute(sender, const_cast<char*>(ringbuf.c_str()), portchar, const_cast<char*>(shmname.c_str()),
128 shmid);
129 m_flow->clear(i);
130 m_nnodes++;
131 }
132 }
133
134
135 char* srcG = m_conf->getconf("distributor", "source");
136 if (strstr(srcG, "net") != 0) {
137
138 char* receiver = m_conf->getconf("distributor", "receiver", "script");
139 char* src = m_conf->getconf("distributor", "receiver", "host");
140 char* port = m_conf->getconf("distributor", "receiver", "port");
141
142 char idbuf[3];
143 sprintf(idbuf, "%2.2d", RF_INPUT_ID);
144 m_pid_recv = m_proc->Execute(receiver, const_cast<char*>(ringbuf.c_str()), src, port, const_cast<char*>(shmname.c_str()), idbuf);
145 m_flow->clear(RF_INPUT_ID);
146 } else if (strstr(srcG, "file") != 0) {
147
148 char* filein = m_conf->getconf("distributor", "fileinput", "script");
149 char* file = m_conf->getconf("distributor", "fileinput", "filename");
150
151 char* nnodechr = m_conf->getconf("distributor", "nnodes");
152 m_pid_recv = m_proc->Execute(filein, const_cast<char*>(ringbuf.c_str()), file, nnodechr);
153 }
154
155 m_rbufin->forceClear();
156
157
158 return 0;
159}