LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-11-2011, 01:45 PM   #1
rrlangly
Member
 
Registered: Dec 2009
Posts: 47

Rep: Reputation: 0
netnworking - 'struct proto_ops' .getname callback


I'm writing a network protocol module, and having trouble getting the information from a connected peer socket. I don't know where to pull this info from and don't understand the kernel examples.

Here is my 'struct proto_ops' callback of .getname.

Code:
static int my_getname(struct socket *sock, struct sockaddr *uaddr,
        int *uaddr_len, int peer)
{
    struct sock *sk = sock->sk;
    struct sockaddr_in *sin = (struct sockaddr_in *)uaddr;

    sin->sin_family = AF_INET;

    *uaddr_len = sizeof(struct sockaddr);

    return 0;
}
I'm just not sure how to populate the 'struct sockaddr' w/ the protocol address.

update ... It comes from the accept().

Last edited by rrlangly; 12-11-2011 at 05:24 PM.
 
Old 12-11-2011, 07:55 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Noticed that you have marked your thread as solved; What was the final fix?

Cheers,

Josh
 
Old 12-17-2011, 03:01 PM   #3
rrlangly
Member
 
Registered: Dec 2009
Posts: 47

Original Poster
Rep: Reputation: 0
I had edited the original post that this info comes from the accept() method, getname() is called after using that info obtained by accept() on a socket.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Struct passed to GTK Callback nonis Programming 7 11-10-2008 02:03 PM
GCC compile problem:struct A have a member variable which is just a struct type name? leon.zcom Programming 3 04-18-2008 04:40 PM
Call to undefined method SimpleXMLElement::getName() firemankurt Programming 0 08-12-2006 01:36 AM
g++ and wrong struct member addresses / struct size misreporting sonajiso Linux - General 5 05-22-2004 10:16 PM
switch statement converting struct char to struct int oceaneyes2 Programming 2 12-10-2003 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration