From owner-freebsd-atm Fri Apr 12 5: 6:21 2002 Delivered-To: freebsd-atm@freebsd.org Received: from mta1-3.us4.outblaze.com (205-158-62-44.outblaze.com [205.158.62.44]) by hub.freebsd.org (Postfix) with ESMTP id AF6FA37B405 for ; Fri, 12 Apr 2002 05:06:09 -0700 (PDT) Received: from ws1-8.us4.outblaze.com (205-158-62-59.outblaze.com [205.158.62.59]) by mta1-3.us4.outblaze.com (8.11.6/8.11.6-srs) with SMTP id g3CC69U28105 for ; Fri, 12 Apr 2002 12:06:09 GMT Received: (qmail 1388 invoked by uid 1001); 12 Apr 2002 12:06:09 -0000 Message-ID: <20020412120609.1387.qmail@mail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Mailer: MIME-tools 5.41 (Entity 5.404) Received: from [194.237.142.12] by ws1-8.us4.outblaze.com with http for jazzit@sociologist.com; Fri, 12 Apr 2002 07:06:08 -0500 From: "gianluca " To: freebsd-atm@FreeBSD.ORG Date: Fri, 12 Apr 2002 07:06:08 -0500 Subject: Fore pca-200E adapter: connect to atm socket X-Originating-Ip: 194.237.142.12 X-Originating-Server: ws1-8.us4.outblaze.com Sender: owner-freebsd-atm@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I am new. I have a PC running freeBSD4.5 with Fore 200E adapter. The aim is to build on top of the ATM HARP socket part of the ss7 stack something like ATM/AAL5/SSCOP/SSCF/MTP3-B... I will only need to have some functionalities for every layer implemented. My application will have to use only a fix PVC value. In my set up I have now loopback the NIC (fiber connects Tx and RX). Through the atm commands I have set pvc in the card and IP address of a not-existing other end host. When running ping towards the not existing host I have the expected behaviour with the route to host found but obviously not response. So far so good. I have now started to use the sample programs reported in the HARP source code and modified as reported below, to use a fixed PVC value. I'd like to do a simple client -server application to start practice with the socket. The client program however doesn't start because the function connect() returns the error connect: Invalid argument. I guess that the values of satm that I pass to the function connect() are not correct. Does anyone know what's wrong? Do you know where I van find some more docs and examples apart from what is available at HARP site? Thanks Gianluca * * ATM API sample client application * * This application will open an ATM socket to a server, send a text string * in a PDU and then read one PDU from the socket and print its contents. * */ #include #include #include #include #include #include #define MAX_LEN 4096 /* Maximum PDU length */ #define MY_APPL "Client" Atm_addr_pvc pvc_addr = {0,0,0,56}; //vpi 0, vci 56 static char message[] = "A message from the client"; main(argc, argv) int argc; char **argv; { struct sockaddr_atm satm; struct t_atm_aal5 aal5; struct t_atm_net_intf netintf; struct t_atm_app_name appname; char buffer[MAX_LEN+1]; int s, n, optlen; /* * Create socket */ s = socket(AF_ATM, SOCK_SEQPACKET, ATM_PROTO_AAL5); if (s < 0) { perror("socket"); exit(1); } /* * Set up destination SAP */ bzero((caddr_t) &satm, sizeof(satm)); satm.satm_family = AF_ATM; #if (defined(BSD) && (BSD >= 199103)) satm.satm_len = sizeof(satm); #endif /* PVC address */ satm.satm_addr.t_atm_sap_addr.SVE_tag_addr = T_ATM_PRESENT; satm.satm_addr.t_atm_sap_addr.SVE_tag_selector = T_ATM_PRESENT; satm.satm_addr.t_atm_sap_addr.address_format = T_ATM_PVC_ADDR; satm.satm_addr.t_atm_sap_addr.address_length = sizeof(pvc_addr); bcopy((caddr_t)&pvc_addr, (caddr_t)satm.satm_addr.t_atm_sap_addr.address, sizeof(Atm_addr_pvc)); /* * Set up connection parameters */ aal5.forward_max_SDU_size = MAX_LEN; aal5.backward_max_SDU_size = MAX_LEN; aal5.SSCS_type = T_ATM_NULL; optlen = sizeof(aal5); if (setsockopt(s, T_ATM_SIGNALING, T_ATM_AAL5, (caddr_t)&aal5, optlen) < 0) { perror("setsockopt(aal5)"); exit(1); } strncpy(netintf.net_intf, "ni0", IFNAMSIZ); optlen = sizeof(netintf); if (setsockopt(s, T_ATM_SIGNALING, T_ATM_NET_INTF, (caddr_t)&netintf, optlen) < 0) { perror("setsockopt(net_intf)"); exit(1); } strncpy(appname.app_name, MY_APPL, T_ATM_APP_NAME_LEN); optlen = sizeof(appname); if (setsockopt(s, T_ATM_SIGNALING, T_ATM_APP_NAME, (caddr_t)&appname, optlen) < 0) { perror("setsockopt(app_name)"); exit(1); } /* * Connect the socket */ if (connect(s, (struct sockaddr *) &satm, sizeof(satm)) < 0) { perror("connect"); exit(1); } /* * Exchange message with peer */ if (write(s, message, sizeof(message)) != sizeof(message)) { perror("write"); exit(1); } if ((n = read(s, buffer, MAX_LEN)) < 0) { perror("read"); exit(1); } buffer[n] = '\0'; printf("received %d bytes: <%s>\n", n, buffer); /* * Finish up */ if (close(s) < 0) { perror("close"); exit(1); } exit(0); } -- _______________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup Looking for old school, college, work or military friends? Go to Classmates now!http://www.classmates.com/index.tf?s=6010 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-atm" in the body of the message