net.cpp File Reference

Cross-platform routines for sending and receiving packets. More...

#include "linden_common.h"
#include "net.h"
#include <stdexcept>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <errno.h>
#include "network.h"
#include "llerror.h"
#include "llhost.h"
#include "lltimer.h"
#include "indra_constants.h"

Include dependency graph for net.cpp:

Go to the source code of this file.

Functions

LLHost get_sender ()
U32 get_sender_ip (void)
U32 get_sender_port ()
const char * u32_to_ip_string (U32 ip)
char * u32_to_ip_string (U32 ip, char *ip_string)
U32 ip_string_to_u32 (const char *ip_string)
S32 start_net (S32 &socket_out, int &nPort)
void end_net (S32 &socket_out)
int receive_packet (int hSocket, char *receiveBuffer)
BOOL send_packet (int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort)

Variables

sockaddr_in stDstAddr
sockaddr_in stSrcAddr
sockaddr_in stLclAddr
const char * LOOPBACK_ADDRESS_STRING = "127.0.0.1"
const int SEND_BUFFER_SIZE = 400000
const int RECEIVE_BUFFER_SIZE = 400000


Detailed Description

Cross-platform routines for sending and receiving packets.

LicenseInfo
firstyear=2000&license=viewergpl

Copyright (c) 2000-2007, Linden Research, Inc.

Second Life Viewer Source Code The source code in this file ("Source Code") is provided by Linden Lab to you under the terms of the GNU General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other License"), formally executed by you and Linden Lab. Terms of the GPL can be found in doc/GPL-license.txt in this distribution, or online at http://secondlife.com/developers/opensource/gplv2

There are special exceptions to the terms and conditions of the GPL as it is applied to this Source Code. View the full text of the exception in the file doc/FLOSS-exception.txt in this software distribution, or online at http://secondlife.com/developers/opensource/flossexception

By copying, modifying or distributing this software, you acknowledge that you have read and understood your obligations described above, and agree to abide by those obligations.

ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. $/LicenseInfo$

Definition in file net.cpp.


Function Documentation

void end_net ( S32 socket_out  ) 

Definition at line 467 of file net.cpp.

Referenced by LLMessageSystem::~LLMessageSystem().

LLHost get_sender (  ) 

Definition at line 97 of file net.cpp.

References stSrcAddr.

Referenced by LLPacketBuffer::init(), and LLPacketRing::receivePacket().

U32 get_sender_ip ( void   ) 

Definition at line 102 of file net.cpp.

References stSrcAddr.

U32 get_sender_port (  ) 

Definition at line 107 of file net.cpp.

References stSrcAddr.

U32 ip_string_to_u32 ( const char *  ip_string  ) 

Definition at line 160 of file net.cpp.

Referenced by LLHost::LLHost(), LLHost::set(), and LLHost::setAddress().

int receive_packet ( int  hSocket,
char *  receiveBuffer 
)

Definition at line 475 of file net.cpp.

References NET_BUFFER_SIZE, and stSrcAddr.

Referenced by LLPacketBuffer::init(), and LLPacketRing::receivePacket().

BOOL send_packet ( int  hSocket,
const char *  sendBuffer,
int  size,
U32  recipient,
int  nPort 
)

Definition at line 495 of file net.cpp.

References FALSE, llinfos, S32, and TRUE.

Referenced by LLPacketRing::sendPacket().

S32 start_net ( S32 socket_out,
int &  nPort 
)

Definition at line 370 of file net.cpp.

References llformat(), llinfos, llwarns, MAXADDRSTR, NET_USE_OS_ASSIGNED_PORT, PORT_DISCOVERY_RANGE_MAX, PORT_DISCOVERY_RANGE_MIN, RECEIVE_BUFFER_SIZE, and SEND_BUFFER_SIZE.

Referenced by LLMessageSystem::LLMessageSystem().

char* u32_to_ip_string ( U32  ip,
char *  ip_string 
)

Definition at line 136 of file net.cpp.

References NULL.

const char* u32_to_ip_string ( U32  ip  ) 

Definition at line 112 of file net.cpp.

Referenced by LLHost::getIPString(), LLHost::getString(), operator<<(), LLViewerImageList::receiveImageHeader(), and LLViewerImageList::receiveImagePacket().


Variable Documentation

const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"

Definition at line 84 of file net.cpp.

Referenced by main().

const int RECEIVE_BUFFER_SIZE = 400000

Definition at line 92 of file net.cpp.

Referenced by start_net().

const int SEND_BUFFER_SIZE = 400000

Definition at line 91 of file net.cpp.

Referenced by start_net().

struct sockaddr_in stDstAddr

Definition at line 70 of file net.cpp.

struct sockaddr_in stLclAddr

Definition at line 72 of file net.cpp.

struct sockaddr_in stSrcAddr

Definition at line 71 of file net.cpp.

Referenced by get_sender(), get_sender_ip(), get_sender_port(), and receive_packet().


Generated on Thu Jul 1 06:10:56 2010 for Second Life Viewer by  doxygen 1.4.7