FACT++  1.0
void unregister_service ( DIS_DNS_CONN dnsp,
SERVICE servp 
)

Definition at line 977 of file dis.c.

References Debug_on, serv::def, dim_print_date_time(), DIS_DNS_HEADER, dis_dns_ent::dis_dns_packet, dis_dns_ent::dis_service_id, dis_update_service(), dna_write(), dis_dns_ent::dns_dis_conn_id, DIS_DNS_PACKET::format, get_node_addr(), get_node_name(), serv::id, MAX_TASK_NAME, DIS_DNS_PACKET::n_services, serv::name, DIS_DNS_PACKET::node_addr, DIS_DNS_PACKET::node_name, DIS_DNS_PACKET::port, Port_number, Protocol, DIS_DNS_PACKET::protocol, serv::registered, release_conn(), SERVICE_REG::service_def, SERVICE_REG::service_id, SERVICE_REG::service_name, DIS_DNS_PACKET::services, DIS_DNS_PACKET::size, SRC_DIS, DIS_DNS_PACKET::src_type, dis_dns_ent::task_name, and DIS_DNS_PACKET::task_name.

Referenced by dis_remove_service().

978 {
979  register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
980  register int n_services;
981  register SERVICE_REG *serv_regp;
982  extern int get_node_addr();
983 
984  if(dnsp->dns_dis_conn_id > 0)
985  {
986  if(!dis_dns_p->src_type)
987  {
988  get_node_name( dis_dns_p->node_name );
989 /*
990  strcpy( dis_dns_p->task_name, Task_name );
991 */
992  strncpy( dis_dns_p->task_name, dnsp->task_name,
993  (size_t)(MAX_TASK_NAME-4) );
994  dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
995  get_node_addr( dis_dns_p->node_addr );
996  dis_dns_p->port = htovl(Port_number);
997  dis_dns_p->protocol = htovl(Protocol);
998  dis_dns_p->src_type = htovl(SRC_DIS);
999  dis_dns_p->format = htovl(MY_FORMAT);
1000  }
1001  serv_regp = dis_dns_p->services;
1002  strcpy( serv_regp->service_name, servp->name );
1003  strcpy( serv_regp->service_def, servp->def );
1004  serv_regp->service_id = (int)htovl( (unsigned)servp->id | 0x80000000);
1005  serv_regp++;
1006  n_services = 1;
1007  servp->registered = 0;
1008  dis_dns_p->n_services = htovl(n_services);
1009  dis_dns_p->size = htovl(DIS_DNS_HEADER +
1010  n_services * (int)sizeof(SERVICE_REG));
1011 
1012 if(Debug_on)
1013 {
1015  printf("Sending UNREGISTER to dns %d as %s@%s, %d services\n",
1016  dnsp->dns_dis_conn_id,
1017  (&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
1018 }
1019  if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
1020  DIS_DNS_HEADER + n_services * (int)sizeof(SERVICE_REG)) )
1021  {
1022  release_conn(dnsp->dns_dis_conn_id, 0, 1);
1023  }
1024  if(dnsp->dis_service_id)
1026  }
1027 }
static int Protocol
Definition: dis.c:120
int dns_dis_conn_id
Definition: dis.c:44
int dna_write(int conn_id, void *buffer, int size)
Definition: dna.c:455
char task_name[MAX_NAME]
Definition: dis.c:40
int registered
Definition: dis.c:81
char name[MAX_NAME]
Definition: dis.c:72
char node_addr[4]
Definition: dim.h:274
char task_name[MAX_TASK_NAME-4]
Definition: dim.h:273
static int release_conn(int conn_id, int print_flg, int dns_flag)
Definition: dis.c:2684
int protocol
Definition: dim.h:277
int service_id
Definition: dim.h:265
int get_node_addr(char *node_addr)
Definition: utilities.c:98
char service_name[MAX_NAME]
Definition: dim.h:264
int n_services
Definition: dim.h:279
int format
Definition: dim.h:278
char node_name[MAX_NODE_NAME]
Definition: dim.h:272
SRC_TYPES src_type
Definition: dim.h:271
char service_def[MAX_NAME]
Definition: dim.h:266
#define MAX_TASK_NAME
Definition: dim.h:181
int dis_update_service(unsigned service_id)
Definition: dis.c:1685
static int Port_number
Definition: dis.c:121
int size
Definition: dim.h:270
int port
Definition: dim.h:276
char def[MAX_NAME]
Definition: dis.c:75
void dim_print_date_time()
Definition: utilities.c:134
static int Debug_on
Definition: dis.c:156
unsigned int dis_service_id
Definition: dis.c:47
#define DIS_DNS_HEADER
Definition: dim.h:283
SERVICE_REG services[MAX_SERVICE_UNIT]
Definition: dim.h:280
int get_node_name(char *node_name)
Definition: utilities.c:33
DIS_DNS_PACKET dis_dns_packet
Definition: dis.c:42
int id
Definition: dis.c:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function: