Skip to content
lgeniauxPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

122 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 ft_irc - RFC2812 Compliant IRC Server

IRC Server Demo

C++98 RFC2812 Build Network Programming

A sophisticated Internet Relay Chat (IRC) server implementation in C++98, featuring advanced network programming, comprehensive protocol compliance, and production-quality architecture.

✨ Technical Highlights

πŸš€ Advanced Network Programming

  • Non-blocking I/O with select() multiplexing for scalable concurrent client handling
  • Socket programming with proper error handling and resource management
  • Persistent connection management with graceful cleanup and disconnect detection
  • Partial command buffering for robust network packet handling

πŸ” Security & Access Control

  • Multi-stage authentication (PASS β†’ NICK β†’ USER) with state validation
  • Channel operator system with elevated privileges
  • Comprehensive channel modes: +i (invite-only), +t (topic protection), +k (key), +o (operator), +l (limit)
  • Invite-only channel management with sophisticated access control

⚑ Protocol Implementation

  • Full RFC2812 compliance with proper IRC message formatting
  • Complete numeric response codes (401, 403, 431, 432, 433, 442, etc.)
  • Hostmask implementation (nick!user@host) in all messages
  • Multi-channel operations with comma-separated JOIN commands

🎯 Core Features

IRC Commands Implemented

Command Description Advanced Features
PASS Server authentication Password validation
NICK Nickname management Conflict resolution with auto-modification
USER User registration Complete userinfo handling
JOIN Channel joining Multi-channel, key support, mode checking
PART Channel leaving Multi-channel departure
PRIVMSG Messaging Channel and private messages
TOPIC Topic management Operator restrictions, timestamps
MODE Channel/user modes All 5 IRC modes implemented
KICK User removal Operator privilege checking
INVITE User invitation Invite-only channel support
QUIT Clean disconnection Broadcast to common channels

Channel Management

  • πŸ—οΈ Dynamic channel creation - Channels created on first JOIN
  • πŸ‘‘ Automatic operator assignment - First user becomes operator
  • 🧹 Smart cleanup - Empty channels automatically removed
  • πŸ“’ Efficient broadcasting - Optimized message distribution algorithms
  • πŸ”„ Nickname propagation - Cross-channel nickname updates

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Server      β”‚    β”‚     Client      β”‚    β”‚    Channel      β”‚
β”‚   (Socket Mgmt) │◄──►│  (Auth State)   │◄──►│   (User Mgmt)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CommandHandler  β”‚    β”‚ RFC2812Handler  β”‚    β”‚   Utilities     β”‚
β”‚ (Cmd Dispatch)  β”‚    β”‚ (Protocol Msgs) β”‚    β”‚  (Validation)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Design Patterns

  • Command Registry Pattern - Modular command dispatch system
  • State Machine - Client authentication flow management
  • Observer Pattern - Channel event broadcasting
  • RAII - Resource management and cleanup

πŸš€ Quick Start

Prerequisites

  • C++ compiler with C++98 support
  • Make build system
  • Unix-like environment (Linux/macOS)

Build & Run

# Clone and build
git clone https://github.com/lgeniaux/ft_irc
cd ft_irc
make

# Start the server
./ircserv <port> <password>

# Example
./ircserv 6667 mypassword

Connect with irssi

# Install irssi (if needed)
sudo apt install irssi  # Ubuntu/Debian
brew install irssi      # macOS

# Connect to your server
irssi
/connect localhost 6667 mypassword
/join #general
/msg #general Hello from my IRC server!

πŸ”§ Advanced Usage

Multi-Channel Operations

/join #dev,#general,#random key1,key2
/part #dev,#general
/mode #channel +itk secretkey

Channel Management

/invite friend #private-channel
/kick #channel troublemaker
/topic #channel New topic here
/mode #channel +o friend

πŸ’» Technical Implementation

Network Programming Approach

  • Single-threaded design using select() for I/O multiplexing
  • Non-blocking sockets to prevent server blocking on client operations
  • Event-driven architecture for handling multiple simultaneous connections
  • Graceful error handling with proper socket cleanup

Memory Management

  • C++98 compliant memory management without modern smart pointers
  • STL containers for efficient data structure management
  • RAII principles for automatic resource cleanup
  • No memory leaks - comprehensive resource management

Code Quality Features

  • βœ… Strict compilation with -Wall -Wextra -Werror
  • βœ… Modular architecture with clear separation of concerns
  • βœ… Comprehensive error handling for network and protocol errors
  • βœ… Professional build system with dependency tracking
  • βœ… Signal handling for graceful server shutdown

πŸ“Š Performance Characteristics

  • Scalable: Handles multiple concurrent clients efficiently
  • Low latency: Direct message routing without unnecessary delays
  • Memory efficient: Optimized data structures for minimal overhead
  • Robust: Comprehensive error handling and recovery

πŸŽ“ Educational Value

This project demonstrates mastery of:

  • Systems Programming - Low-level network programming in C++
  • Protocol Implementation - Standards compliance and message formatting
  • Concurrent Programming - Multi-client handling without threading
  • Software Architecture - Clean, modular design patterns
  • Resource Management - Memory and socket lifecycle management

πŸ› οΈ Development

Project Structure

ft_irc/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Server.cpp          # Core server implementation
β”‚   β”œβ”€β”€ Client.cpp          # Client state management
β”‚   β”œβ”€β”€ Channel.cpp         # Channel operations
β”‚   β”œβ”€β”€ RFC2812Handler.cpp  # Protocol compliance
β”‚   └── commands/           # Individual IRC commands
β”œβ”€β”€ include/                # Header files
└── Makefile               # Build configuration

Build System

  • Hierarchical Makefiles for modular compilation
  • Automatic dependency tracking for efficient rebuilds
  • Colored output for professional development experience

Built with ❀️ and lots of β˜• at Γ‰cole 42

Showcasing advanced C++ systems programming and network protocol implementation

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages