How to receive data from dahdi pcie port with third party code in c on linux

Need to read data from dahdi card e1 port with a third party code.
here is an example of code that i tried but it does not work i need your help please.

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <signal.h>
#include <sys/poll.h>
#include <sys/ioctl.h>
#include <dahdi/user.h>
#include <dahdi/fasthdlc.h>

int main()
{
int fd=0,ret=0;
char buf[128]="";

    fd=open("/dev/dahdi/channel",O_RDONLY);
  if (fd) {
  printf("open on /dev/dahdi/channel the descriptor is %d  \n",fd);

     for(;;) {
        ret = read(fd, buf, sizeof(buf));
        if(ret == 0) {
          /* EOF. */
          printf( "Error EOF reading dahdi device  , errno=%d: %s.\n", errno, strerror(errno));
          break;
        } else if(ret < 0) {

if(errno == EAGAIN || errno == EWOULDBLOCK) {
/* Done until next successful poll(). /
printf( “Error EAGAIN reading dahdi device , errno=%d: %s.\n”, errno, strerror(errno));
break;
} else if(errno == EINTR) {
/
Try again. /
printf( “Error EINTR reading dahdi device , errno=%d: %s.\n”, errno, strerror(errno));
} else if(errno == ELAST) {
printf( “Error ELAST reading dahdi device , errno=%d: %s.\n”, errno, strerror(errno));
} else {
/
Some unexpected error. /
printf( “Unexpected Error reading dahdi device , errno=%d: %s.\n”, errno, strerror(errno));
break;
}
} else {
/
Got some data. */
printf( “merci reading dahdi device %s.\n”, buf);
break
}
}

}
else {
printf(“open fail on /dev/dahdi/channel\n”);

}

exit(0);
}

but this code return
open on /dev/dahdi/channel the descriptor is 3
Unexpected Error reading dahdi device , errno=38: Function not implemented.

Again this is a developer question, although the mailing list will be different form that given for libss7.

i’m a c developper but it is my first time to try to do something like that so if you know someone whot can help me please don’t be mind

You need to use the DAHDI_SPECIFY ioctl on the file descriptor to specify which channel you’re using.

int x = 1;
ioctl(fd, DAHDI_SPECIFY, &x);

yes that work but i didn’t specify a link or link set in my code i don’t know how i must define the link in my code given that i don’t use asterisk or ss7.conf fie

ok thank all for your help