/* create entrypoint and add to the list */ void add_entrypoint (char *name, struct entrypoint_list *list) { struct entrypoint *ep; ep = create_ep(name); if (list->ep == NULL) /* empty list */ list->ep = ep; else list->end->next_ep = ep; list->end = ep; }
// allocate a new endpoint, where the path is giving the // hostname for the connections. Not much to do here, as the // port comes with the file name in the open, so we can get // the address on the open only. static endpoint_t *tnp_new(endpoint_t *parent, const char *path, charset_t cset, int from_cmdline) { (void) parent; // silence unused parameter warning (void) from_cmdline; // silence unused parameter warning tn_endpoint_t *tnep = create_ep(); char *hostname = conv_name_alloc(path, cset, CHARSET_ASCII); tnep->hostname = hostname; log_info("Telnet provider set to hostname '%s'\n", tnep->hostname); return (endpoint_t*) tnep; }
// allocate a new endpoint, where the name parameter is giving the // hostname for the connections, plus the port name. The name parameter // is modified such that it points to the port name after this endpoint // is created. // Syntax is: // <hostname>:<portname> // static endpoint_t *tnp_temp(char **name, charset_t cset) { char *end = strchr(*name, ':'); if (end == NULL) { // no ':' separator between host and port found log_error("Please provider 'hostname:port' as name!\n"); return NULL; } int n = end - *name; tn_endpoint_t *tnep = create_ep(); // create new string and copy the first n bytes of *name into it char *hostname = mem_alloc_strn(*name, n); tnep->hostname = conv_name_alloc(hostname, cset, CHARSET_ASCII); mem_free(hostname); *name = end+1; // char after the ':' log_info("Telnet provider set to hostname '%s'\n", tnep->hostname); return (endpoint_t*) tnep; }