1 /* misc.c - Miscellaneous library functions */
3 /* Written 1997-2000 by Werner Almesberger, EPFL-ICA/ICA */
12 #include <sys/socket.h>
13 #include <sys/ioctl.h>
14 #include <netinet/in.h> /* for htons */
20 int __atmlib_fetch(const char **pos,...)
23 int ref_len,best_len,len;
28 ref_len = strlen(*pos);
31 for (i = 0; (value = va_arg(ap,const char *)); i++) {
33 if (*value != '!' && len <= ref_len && len > best_len &&
34 !strncasecmp(*pos,value,len)) {
40 if (best > -1) (*pos) += best_len;
45 void atm_tcpip_port_mapping(char *vs_id,uint8_t protocol,uint16_t port)
47 memcpy(vs_id,ATM_FORUM_OUI "\x01",4);
48 vs_id[4] = protocol; /* e.g. IP_TCP or IP_UDP; from netinet/protocols.h */
49 vs_id[5] = (htons(port) >> 8) & 255;
50 vs_id[6] = htons(port) & 255;